stitch-ui
Version:
54 lines (49 loc) • 1.52 kB
JavaScript
import React from "react";
import PropTypes from "prop-types";
import { FormRow, FormRowInputGroup, FormRowLabelGroup } from "../../../core";
const SECRET = "secret";
export default class EditGithubWebhookOptions extends React.Component {
constructor(props) {
super(props);
this.handleChangeSecret = this.handleChangeSecret.bind(this);
}
handleChangeSecret(e) {
const { options, setWebhookOptions } = this.props;
setWebhookOptions(options.set(SECRET, e.target.value));
}
render() {
const { options } = this.props;
return (
<div>
<FormRow>
<FormRowLabelGroup>
<label className="form-row-label" htmlFor="req_validation">
Request Validation
</label>
</FormRowLabelGroup>
<FormRowInputGroup>
<div>
<label className="form-row-label" htmlFor={SECRET}>
Github Secret
</label>
<input
name={SECRET}
type="text"
className="text-input form-row-text-input"
value={options.get(SECRET)}
onChange={this.handleChangeSecret}
/>
</div>
</FormRowInputGroup>
</FormRow>
</div>
);
}
}
EditGithubWebhookOptions.propTypes = {
setWebhookOptions: PropTypes.func.isRequired,
options: PropTypes.object // eslint-disable-line react/forbid-prop-types
};
EditGithubWebhookOptions.defaultProps = {
options: null
};