Browse Source

Images in webhooks don't have detections #387 (#393)

master
rozetko 5 years ago committed by GitHub
parent
commit
4efc585f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/panel/graph_panel/controllers/analytic_controller.ts
  2. 15
      src/panel/graph_panel/graph_ctrl.ts
  3. 17
      src/panel/graph_panel/services/analytic_service.ts

5
src/panel/graph_panel/controllers/analytic_controller.ts

@ -67,7 +67,10 @@ export class AnalyticController {
this._labelingDataAddedSegments = new SegmentArray<AnalyticSegment>();
this._labelingDataRemovedSegments = new SegmentArray<AnalyticSegment>();
this._analyticUnitsSet = new AnalyticUnitsSet([]);
this.fetchAnalyticUnits();
}
async init() {
await this.fetchAnalyticUnits();
}
get helpSectionText() { return helpSectionText; }

15
src/panel/graph_panel/graph_ctrl.ts

@ -250,8 +250,6 @@ class GraphCtrl extends MetricsPanelCtrl {
this.$graphElem = $(elem[0]).find('#graphPanel');
this.$legendElem = $(elem[0]).find('#graphLegend');
this.onHasticDatasourceChange();
this.events.on('render', this.onRender.bind(this));
this.events.on('data-received', this.onDataReceived.bind(this));
this.events.on('data-error', this.onDataError.bind(this));
@ -285,6 +283,9 @@ class GraphCtrl extends MetricsPanelCtrl {
this.refresh();
}
});
// TODO: maybe it's not the best idea
await this.onHasticDatasourceChange();
}
onInitEditMode() {
@ -330,14 +331,21 @@ class GraphCtrl extends MetricsPanelCtrl {
this._analyticUnitsToShow
);
if(this.analyticService.isUp) {
await this.analyticsController.init();
this._updatePanelInfo();
this.analyticsController.updateServerInfo();
}
this._graphRenderer = new GraphRenderer(
this.$graphElem, this.timeSrv, this.contextSrv, this.$scope, this.analyticsController
);
this._graphLegend = new GraphLegend(this.$legendElem, this.popoverSrv, this.$scope, this.analyticsController);
this.onRender();
if(!this.analyticService.isUp) {
this.refresh();
}
}
issueQueries(datasource) {
@ -429,6 +437,7 @@ class GraphCtrl extends MetricsPanelCtrl {
this._dataTimerange.to
);
}
this.seriesList = seriesList;
this.render();

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

@ -96,11 +96,12 @@ export class AnalyticService {
return this.delete('/analyticUnits', { id });
}
private async _isDatasourceOk(): Promise<boolean> {
private async _checkDatasourceAvailability(): Promise<void> {
if(!this._checkDatasourceConfig()) {
this._isUp = false;
return false;
return;
}
try {
const response = await this.get('/');
if(!isHasticServerResponse(response)) {
this.displayWrongUrlAlert();
@ -109,7 +110,13 @@ export class AnalyticService {
this.displayUnsupportedVersionAlert(response.packageVersion);
this._isUp = false;
}
return this._isUp;
this._isUp = true;
} catch(e) {
console.error(e);
this.displayNoConnectionAlert();
this._isUp = false;
}
}
async updateSegments(
@ -240,8 +247,8 @@ export class AnalyticService {
}
async isDatasourceAvailable(): Promise<boolean> {
const connected = await this._isDatasourceOk();
if(!connected) {
await this._checkDatasourceAvailability();
if(!this._isUp) {
return false;
}
const message = [

Loading…
Cancel
Save