[ML] Fix anomaly detector jobs list search delay (#124328)

This commit is contained in:
James Gowdy 2022-02-02 11:35:23 +00:00 committed by GitHub
parent 28ba010233
commit fd0e1aed0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,6 @@
import React, { Component } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { debounce } from 'lodash';
import { ml } from '../../../../services/ml_api_service';
import { checkForAutoStartDatafeed, filterJobs, loadFullJob } from '../utils';
@ -35,11 +34,6 @@ import { AnomalyDetectionEmptyState } from '../anomaly_detection_empty_state';
let blockingJobsRefreshTimeout = null;
const filterJobsDebounce = debounce((jobsSummaryList, filterClauses, callback) => {
const ss = filterJobs(jobsSummaryList, filterClauses);
callback(ss);
}, 500);
// 'isManagementTable' bool prop to determine when to configure table for use in Kibana management page
export class JobsListView extends Component {
constructor(props) {
@ -291,19 +285,10 @@ export class JobsListView extends Component {
return;
}
if (this._isFiltersSet === true) {
filterJobsDebounce(this.state.jobsSummaryList, filterClauses, (jobsSummaryList) => {
this.setState({ filteredJobsSummaryList: jobsSummaryList, filterClauses }, () => {
this.refreshSelectedJobs();
});
});
} else {
// first use after page load, do not debounce.
const filteredJobsSummaryList = filterJobs(this.state.jobsSummaryList, filterClauses);
this.setState({ filteredJobsSummaryList, filterClauses }, () => {
this.refreshSelectedJobs();
});
}
const filteredJobsSummaryList = filterJobs(this.state.jobsSummaryList, filterClauses);
this.setState({ filteredJobsSummaryList, filterClauses }, () => {
this.refreshSelectedJobs();
});
this._isFiltersSet = true;
};