diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js index b752b8d9238418..c6ca4fb821984f 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js +++ b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js @@ -9,7 +9,7 @@ * This version supports both fetching the annotations by itself (used in the jobs list) and * getting the annotations via props (used in Anomaly Explorer and Single Series Viewer). */ -import has from 'lodash/has'; + import uniq from 'lodash/uniq'; import PropTypes from 'prop-types'; @@ -257,18 +257,18 @@ export class AnnotationsTable extends Component { // if the annotation is at the series level // then pass the partitioning field(s) and detector index to the Single Metric Viewer - if (has(annotation, 'detector_index')) { + if (annotation.detector_index !== undefined) { mlTimeSeriesExplorer.detectorIndex = annotation.detector_index; } - if (has(annotation, 'partition_field_value')) { + if (annotation.partition_field_value !== undefined) { entityCondition[annotation.partition_field_name] = annotation.partition_field_value; } - if (has(annotation, 'over_field_value')) { + if (annotation.over_field_value !== undefined) { entityCondition[annotation.over_field_name] = annotation.over_field_value; } - if (has(annotation, 'by_field_value')) { + if (annotation.by_field_value !== undefined) { // Note that analyses with by and over fields, will have a top-level by_field_name, // but the by_field_value(s) will be in the nested causes array. entityCondition[annotation.by_field_name] = annotation.by_field_value; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js index 96969f94891136..b75784c95c5209 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js @@ -9,8 +9,6 @@ * the raw data in the Explorer dashboard. */ -import has from 'lodash/has'; - import { parseInterval } from '../../../../common/util/parse_interval'; import { getEntityFieldList } from '../../../../common/util/anomaly_utils'; import { buildConfigFromDetector } from '../../util/chart_config_builder'; @@ -30,7 +28,7 @@ export function buildConfig(record) { config.detectorLabel = record.function; if ( - has(mlJobService.detectorsByJob, record.job_id) && + mlJobService.detectorsByJob[record.job_id] !== undefined && detectorIndex < mlJobService.detectorsByJob[record.job_id].length ) { config.detectorLabel =