diff --git a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js index cc695f837..bafddddac 100644 --- a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js +++ b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js @@ -148,7 +148,7 @@ export default class AlertsDashboardFlyoutComponent extends Component { this.setState({ tabContent: this.renderAlertsTable() }); } - getBucketLevelGraphConditions = (trigger) => { + getMultipleGraphConditions = (trigger) => { let conditions = _.get(trigger, 'condition.script.source'); if (_.isEmpty(conditions)) { return '-'; @@ -514,11 +514,21 @@ export default class AlertsDashboardFlyoutComponent extends Component { const groupBy = _.get(monitor, MONITOR_GROUP_BY); const condition = - (searchType === SEARCH_TYPE.GRAPH && monitorType === MONITOR_TYPE.BUCKET_LEVEL) || - MONITOR_TYPE.DOC_LEVEL - ? this.getBucketLevelGraphConditions(trigger) + searchType === SEARCH_TYPE.GRAPH && + (monitorType === MONITOR_TYPE.BUCKET_LEVEL || monitorType === MONITOR_TYPE.DOC_LEVEL) + ? this.getMultipleGraphConditions(trigger) : _.get(trigger, 'condition.script.source', '-'); + let displayMultipleConditions; + switch (monitorType) { + case MONITOR_TYPE.BUCKET_LEVEL: + case MONITOR_TYPE.DOC_LEVEL: + displayMultipleConditions = true; + break; + default: + displayMultipleConditions = false; + } + const filters = monitorType === MONITOR_TYPE.BUCKET_LEVEL && searchType === SEARCH_TYPE.GRAPH ? this.getBucketLevelGraphFilter(trigger) @@ -534,7 +544,15 @@ export default class AlertsDashboardFlyoutComponent extends Component { ? `${bucketValue} ${bucketUnitOfTime}` : '-'; - const displayTableTabs = monitorType === MONITOR_TYPE.DOC_LEVEL; + let displayTableTabs; + switch (monitorType) { + case MONITOR_TYPE.DOC_LEVEL: + displayTableTabs = true; + break; + default: + displayTableTabs = false; + break; + } return (
{loadingMonitors || loading ? 'Loading conditions...' : condition}
diff --git a/public/pages/CreateMonitor/components/DocumentLevelMonitorQueries/ConfigureDocumentLevelQueries.js b/public/pages/CreateMonitor/components/DocumentLevelMonitorQueries/ConfigureDocumentLevelQueries.js index 499b42fe5..c4965de37 100644 --- a/public/pages/CreateMonitor/components/DocumentLevelMonitorQueries/ConfigureDocumentLevelQueries.js +++ b/public/pages/CreateMonitor/components/DocumentLevelMonitorQueries/ConfigureDocumentLevelQueries.js @@ -8,7 +8,8 @@ import _ from 'lodash'; import { connect, FieldArray } from 'formik'; import { EuiButton, EuiSpacer } from '@elastic/eui'; import { inputLimitText } from '../../../../utils/helpers'; -import DocumentLevelQuery, { getInitialQueryValues } from './DocumentLevelQuery'; +import DocumentLevelQuery from './DocumentLevelQuery'; +import { FORMIK_INITIAL_DOCUMENT_LEVEL_QUERY_VALUES } from '../../containers/CreateMonitor/utils/constants'; export const MAX_QUERIES = 10; // TODO DRAFT: Placeholder limit @@ -23,7 +24,8 @@ class ConfigureDocumentLevelQueries extends Component { dataTypes, formik: { values }, } = this.props; - if (_.isEmpty(values.queries)) arrayHelpers.push(_.cloneDeep(getInitialQueryValues())); + if (_.isEmpty(values.queries)) + arrayHelpers.push(_.cloneDeep(FORMIK_INITIAL_DOCUMENT_LEVEL_QUERY_VALUES)); const numOfQueries = values.queries.length; return (