Skip to content

Commit

Permalink
more has
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Aug 11, 2020
1 parent 11a6516 commit 9d89bfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 =
Expand Down

0 comments on commit 9d89bfa

Please sign in to comment.