From 0e5b790b54bab1e5832ade3f4d455b291d9e3d12 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 16 Mar 2018 21:03:49 +0300 Subject: [PATCH 1/3] dashboard: fix rendering link to panel in collapsed row --- .../app/features/dashboard/view_state_srv.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/view_state_srv.ts b/public/app/features/dashboard/view_state_srv.ts index 148f64beab0..8cb35a8ca99 100644 --- a/public/app/features/dashboard/view_state_srv.ts +++ b/public/app/features/dashboard/view_state_srv.ts @@ -1,6 +1,7 @@ import angular from 'angular'; import _ from 'lodash'; import config from 'app/core/config'; +import { DashboardModel } from './dashboard_model'; // represents the transient view state // like fullscreen panel & edit @@ -8,7 +9,7 @@ export class DashboardViewState { state: any; panelScopes: any; $scope: any; - dashboard: any; + dashboard: DashboardModel; editStateChanged: any; fullscreenPanel: any; oldTimeRange: any; @@ -89,6 +90,12 @@ export class DashboardViewState { } } + if (this.state.fullscreen && this.state.panelId) { + // Trying to render panel in fullscreen when it's in the collapsed row causes an issue. + // So in this case expand collapsed row first. + this.toggleCollapsedPanelRow(this.state.panelId); + } + // if no edit state cleanup tab parm if (!this.state.edit) { delete this.state.tab; @@ -103,6 +110,19 @@ export class DashboardViewState { this.syncState(); } + toggleCollapsedPanelRow(panelId) { + for (let panel of this.dashboard.panels) { + if (panel.collapsed) { + for (let rowPanel of panel.panels) { + if (rowPanel.id === panelId) { + this.dashboard.toggleRow(panel); + return; + } + } + } + } + } + syncState() { if (this.panelScopes.length === 0) { return; From 205714759e6368dadf1bc91ea36e108638c53523 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 16 Mar 2018 21:45:31 +0300 Subject: [PATCH 2/3] fix failed tests for dashboard view state --- public/app/features/dashboard/specs/viewstate_srv_specs.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/specs/viewstate_srv_specs.ts b/public/app/features/dashboard/specs/viewstate_srv_specs.ts index 928037adc88..d34b15b9113 100644 --- a/public/app/features/dashboard/specs/viewstate_srv_specs.ts +++ b/public/app/features/dashboard/specs/viewstate_srv_specs.ts @@ -30,7 +30,10 @@ describe('when updating view state', function() { beforeEach( angularMocks.inject(function(dashboardViewStateSrv, $location, $rootScope) { $rootScope.onAppEvent = function() {}; - $rootScope.dashboard = { meta: {} }; + $rootScope.dashboard = { + meta: {}, + panels: [], + }; viewState = dashboardViewStateSrv.create($rootScope); location = $location; }) From 05ac7d8fca8af0556695517abeb3d72ea1e081ee Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 20 Mar 2018 14:13:31 +0300 Subject: [PATCH 3/3] dashboard: fix phantomjs panel rendering in collapsed row --- public/app/features/dashboard/view_state_srv.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/dashboard/view_state_srv.ts b/public/app/features/dashboard/view_state_srv.ts index 8cb35a8ca99..576b8b6fce8 100644 --- a/public/app/features/dashboard/view_state_srv.ts +++ b/public/app/features/dashboard/view_state_srv.ts @@ -90,7 +90,7 @@ export class DashboardViewState { } } - if (this.state.fullscreen && this.state.panelId) { + if ((this.state.fullscreen || this.dashboard.meta.soloMode) && this.state.panelId) { // Trying to render panel in fullscreen when it's in the collapsed row causes an issue. // So in this case expand collapsed row first. this.toggleCollapsedPanelRow(this.state.panelId);