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

(cherry picked from commit fd0e1aed0e)

# Conflicts:
#	x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
James Gowdy 2022-02-11 08:30:08 +00:00 committed by GitHub
parent 471788c121
commit 8de9d603a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,6 @@ import {
EuiSpacer,
EuiTitle,
} from '@elastic/eui';
import { debounce } from 'lodash';
import { ml } from '../../../../services/ml_api_service';
import { checkForAutoStartDatafeed, filterJobs, loadFullJob } from '../utils';
@ -44,11 +43,6 @@ import { JobListMlAnomalyAlertFlyout } from '../../../../../alerting/ml_alerting
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) {
@ -282,19 +276,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;
};