diff --git a/ui/src/kapacitor/components/config/SlackConfig.tsx b/ui/src/kapacitor/components/config/SlackConfig.tsx index 89694ff84d..c9782c826d 100644 --- a/ui/src/kapacitor/components/config/SlackConfig.tsx +++ b/ui/src/kapacitor/components/config/SlackConfig.tsx @@ -47,7 +47,12 @@ class SlackConfig extends PureComponent { } public render() { - const {url, channel, workspace} = this.props.config.options + const { + config: { + options: {url, channel, workspace}, + }, + isNewConfig, + } = this.props const {testEnabled, enabled} = this.state const workspaceID = workspace || 'default' @@ -65,6 +70,7 @@ class SlackConfig extends PureComponent { ref={r => (this.workspace = r)} defaultValue={workspace || ''} onChange={this.disableTest} + disabled={!isNewConfig} />
diff --git a/ui/src/kapacitor/components/config/SlackConfigs.tsx b/ui/src/kapacitor/components/config/SlackConfigs.tsx index d82a30e38a..717de02089 100644 --- a/ui/src/kapacitor/components/config/SlackConfigs.tsx +++ b/ui/src/kapacitor/components/config/SlackConfigs.tsx @@ -7,12 +7,14 @@ import SlackConfig from 'src/kapacitor/components/config/SlackConfig' interface Properties { channel: string url: string + workspace?: string } interface Config { options: { url: boolean channel: string + workspace: string } } @@ -40,19 +42,28 @@ class SlackConfigs extends PureComponent { public render() { const {slackConfigs} = this.state const {onSave, onTest, enabled} = this.props + const configNums = slackConfigs.length return (
- {slackConfigs.map(config => ( - - ))} + {slackConfigs.map(config => { + const key = _.get(config, ['options', 'workspace'], 'default') + const configEnabled = _.get(config, ['options', 'enabled'], false) + const isFirstConfigNew = configNums === 1 && !configEnabled + const isNewConfig = + isFirstConfigNew || _.get(config, 'isNewConfig', false) + + return ( + + ) + })}