* [ML] update on Refresh button click * [ML] reset cache on Refresh
This commit is contained in:
parent
a6a8911e0b
commit
495dacadc8
|
@ -13,7 +13,7 @@ import PropTypes from 'prop-types';
|
|||
import React, { Fragment } from 'react';
|
||||
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
|
||||
import DragSelect from 'dragselect/dist/ds.min.js';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import {
|
||||
|
@ -99,6 +99,9 @@ import { AnomaliesTable } from '../components/anomalies_table/anomalies_table';
|
|||
import { timefilter } from 'ui/timefilter';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
|
||||
import { mlTimefilterRefresh$ } from '../services/timefilter_refresh_service';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
function getExplorerDefaultState() {
|
||||
return {
|
||||
annotationsData: [],
|
||||
|
@ -163,6 +166,8 @@ export const Explorer = injectI18n(injectObservablesAsProps(
|
|||
TimeBuckets: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
_unsubscribeAll = new Subject();
|
||||
|
||||
state = getExplorerDefaultState();
|
||||
|
||||
// make sure dragSelect is only available if the mouse pointer is actually over a swimlane
|
||||
|
@ -224,6 +229,24 @@ export const Explorer = injectI18n(injectObservablesAsProps(
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
mlTimefilterRefresh$.pipe(takeUntil(this._unsubscribeAll)).subscribe(() => {
|
||||
this.resetCache();
|
||||
this.updateExplorer();
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._unsubscribeAll.next();
|
||||
this._unsubscribeAll.complete();
|
||||
}
|
||||
|
||||
resetCache() {
|
||||
this.loadOverallDataPreviousArgs = null;
|
||||
this.loadViewBySwimlanePreviousArgs = null;
|
||||
this.topFieldsPreviousArgs = null;
|
||||
this.annotationsTablePreviousArgs = null;
|
||||
this.anomaliesTablePreviousArgs = null;
|
||||
}
|
||||
|
||||
// based on the pattern described here:
|
||||
|
|
|
@ -835,7 +835,9 @@ export class TimeSeriesExplorer extends React.Component {
|
|||
this.subscriptions.add(annotationsRefresh$.subscribe(this.refresh));
|
||||
this.subscriptions.add(interval$.subscribe(tableControlsListener));
|
||||
this.subscriptions.add(severity$.subscribe(tableControlsListener));
|
||||
this.subscriptions.add(mlTimefilterRefresh$.subscribe(() => this.refresh(false)));
|
||||
this.subscriptions.add(mlTimefilterRefresh$.subscribe(() => {
|
||||
this.refresh(true);
|
||||
}));
|
||||
|
||||
// Listen for changes to job selection.
|
||||
this.subscriptions.add(this.jobSelectService.subscribe(({ selection: selectedJobIds }) => {
|
||||
|
|
Loading…
Reference in a new issue