Expand rows for panels in collapsed rows

This commit is contained in:
Torkel Ödegaard 2019-02-05 14:12:32 +01:00
parent 08925ffad8
commit aa2bf07c71
3 changed files with 27 additions and 2 deletions

View File

@ -120,7 +120,12 @@ export class DashboardPage extends PureComponent<Props, State> {
onEnterFullscreen() {
const { dashboard, urlEdit, urlFullscreen, urlPanelId } = this.props;
const panel = dashboard.getPanelById(parseInt(urlPanelId, 10));
const panelId = parseInt(urlPanelId, 10);
// need to expand parent row if this panel is inside a row
dashboard.expandParentRowFor(panelId);
const panel = dashboard.getPanelById(panelId);
if (panel) {
dashboard.setViewMode(panel, urlFullscreen, urlEdit);

View File

@ -59,7 +59,13 @@ export class SoloPanelPage extends Component<Props, State> {
// we just got the dashboard!
if (!prevProps.dashboard) {
const panel = dashboard.getPanelById(parseInt(urlPanelId, 10));
const panelId = parseInt(urlPanelId, 10);
// need to expand parent row if this panel is inside a row
dashboard.expandParentRowFor(panelId);
const panel = dashboard.getPanelById(panelId);
if (!panel) {
this.setState({ notFound: true });
return;

View File

@ -904,4 +904,18 @@ export class DashboardModel {
this.processRepeats();
this.events.emit('template-variable-value-updated');
}
expandParentRowFor(panelId: number) {
for (const panel of this.panels) {
if (panel.collapsed) {
for (const rowPanel of panel.panels) {
if (rowPanel.id === panelId) {
this.toggleRow(panel);
return;
}
}
}
}
}
}