Skip to content

Commit

Permalink
[ML] Swim lane pagination for viewing by job id (#76847)
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov authored Sep 7, 2020
1 parent f89bcfb commit 05ac18a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { ExplorerSwimlane, ExplorerSwimlaneProps } from './explorer_swimlane';

import { MlTooltipComponent } from '../components/chart_tooltip';
import { SwimLanePagination } from './swimlane_pagination';
import { SWIMLANE_TYPE } from './explorer_constants';
import { ViewBySwimLaneData } from './explorer_utils';

/**
Expand Down Expand Up @@ -91,7 +90,6 @@ export const SwimlaneContainer: FC<
(showSwimlane || isLoading) &&
swimlaneLimit !== undefined &&
onPaginationChange &&
props.swimlaneType === SWIMLANE_TYPE.VIEW_BY &&
fromPage &&
perPage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,8 @@ const ExplorerUrlStateManager: FC<ExplorerUrlStateManagerProps> = ({ jobsWithTim
loadExplorerData({
...loadExplorerDataConfig,
swimlaneLimit:
explorerState?.viewBySwimlaneData &&
isViewBySwimLaneData(explorerState?.viewBySwimlaneData)
? explorerState?.viewBySwimlaneData.cardinality
: undefined,
isViewBySwimLaneData(explorerState?.viewBySwimlaneData) &&
explorerState?.viewBySwimlaneData.cardinality,
});
}
}, [JSON.stringify(loadExplorerDataConfig)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ export function resultsServiceProvider(mlApiServices) {
},
},
aggs: {
jobsCardinality: {
cardinality: {
field: 'job_id',
},
},
jobId: {
terms: {
field: 'job_id',
Expand Down Expand Up @@ -148,6 +153,7 @@ export function resultsServiceProvider(mlApiServices) {
});
obj.results[jobId] = resultsForTime;
});
obj.cardinality = resp.aggregations?.jobsCardinality?.value ?? 0;

resolve(obj);
})
Expand Down

0 comments on commit 05ac18a

Please sign in to comment.