Browse Source

Show error on 'failed' status (#8)

master
rozetko 7 years ago committed by GitHub
parent
commit
b07662a07d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/controllers/anomaly_controller.ts
  2. 4
      src/model/anomaly.ts
  3. 2
      src/partials/tab_analytics.html
  4. 2
      src/services/anomaly_service.ts

7
src/controllers/anomaly_controller.ts

@ -294,9 +294,14 @@ export class AnomalyController {
anomalyType.key, 1000
);
for await (const status of statusGenerator) {
for await (const data of statusGenerator) {
let status = data.status;
let error = data.errorMessage;
if(anomalyType.status !== status) {
anomalyType.status = status;
if(error !== undefined) {
anomalyType.error = error;
}
this._emitter.emit('anomaly-type-status-change', anomalyType);
}
if(!anomalyType.isActiveStatus) {

4
src/model/anomaly.ts

@ -26,6 +26,7 @@ export class AnomalyType {
private _saving: boolean = false;
private _segmentSet = new SegmentArray<AnomalySegment>();
private _status: string;
private _error: string;
private _metric: Metric;
private _alertEnabled?: boolean;
@ -101,6 +102,9 @@ export class AnomalyType {
this._status = value;
}
get error() { return this._error; }
set error(value) { this._error = value; }
get isActiveStatus() {
return this.status !== 'ready' && this.status !== 'failed';
}

2
src/partials/tab_analytics.html

@ -100,7 +100,7 @@
<label>
<i ng-if="anomalyType.status === 'learning'" class="grafana-tip fa fa-leanpub ng-scope" bs-tooltip="'Learning'"></i>
<i ng-if="anomalyType.status === 'pending'" class="grafana-tip fa fa-list-ul ng-scope" bs-tooltip="'Pending'"></i>
<i ng-if="anomalyType.status === 'failed'" class="grafana-tip fa fa-exclamation-circle ng-scope" bs-tooltip="'Failed'"></i>
<i ng-if="anomalyType.status === 'failed'" class="grafana-tip fa fa-exclamation-circle ng-scope" bs-tooltip="'Error: ' + anomalyType.error"></i>
</label>
</div>

2
src/services/anomaly_service.ts

@ -81,7 +81,7 @@ export class AnomalyService {
var data = await this._backendSrv.get(
this._backendURL + '/anomalies/status', { name: key }
);
return data.status as string;
return data;
}
let timeout = async () => new Promise(

Loading…
Cancel
Save