Browse Source

fix: Missing No connection error after transfer to app #159

master
Coin de Gamma 6 years ago
parent
commit
6f5bc2bda0
  1. 18
      src/panel/graph_panel/graph_ctrl.ts

18
src/panel/graph_panel/graph_ctrl.ts

@ -199,9 +199,8 @@ class GraphCtrl extends MetricsPanelCtrl {
return _.keys(this._analyticUnitTypes); return _.keys(this._analyticUnitTypes);
} }
async runBackendConnectivityCheck() { private _checkBackendUrlOk(backendURL: string): boolean {
let backendURL = await this.getBackendURL(); if(backendURL === undefined || backendURL === '') {
if(backendURL === '' || backendURL === undefined) {
appEvents.emit( appEvents.emit(
'alert-warning', 'alert-warning',
[ [
@ -209,9 +208,16 @@ class GraphCtrl extends MetricsPanelCtrl {
`Please set it in config` `Please set it in config`
] ]
); );
return; return false;
}
return true;
} }
async runBackendConnectivityCheck() {
let backendURL = await this.getBackendURL();
if(!this._checkBackendUrlOk(backendURL)) {
return;
}
let connected = await this.analyticService.isBackendOk(); let connected = await this.analyticService.isBackendOk();
if(connected) { if(connected) {
this.updateAnalyticUnitTypes(); this.updateAnalyticUnitTypes();
@ -230,6 +236,10 @@ class GraphCtrl extends MetricsPanelCtrl {
this.processor = new DataProcessor(this.panel); this.processor = new DataProcessor(this.panel);
let backendURL = await this.getBackendURL(); let backendURL = await this.getBackendURL();
if(!this._checkBackendUrlOk(backendURL)) {
return;
}
this.analyticService = new AnalyticService(backendURL, this.$http); this.analyticService = new AnalyticService(backendURL, this.$http);
this.runBackendConnectivityCheck(); this.runBackendConnectivityCheck();

Loading…
Cancel
Save