Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[7.9] [ML] Fix annotation detector linking & delayed_data(0) (elastic…
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 authored Jul 21, 2020
1 parent 4b3390f commit 63c704e
Showing 1 changed file with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ 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')) {
mlTimeSeriesExplorer.detector_index = annotation.detector_index;
mlTimeSeriesExplorer.detectorIndex = annotation.detector_index;
}
if (_.has(annotation, 'partition_field_value')) {
entityCondition[annotation.partition_field_name] = annotation.partition_field_value;
Expand Down Expand Up @@ -523,10 +523,26 @@ export class AnnotationsTable extends Component {
const aggregations = this.props.aggregations ?? this.state.aggregations;
if (aggregations) {
const buckets = aggregations.event.buckets;
const foundUser = buckets.findIndex((d) => d.key === ANNOTATION_EVENT_USER) > -1;
filterOptions = foundUser
? buckets
: [{ key: ANNOTATION_EVENT_USER, doc_count: 0 }, ...buckets];
let foundUser = false;
let foundDelayedData = false;

buckets.forEach((bucket) => {
if (bucket.key === ANNOTATION_EVENT_USER) {
foundUser = true;
}
if (bucket.key === ANNOTATION_EVENT_DELAYED_DATA) {
foundDelayedData = true;
}
});
const adjustedBuckets = [];
if (!foundUser) {
adjustedBuckets.push({ key: ANNOTATION_EVENT_USER, doc_count: 0 });
}
if (!foundDelayedData) {
adjustedBuckets.push({ key: ANNOTATION_EVENT_DELAYED_DATA, doc_count: 0 });
}

filterOptions = [...adjustedBuckets, ...buckets];
}
const filters = [
{
Expand Down

0 comments on commit 63c704e

Please sign in to comment.