Browse Source

"No connection" message on timeout #370 (#381)

* check status

* move check

* rename
master
Alexandr Velikiy 5 years ago committed by Alexey Velikiy
parent
commit
2db67f0dd1
  1. 16
      src/panel/graph_panel/services/analytic_service.ts

16
src/panel/graph_panel/services/analytic_service.ts

@ -280,7 +280,11 @@ export class AnalyticService {
// xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort') // xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort')
// See: https://github.com/angular/angular.js/blob/55075b840c9194b8524627a293d6166528b9a1c2/src/ng/http.js#L919-L920 // See: https://github.com/angular/angular.js/blob/55075b840c9194b8524627a293d6166528b9a1c2/src/ng/http.js#L919-L920
if(error.xhrStatus !== 'complete' || error.status > 500) { if(error.xhrStatus !== 'complete' || error.status > 500) {
this.displayConnectionErrorAlert(); if(error.status === 504) {
this.displayConnectionTimeoutAlert();
} else {
this.displayNoConnectionAlert();
}
this._isUp = false; this._isUp = false;
throw new Error(`Fetching error: ${error.status}: ${error.statusText}`); throw new Error(`Fetching error: ${error.status}: ${error.statusText}`);
} else { } else {
@ -323,7 +327,15 @@ export class AnalyticService {
return this._analyticRequest('DELETE', url, data); return this._analyticRequest('DELETE', url, data);
} }
private displayConnectionErrorAlert() { private displayNoConnectionAlert() {
const message = [
'No connection to Hastic Server',
`Hastic Datasource URL: "${this._hasticDatasourceURL}"`,
]
this._displayConnectionAlert(HasticDatasourceStatus.NOT_AVAILABLE, message);
}
private displayConnectionTimeoutAlert() {
const message = [ const message = [
'Timeout when connecting to Hastic Server', 'Timeout when connecting to Hastic Server',
`Hastic Datasource URL: "${this._hasticDatasourceURL}"`, `Hastic Datasource URL: "${this._hasticDatasourceURL}"`,

Loading…
Cancel
Save