|
@@ -12,6 +12,8 @@ import * as dateMath from 'app/core/utils/datemath';
|
|
|
import {Subject} from 'vendor/npm/rxjs/Subject';
|
|
import {Subject} from 'vendor/npm/rxjs/Subject';
|
|
|
|
|
|
|
|
class MetricsPanelCtrl extends PanelCtrl {
|
|
class MetricsPanelCtrl extends PanelCtrl {
|
|
|
|
|
+ scope: any;
|
|
|
|
|
+ needsRefresh: boolean;
|
|
|
loading: boolean;
|
|
loading: boolean;
|
|
|
datasource: any;
|
|
datasource: any;
|
|
|
datasourceName: any;
|
|
datasourceName: any;
|
|
@@ -40,6 +42,8 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
this.datasourceSrv = $injector.get('datasourceSrv');
|
|
this.datasourceSrv = $injector.get('datasourceSrv');
|
|
|
this.timeSrv = $injector.get('timeSrv');
|
|
this.timeSrv = $injector.get('timeSrv');
|
|
|
this.templateSrv = $injector.get('templateSrv');
|
|
this.templateSrv = $injector.get('templateSrv');
|
|
|
|
|
+ this.scope = $scope;
|
|
|
|
|
+ this.needsRefresh = false;
|
|
|
|
|
|
|
|
if (!this.panel.targets) {
|
|
if (!this.panel.targets) {
|
|
|
this.panel.targets = [{}];
|
|
this.panel.targets = [{}];
|
|
@@ -50,6 +54,10 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
this.events.on('panel-teardown', this.onPanelTearDown.bind(this));
|
|
this.events.on('panel-teardown', this.onPanelTearDown.bind(this));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private isRenderGraph () {
|
|
|
|
|
+ return window.location.href.indexOf("/dashboard-solo/") === 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private onPanelTearDown() {
|
|
private onPanelTearDown() {
|
|
|
if (this.dataSubscription) {
|
|
if (this.dataSubscription) {
|
|
|
this.dataSubscription.unsubscribe();
|
|
this.dataSubscription.unsubscribe();
|
|
@@ -66,6 +74,13 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
// ignore fetching data if another panel is in fullscreen
|
|
// ignore fetching data if another panel is in fullscreen
|
|
|
if (this.otherPanelInFullscreenMode()) { return; }
|
|
if (this.otherPanelInFullscreenMode()) { return; }
|
|
|
|
|
|
|
|
|
|
+ if (!this.scope.$$childHead || (!this.scope.$$childHead.isVisible() && !this.isRenderGraph())) {
|
|
|
|
|
+ this.scope.$$childHead.needsRefresh = true;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.scope.$$childHead.needsRefresh = false;
|
|
|
|
|
+
|
|
|
// if we have snapshot data use that
|
|
// if we have snapshot data use that
|
|
|
if (this.panel.snapshotData) {
|
|
if (this.panel.snapshotData) {
|
|
|
this.updateTimeRange();
|
|
this.updateTimeRange();
|