diff --git a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js index 66d570d59..730e2b535 100644 --- a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js +++ b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js @@ -524,7 +524,7 @@ export default class AlertsDashboardFlyoutComponent extends Component { ? `${bucketValue} ${bucketUnitOfTime}` : '-'; - const displayTableTabs = monitor.monitor_type === MONITOR_TYPE.DOC_LEVEL; + const displayTableTabs = monitorType === MONITOR_TYPE.DOC_LEVEL; return (
diff --git a/public/pages/CreateMonitor/containers/CreateMonitor/utils/monitorToFormik.test.js b/public/pages/CreateMonitor/containers/CreateMonitor/utils/monitorToFormik.test.js index d26f84283..8ddf26954 100644 --- a/public/pages/CreateMonitor/containers/CreateMonitor/utils/monitorToFormik.test.js +++ b/public/pages/CreateMonitor/containers/CreateMonitor/utils/monitorToFormik.test.js @@ -7,6 +7,7 @@ import _ from 'lodash'; import monitorToFormik from './monitorToFormik'; import { FORMIK_INITIAL_VALUES, MATCH_ALL_QUERY } from './constants'; +import { MONITOR_TYPE, SEARCH_TYPE } from '../../../../../utils/constants'; const exampleMonitor = { name: 'Example Monitor', @@ -156,7 +157,8 @@ describe('monitorToFormik', () => { describe('can build ClusterMetricsMonitor', () => { test('with path params', () => { const clusterMetricsMonitor = _.cloneDeep(exampleMonitor); - clusterMetricsMonitor.ui_metadata.search.searchType = 'clusterMetrics'; + clusterMetricsMonitor.monitor_type = MONITOR_TYPE.CLUSTER_METRICS; + clusterMetricsMonitor.ui_metadata.search.searchType = SEARCH_TYPE.CLUSTER_METRICS; clusterMetricsMonitor.inputs = [ { uri: { @@ -171,7 +173,8 @@ describe('monitorToFormik', () => { }); test('without path params', () => { const clusterMetricsMonitor = _.cloneDeep(exampleMonitor); - clusterMetricsMonitor.ui_metadata.search.searchType = 'clusterMetrics'; + clusterMetricsMonitor.monitor_type = MONITOR_TYPE.CLUSTER_METRICS; + clusterMetricsMonitor.ui_metadata.search.searchType = SEARCH_TYPE.CLUSTER_METRICS; clusterMetricsMonitor.inputs = [ { uri: { diff --git a/public/pages/CreateTrigger/components/TriggerQuery/TriggerQuery.js b/public/pages/CreateTrigger/components/TriggerQuery/TriggerQuery.js index 8a8d128db..0733eb1f0 100644 --- a/public/pages/CreateTrigger/components/TriggerQuery/TriggerQuery.js +++ b/public/pages/CreateTrigger/components/TriggerQuery/TriggerQuery.js @@ -28,12 +28,12 @@ export const getExecuteMessage = (response) => { if (!triggerResults) return 'No trigger results'; const triggerId = Object.keys(triggerResults)[0]; if (!triggerId) return 'No trigger results'; - const executeResults = _.get(triggerResults, `${triggerId}`); + const executeResults = _.get(triggerResults, triggerId); if (!executeResults) return 'No execute results'; const { error, triggered, triggeredDocs } = executeResults; - if (!_.isNull(error) && !_.isEmpty(error)) return error; - if (!_.isNull(triggered) && !_.isEmpty(triggered)) return `${triggered}`; - if (!_.isNull(triggeredDocs) && !_.isEmpty(triggeredDocs)) + if (!_.isNull(error) && !_.isUndefined(error)) return error; + if (!_.isNull(triggered) && !_.isUndefined(triggered)) return `${triggered}`; + if (!_.isNull(triggeredDocs) && !_.isUndefined(triggeredDocs)) return JSON.stringify(triggeredDocs, null, 4); }; diff --git a/public/pages/CreateTrigger/containers/CreateTrigger/utils/triggerToFormik.js b/public/pages/CreateTrigger/containers/CreateTrigger/utils/triggerToFormik.js index 726d60f20..efc9877ce 100644 --- a/public/pages/CreateTrigger/containers/CreateTrigger/utils/triggerToFormik.js +++ b/public/pages/CreateTrigger/containers/CreateTrigger/utils/triggerToFormik.js @@ -36,7 +36,7 @@ export function triggerDefinitionToFormik(trigger, monitor) { case MONITOR_TYPE.DOC_LEVEL: return documentLevelTriggerToFormik(trigger, monitor); default: - queryLevelTriggerToFormik(trigger, monitor); + return queryLevelTriggerToFormik(trigger, monitor); } } diff --git a/public/pages/Dashboard/utils/helpers.test.js b/public/pages/Dashboard/utils/helpers.test.js index 57c906561..08bdc2d7b 100644 --- a/public/pages/Dashboard/utils/helpers.test.js +++ b/public/pages/Dashboard/utils/helpers.test.js @@ -695,7 +695,8 @@ describe('Dashboard/utils/helpers', () => { }); }); describe('when perAlertView is true', () => { - const perAlertView = test('when defaultSize is undefined', () => { + const perAlertView = true; + test('when defaultSize is undefined', () => { const defaultSize = undefined; expect(getInitialSize(perAlertView, defaultSize)).toEqual( DEFAULT_GET_ALERTS_QUERY_PARAMS.size