Change updateKapacitorConfigSection function so that if a specific config is passed, it updates that specific config and not just the default
parent
21a7c65d05
commit
8cade8458d
|
@ -480,7 +480,8 @@ class AlertTabs extends PureComponent<Props, State> {
|
|||
|
||||
private handleSaveConfig = (section: string) => async (
|
||||
properties,
|
||||
isNewConfigInSection?: boolean
|
||||
isNewConfigInSection?: boolean,
|
||||
specificConfig?: string
|
||||
): Promise<boolean> => {
|
||||
if (section !== '') {
|
||||
const propsToSend = this.sanitizeProperties(section, properties)
|
||||
|
@ -495,7 +496,8 @@ class AlertTabs extends PureComponent<Props, State> {
|
|||
await updateKapacitorConfigSection(
|
||||
this.props.kapacitor,
|
||||
section,
|
||||
propsToSend
|
||||
propsToSend,
|
||||
specificConfig
|
||||
)
|
||||
}
|
||||
this.refreshKapacitorConfig(this.props.kapacitor)
|
||||
|
|
|
@ -21,7 +21,11 @@ interface Config {
|
|||
|
||||
interface Props {
|
||||
config: Config
|
||||
onSave: (properties: Properties, isNewConfigInSection: boolean) => void
|
||||
onSave: (
|
||||
properties: Properties,
|
||||
isNewConfigInSection: boolean,
|
||||
specificConfig: string
|
||||
) => void
|
||||
onTest: (event: React.MouseEvent<HTMLButtonElement>) => void
|
||||
enabled: boolean
|
||||
isNewConfig: boolean
|
||||
|
@ -159,7 +163,11 @@ class SlackConfig extends PureComponent<Props, State> {
|
|||
if (isNewConfig) {
|
||||
properties.workspace = this.workspace.value
|
||||
}
|
||||
const success = await this.props.onSave(properties, isNewConfig)
|
||||
const success = await this.props.onSave(
|
||||
properties,
|
||||
isNewConfig,
|
||||
this.workspace.value
|
||||
)
|
||||
if (success) {
|
||||
this.setState({testEnabled: true})
|
||||
}
|
||||
|
|
|
@ -21,7 +21,11 @@ interface Config {
|
|||
interface Props {
|
||||
slackConfigs: any[]
|
||||
config: Config
|
||||
onSave: (properties: Properties, isNewConfigInSection: boolean) => void
|
||||
onSave: (
|
||||
properties: Properties,
|
||||
isNewConfigInSection: boolean,
|
||||
specificConfig: string
|
||||
) => void
|
||||
onTest: (event: React.MouseEvent<HTMLButtonElement>) => void
|
||||
enabled: boolean
|
||||
}
|
||||
|
|
|
@ -155,12 +155,25 @@ export const getKapacitorConfigSection = (kapacitor, section) => {
|
|||
return kapacitorProxy(kapacitor, 'GET', `/kapacitor/v1/config/${section}`, '')
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
export function updateKapacitorConfigSection(kapacitor, section, properties) {
|
||||
const params = {
|
||||
=======
|
||||
export function updateKapacitorConfigSection(
|
||||
kapacitor,
|
||||
section,
|
||||
properties,
|
||||
specificConfig
|
||||
) {
|
||||
const config = specificConfig || ''
|
||||
const path = `/kapacitor/v1/config/${section}/${config}`
|
||||
|
||||
return AJAX({
|
||||
>>>>>>> Change updateKapacitorConfigSection function so that if a specific config is passed, it updates that specific config and not just the default
|
||||
method: 'POST',
|
||||
url: kapacitor.links.proxy,
|
||||
params: {
|
||||
path: `/kapacitor/v1/config/${section}/`,
|
||||
path,
|
||||
},
|
||||
data: {
|
||||
set: properties,
|
||||
|
|
Loading…
Reference in New Issue