Update getConfigEnabled to check if any configs are enabled if multilpe configs exist for a section

pull/10616/head
Iris Scholten 2018-05-15 14:12:15 -07:00
parent 429254c526
commit 1eb88e7192
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import React, {PureComponent, MouseEvent} from 'react'
import _ from 'lodash'
import {get} from 'src/utils/wrappers'
import {
Tab,
@ -434,6 +435,14 @@ class AlertTabs extends PureComponent<Props, State> {
}
private getConfigEnabled = (sections: Sections, section: string): boolean => {
if (section === AlertTypes.slack) {
const configElements: Section[] = get(sections, `${section}.elements`, [])
const enabledConfigElements = configElements.filter(e => {
const enabled: boolean = get(e, 'options.enabled', false)
return enabled
})
return enabledConfigElements.length > 0
}
return _.get(
sections,
[section, 'elements', '0', 'options', 'enabled'],