Skip to content

Commit 9d89bfa

Browse files
committed
more has
1 parent 11a6516 commit 9d89bfa

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* This version supports both fetching the annotations by itself (used in the jobs list) and
1010
* getting the annotations via props (used in Anomaly Explorer and Single Series Viewer).
1111
*/
12-
import has from 'lodash/has';
12+
1313
import uniq from 'lodash/uniq';
1414

1515
import PropTypes from 'prop-types';
@@ -257,18 +257,18 @@ export class AnnotationsTable extends Component {
257257

258258
// if the annotation is at the series level
259259
// then pass the partitioning field(s) and detector index to the Single Metric Viewer
260-
if (has(annotation, 'detector_index')) {
260+
if (annotation.detector_index !== undefined) {
261261
mlTimeSeriesExplorer.detectorIndex = annotation.detector_index;
262262
}
263-
if (has(annotation, 'partition_field_value')) {
263+
if (annotation.partition_field_value !== undefined) {
264264
entityCondition[annotation.partition_field_name] = annotation.partition_field_value;
265265
}
266266

267-
if (has(annotation, 'over_field_value')) {
267+
if (annotation.over_field_value !== undefined) {
268268
entityCondition[annotation.over_field_name] = annotation.over_field_value;
269269
}
270270

271-
if (has(annotation, 'by_field_value')) {
271+
if (annotation.by_field_value !== undefined) {
272272
// Note that analyses with by and over fields, will have a top-level by_field_name,
273273
// but the by_field_value(s) will be in the nested causes array.
274274
entityCondition[annotation.by_field_name] = annotation.by_field_value;

x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
* the raw data in the Explorer dashboard.
1010
*/
1111

12-
import has from 'lodash/has';
13-
1412
import { parseInterval } from '../../../../common/util/parse_interval';
1513
import { getEntityFieldList } from '../../../../common/util/anomaly_utils';
1614
import { buildConfigFromDetector } from '../../util/chart_config_builder';
@@ -30,7 +28,7 @@ export function buildConfig(record) {
3028

3129
config.detectorLabel = record.function;
3230
if (
33-
has(mlJobService.detectorsByJob, record.job_id) &&
31+
mlJobService.detectorsByJob[record.job_id] !== undefined &&
3432
detectorIndex < mlJobService.detectorsByJob[record.job_id].length
3533
) {
3634
config.detectorLabel =

0 commit comments

Comments
 (0)