[ML] Anomaly Explorer - ensure viewByFieldName is retained on explorer initialize (#35260)

* Set viewBySwimlane from url on explorer initialize

* remove extra line

* ensure viewByFieldName passed to updateExplorer
This commit is contained in:
Melissa Alvarez 2019-04-22 16:17:20 -07:00 committed by GitHub
parent 23af014b05
commit 45d56248c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -186,6 +186,10 @@ export const Explorer = injectI18n(
let currentSelectedCells = this.state.selectedCells;
let currentSwimlaneViewByFieldName = this.state.swimlaneViewByFieldName;
if (swimlaneViewByFieldName !== undefined) {
currentSwimlaneViewByFieldName = swimlaneViewByFieldName;
}
if (selectedCells !== undefined && currentSelectedCells === null) {
currentSelectedCells = selectedCells;
currentSwimlaneViewByFieldName = swimlaneViewByFieldName;
@ -625,6 +629,7 @@ export const Explorer = injectI18n(
noJobsFound,
selectedCells,
selectedJobs,
swimlaneViewByFieldName
} = {
...this.state,
...stateUpdate
@ -693,7 +698,7 @@ export const Explorer = injectI18n(
);
}
const viewBySwimlaneOptions = getViewBySwimlaneOptions(selectedJobs, this.state.swimlaneViewByFieldName);
const viewBySwimlaneOptions = getViewBySwimlaneOptions(selectedJobs, swimlaneViewByFieldName);
Object.assign(stateUpdate, viewBySwimlaneOptions);
if (selectedCells !== null && selectedCells.showTopFieldValues === true) {
// this.setState({ viewBySwimlaneData: getDefaultViewBySwimlaneData(), viewBySwimlaneDataLoading: true });

View file

@ -88,7 +88,7 @@ module.controller('MlExplorerController', function (
mlExplorerDashboardService.init();
function jobSelectionUpdate(action, { fullJobs, selectedCells, selectedJobIds }) {
function jobSelectionUpdate(action, { fullJobs, selectedCells, selectedJobIds, swimlaneViewByFieldName }) {
const jobs = createJobs(fullJobs).map((job) => {
job.selected = selectedJobIds.some((id) => job.id === id);
return job;
@ -107,6 +107,7 @@ module.controller('MlExplorerController', function (
noJobsFound,
selectedCells,
selectedJobs,
swimlaneViewByFieldName
});
}