Skip to content

Commit

Permalink
Added expandedPanelId to dashboard app state
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomThomson committed Sep 28, 2020
1 parent ca48c80 commit 6e26252
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ export class DashboardAppController {
incomingEmbeddable = undefined;
}

let expandedPanelId;
if (dashboardContainer && !isErrorEmbeddable(dashboardContainer)) {
expandedPanelId = dashboardContainer.getInput().expandedPanelId;
}
const shouldShowEditHelp = getShouldShowEditHelp();
const shouldShowViewHelp = getShouldShowViewHelp();
const isEmptyInReadonlyMode = shouldShowUnauthorizedEmptyState();
Expand All @@ -384,7 +380,7 @@ export class DashboardAppController {
lastReloadRequestTime,
title: dashboardStateManager.getTitle(),
description: dashboardStateManager.getDescription(),
expandedPanelId,
expandedPanelId: dashboardStateManager.getExpandedPanelId(),
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ export class DashboardStateManager {
this.setFullScreenMode(input.isFullScreenMode);
}

if (input.expandedPanelId !== this.getExpandedPanelId()) {
this.setExpandedPanelId(input.expandedPanelId);
}

if (!_.isEqual(input.query, this.getQuery())) {
this.setQuery(input.query);
}
Expand All @@ -282,6 +286,14 @@ export class DashboardStateManager {
this.stateContainer.transitions.set('fullScreenMode', fullScreenMode);
}

public getExpandedPanelId() {
return this.appState.expandedPanelId;
}

public setExpandedPanelId(expandedPanelId?: string) {
this.stateContainer.transitions.set('expandedPanelId', expandedPanelId);
}

public setFilters(filters: Filter[]) {
this.stateContainer.transitions.set('filters', filters);
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface DashboardAppState {
query: Query | string;
filters: Filter[];
viewMode: ViewMode;
expandedPanelId?: string;
savedQuery?: string;
}

Expand Down

0 comments on commit 6e26252

Please sign in to comment.