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