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

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

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

Loading…
Cancel
Save