mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Fix Trained models list crashes on browser refresh if not on page 1 (#164163)
## Summary Fixes https://github.com/elastic/kibana/issues/162618 There was an issue with setting pagination for the EUI table before models are fetched. Providing a page index while the items count is 0 caused pagination to reset with an uninitialized URL state callback. This PR adds a check to verify model list has been retrieved. Also, the Kibana `_stats` endpoint has been updated to provide a `size` parameter.
This commit is contained in:
parent
0a331f1023
commit
24baf38eaa
3 changed files with 15 additions and 7 deletions
|
@ -37,6 +37,7 @@ import {
|
|||
GetAnalyticsModelIdArg,
|
||||
} from './types';
|
||||
import type { MlClient } from '../../lib/ml_client';
|
||||
import { DEFAULT_TRAINED_MODELS_PAGE_SIZE } from '../../routes/trained_models';
|
||||
|
||||
export class AnalyticsManager {
|
||||
private _trainedModels: estypes.MlTrainedModelConfig[] = [];
|
||||
|
@ -47,7 +48,7 @@ export class AnalyticsManager {
|
|||
|
||||
private async initData() {
|
||||
const [models, jobs] = await Promise.all([
|
||||
this._mlClient.getTrainedModels(),
|
||||
this._mlClient.getTrainedModels({ size: DEFAULT_TRAINED_MODELS_PAGE_SIZE }),
|
||||
this._mlClient.getDataFrameAnalytics({ size: 1000 }),
|
||||
]);
|
||||
this._trainedModels = models.trained_model_configs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue