Update RedactedInput and AlertConfigs to redact necesary fields afterwhen submitting form
parent
ddaf93a4ac
commit
d4f136c986
|
@ -46,6 +46,7 @@ class AlertaConfig extends PureComponent<Props, State> {
|
|||
|
||||
public render() {
|
||||
const {environment, origin, token, url} = this.props.config.options
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -80,6 +81,7 @@ class AlertaConfig extends PureComponent<Props, State> {
|
|||
id="token"
|
||||
refFunc={this.handleTokenRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class HipchatConfig extends PureComponent<Props, State> {
|
|||
public render() {
|
||||
const {options} = this.props.config
|
||||
const {url, room, token} = options
|
||||
const {testEnabled} = this.state
|
||||
|
||||
const subdomain = url
|
||||
.replace('https://', '')
|
||||
|
@ -89,6 +90,7 @@ class HipchatConfig extends PureComponent<Props, State> {
|
|||
id="token"
|
||||
refFunc={this.handleTokenRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ class OpsGenieConfig extends PureComponent<Props, State> {
|
|||
public render() {
|
||||
const {options} = this.props.config
|
||||
const apiKey = options['api-key']
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -64,6 +65,7 @@ class OpsGenieConfig extends PureComponent<Props, State> {
|
|||
id="api-key"
|
||||
refFunc={this.handleApiKeyRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ class PagerDutyConfig extends PureComponent<Props, State> {
|
|||
const {options} = this.props.config
|
||||
const {url} = options
|
||||
const serviceKey = options['service-key']
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<div className="form-group col-xs-12">
|
||||
|
@ -50,6 +52,7 @@ class PagerDutyConfig extends PureComponent<Props, State> {
|
|||
id="service-key"
|
||||
refFunc={this.handleServiceKeyRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ class PushoverConfig extends PureComponent<Props, State> {
|
|||
const {options} = this.props.config
|
||||
const {token, url} = options
|
||||
const userKey = options['user-key']
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -64,6 +65,7 @@ class PushoverConfig extends PureComponent<Props, State> {
|
|||
id="user-key"
|
||||
refFunc={this.handleUserKeyRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -80,6 +82,7 @@ class PushoverConfig extends PureComponent<Props, State> {
|
|||
id="token"
|
||||
refFunc={this.handleTokenRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ interface Props {
|
|||
defaultValue?: boolean
|
||||
refFunc: (r: any) => void
|
||||
disableTest?: () => void
|
||||
isFormEditing: boolean
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -21,6 +22,12 @@ class RedactedInput extends PureComponent<Props, State> {
|
|||
}
|
||||
}
|
||||
|
||||
public componentWillReceiveProps(nextProps) {
|
||||
if (!nextProps.isFormEditing) {
|
||||
this.setState({editing: false})
|
||||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
const {defaultValue, id, refFunc, disableTest} = this.props
|
||||
const {editing} = this.state
|
||||
|
@ -31,9 +38,9 @@ class RedactedInput extends PureComponent<Props, State> {
|
|||
<span className="alert-value-set">
|
||||
<span className="icon checkmark" /> Value set
|
||||
</span>
|
||||
<button className="btn btn-xs btn-link" onClick={this.handleClick}>
|
||||
<div className="btn btn-xs btn-link" onClick={this.handleClick}>
|
||||
Change
|
||||
</button>
|
||||
</div>
|
||||
<input
|
||||
className="form-control"
|
||||
id={id}
|
||||
|
|
|
@ -39,6 +39,7 @@ class SlackConfig extends PureComponent<Props, State> {
|
|||
|
||||
public render() {
|
||||
const {url, channel} = this.props.config.options
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -55,6 +56,7 @@ class SlackConfig extends PureComponent<Props, State> {
|
|||
id="url"
|
||||
refFunc={this.handleUrlRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class TalkConfig extends PureComponent<Props, State> {
|
|||
|
||||
public render() {
|
||||
const {url, author_name: author} = this.props.config.options
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -50,6 +51,7 @@ class TalkConfig extends PureComponent<Props, State> {
|
|||
id="url"
|
||||
refFunc={this.handleUrlRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ class TelegramConfig extends PureComponent<Props, State> {
|
|||
const disableNotification = options['disable-notification']
|
||||
const disableWebPagePreview = options['disable-web-page-preview']
|
||||
const parseMode = options['parse-mode']
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -88,6 +89,7 @@ class TelegramConfig extends PureComponent<Props, State> {
|
|||
id="token"
|
||||
refFunc={this.handleTokenRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class VictorOpsConfig extends PureComponent<Props, State> {
|
|||
const apiKey = options['api-key']
|
||||
const routingKey = options['routing-key']
|
||||
const {url} = options
|
||||
const {testEnabled} = this.state
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
|
@ -56,6 +57,7 @@ class VictorOpsConfig extends PureComponent<Props, State> {
|
|||
id="api-key"
|
||||
refFunc={this.handleApiRef}
|
||||
disableTest={this.disableTest}
|
||||
isFormEditing={!testEnabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue