rozetko 5 years ago
parent
commit
c534e705aa
  1. 4
      src/panel/graph_panel/partials/reconnect_to_datasource.html
  2. 13
      src/panel/graph_panel/services/analytic_service.ts

4
src/panel/graph_panel/partials/reconnect_to_datasource.html

@ -2,7 +2,7 @@
<div class="gf-form-group">
<div class="alert-{{ctrl.testingStatus.status}} alert"">
<div class="alert-icon">
<i class="fa fa-spiner fa-spin" ng-show="ctrl.testingStatus.testing"></i>
<i class="fa fa-spiner fa-spin" ng-show="ctrl.testingStatus.status === 'info'"></i>
<i class="fa fa-exclamation-triangle" ng-show="ctrl.testingStatus.status === 'error'"></i>
<i class="fa fa-check" ng-show="ctrl.testingStatus.status !== 'error'"></i>
</div>
@ -10,7 +10,7 @@
<div class="alert-title" ng-bind-html="ctrl.testingStatus.message" />
</div>
</div>
<div ng-hide="ctrl.testingStatus.testing">
<div ng-hide="ctrl.testingStatus.status === 'info'">
<button class="btn btn-secondary" ng-click="ctrl.onHasticDatasourceChange()">
<i class="fa fa-plug"></i>
&nbsp; Connect to Hastic Datasource

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

@ -26,20 +26,19 @@ export type TableTimeSeries = {
export enum HasticDatasourceStatus {
AVAILABLE = 'success',
NOT_AVAILABLE = 'error'
NOT_AVAILABLE = 'error',
TESTING = 'info'
};
export type HasticDatasourceTestingStatus = {
testing: boolean,
status: HasticDatasourceStatus,
message: string
}
export class AnalyticService {
public testingStatus: HasticDatasourceTestingStatus = {
testing: false,
status: HasticDatasourceStatus.NOT_AVAILABLE,
message: ''
status: HasticDatasourceStatus.TESTING,
message: 'Testing...'
};
private _isUp: boolean = false;
@ -274,11 +273,11 @@ export class AnalyticService {
}
async checkDatasourceAvailability(): Promise<boolean> {
this.testingStatus.testing = true;
this.testingStatus.status = HasticDatasourceStatus.TESTING;
this.testingStatus.message = 'Testing...';
this._isUp = await this._isDatasourceAvailable();
this.testingStatus.testing = false;
return this._isUp;
}

Loading…
Cancel
Save