Browse Source

testing -> connecting

master
rozetko 5 years ago
parent
commit
57dc3b4ffe
  1. 6
      src/panel/graph_panel/graph_ctrl.ts
  2. 12
      src/panel/graph_panel/partials/reconnect_to_datasource.html
  3. 18
      src/panel/graph_panel/services/analytic_service.ts

6
src/panel/graph_panel/graph_ctrl.ts

@ -9,7 +9,7 @@ import { MetricExpanded } from './models/metric';
import { DatasourceRequest } from './models/datasource';
import { AnalyticUnitId, AnalyticUnit, LabelingMode } from './models/analytic_units/analytic_unit';
import { BOUND_TYPES } from './models/analytic_units/anomaly_analytic_unit';
import { AnalyticService, HasticDatasourceTestingStatus } from './services/analytic_service';
import { AnalyticService, HasticDatasourceConnectingStatus } from './services/analytic_service';
import { AnalyticController } from './controllers/analytic_controller';
import { HasticPanelInfo } from './models/hastic_panel_info';
import { PanelTemplate, TemplateVariables } from './models/panel';
@ -353,8 +353,8 @@ class GraphCtrl extends MetricsPanelCtrl {
this.refresh();
}
get testingStatus(): HasticDatasourceTestingStatus {
return this.analyticService.testingStatus;
get connectingStatus(): HasticDatasourceConnectingStatus {
return this.analyticService.connectingStatus;
}
issueQueries(datasource) {

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

@ -1,16 +1,16 @@
<div class="gf-form-button-row" ng-if="ctrl.hasticDatasource !== undefined && ctrl.analyticsController.serverStatus === false">
<div class="gf-form-group">
<div class="alert-{{ctrl.testingStatus.status}} alert"">
<div class="alert-{{ctrl.connectingStatus.status}} alert"">
<div class="alert-icon">
<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>
<i class="fa fa-spiner fa-spin" ng-show="ctrl.connectingStatus.status === 'info'"></i>
<i class="fa fa-exclamation-triangle" ng-show="ctrl.connectingStatus.status === 'error'"></i>
<i class="fa fa-check" ng-show="ctrl.connectingStatus.status !== 'error'"></i>
</div>
<div class="alert-body">
<div class="alert-title" ng-bind-html="ctrl.testingStatus.message" />
<div class="alert-title" ng-bind-html="ctrl.connectingStatus.message" />
</div>
</div>
<div ng-hide="ctrl.testingStatus.status === 'info'">
<div ng-hide="ctrl.connectingStatus.status === 'info'">
<button class="btn btn-secondary" ng-click="ctrl.onHasticDatasourceChange()">
<i class="fa fa-plug"></i>
&nbsp; Connect to Hastic Datasource

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

@ -27,18 +27,18 @@ export type TableTimeSeries = {
export enum HasticDatasourceStatus {
AVAILABLE = 'success',
NOT_AVAILABLE = 'error',
TESTING = 'info'
CONNECTING = 'info'
};
export type HasticDatasourceTestingStatus = {
export type HasticDatasourceConnectingStatus = {
status: HasticDatasourceStatus,
message: string
}
export class AnalyticService {
public testingStatus: HasticDatasourceTestingStatus = {
status: HasticDatasourceStatus.TESTING,
message: 'Testing...'
public connectingStatus: HasticDatasourceConnectingStatus = {
status: HasticDatasourceStatus.CONNECTING,
message: 'Connecting...'
};
private _isUp: boolean = false;
@ -273,8 +273,8 @@ export class AnalyticService {
}
async checkDatasourceAvailability(): Promise<boolean> {
this.testingStatus.status = HasticDatasourceStatus.TESTING;
this.testingStatus.message = 'Testing...';
this.connectingStatus.status = HasticDatasourceStatus.CONNECTING;
this.connectingStatus.message = 'Connecting...';
this._isUp = await this._isDatasourceAvailable();
return this._isUp;
@ -398,8 +398,8 @@ export class AnalyticService {
}
private _displayConnectionAlert(status: HasticDatasourceStatus, message: string[]): void {
this.testingStatus.status = status;
this.testingStatus.message = message.join('<br /> ');
this.connectingStatus.status = status;
this.connectingStatus.message = message.join('<br /> ');
const statusChanged = this._updateHasticUrlStatus(status);

Loading…
Cancel
Save