|
|
@ -145,8 +145,7 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
private keybindingSrv, |
|
|
|
private keybindingSrv, |
|
|
|
private backendSrv: BackendSrv, |
|
|
|
private backendSrv: BackendSrv, |
|
|
|
private popoverSrv, |
|
|
|
private popoverSrv, |
|
|
|
private contextSrv, |
|
|
|
private contextSrv |
|
|
|
private alertSrv: AlertSrv |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
super($scope, $injector); |
|
|
|
super($scope, $injector); |
|
|
|
|
|
|
|
|
|
|
@ -157,7 +156,7 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
|
|
|
|
|
|
|
|
this.processor = new DataProcessor(this.panel); |
|
|
|
this.processor = new DataProcessor(this.panel); |
|
|
|
|
|
|
|
|
|
|
|
this.analyticService = new AnalyticService(this.backendURL, $http, this.backendSrv, this.alertSrv); |
|
|
|
this.analyticService = new AnalyticService(this.backendURL, $http); |
|
|
|
|
|
|
|
|
|
|
|
this.runBackendConnectivityCheck(); |
|
|
|
this.runBackendConnectivityCheck(); |
|
|
|
|
|
|
|
|
|
|
@ -227,10 +226,12 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
|
|
|
|
|
|
|
|
async runBackendConnectivityCheck() { |
|
|
|
async runBackendConnectivityCheck() { |
|
|
|
if(this.backendURL === '' || this.backendURL === undefined) { |
|
|
|
if(this.backendURL === '' || this.backendURL === undefined) { |
|
|
|
this.alertSrv.set( |
|
|
|
appEvents.emit( |
|
|
|
`Dashboard variable $${BACKEND_VARIABLE_NAME} is missing`, |
|
|
|
'alert-warning', |
|
|
|
`Please set $${BACKEND_VARIABLE_NAME}`, |
|
|
|
[ |
|
|
|
'warning', 4000 |
|
|
|
`Dashboard variable $${BACKEND_VARIABLE_NAME} is missing`, |
|
|
|
|
|
|
|
`Please set $${BACKEND_VARIABLE_NAME}` |
|
|
|
|
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -238,10 +239,12 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
let connected = await this.analyticService.isBackendOk(); |
|
|
|
let connected = await this.analyticService.isBackendOk(); |
|
|
|
if(connected) { |
|
|
|
if(connected) { |
|
|
|
this.updateAnalyticUnitTypes(); |
|
|
|
this.updateAnalyticUnitTypes(); |
|
|
|
this.alertSrv.set( |
|
|
|
appEvents.emit( |
|
|
|
'Connected to Hastic server', |
|
|
|
'alert-success', |
|
|
|
`Hastic server: "${this.backendURL}"`, |
|
|
|
[ |
|
|
|
'success', 4000 |
|
|
|
'Connected to Hastic server', |
|
|
|
|
|
|
|
`Hastic server: "${this.backendURL}"` |
|
|
|
|
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -516,10 +519,12 @@ class GraphCtrl extends MetricsPanelCtrl { |
|
|
|
panelUrl |
|
|
|
panelUrl |
|
|
|
); |
|
|
|
); |
|
|
|
} catch(e) { |
|
|
|
} catch(e) { |
|
|
|
this.alertSrv.set( |
|
|
|
appEvents.emit( |
|
|
|
'Error while saving analytic unit', |
|
|
|
'alert-error', |
|
|
|
e.message, |
|
|
|
[ |
|
|
|
'error', 7000 |
|
|
|
'Error while saving analytic unit', |
|
|
|
|
|
|
|
e.message |
|
|
|
|
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
this.$scope.$digest(); |
|
|
|
this.$scope.$digest(); |
|
|
|