Browse Source

naming++

master
Alexey Velikiy 6 years ago
parent
commit
4f04885ca4
  1. 16
      src/controllers/analytic_controller.ts
  2. 2
      src/graph_tooltip.ts
  3. 4
      src/models/analytic_unit.ts
  4. 2
      src/services/analytic_service.ts

16
src/controllers/analytic_controller.ts

@ -187,7 +187,7 @@ export class AnalyticController {
if(!_.isNumber(+to)) {
throw new Error('to isn`t number');
}
var allSegmentsList = await this._analyticService.getSegments(anomalyType.key, from, to);
var allSegmentsList = await this._analyticService.getSegments(anomalyType.id, from, to);
var allSegmentsSet = new SegmentArray(allSegmentsList);
if(anomalyType.selected) {
this._labelingDataAddedSegments.getSegments().forEach(s => allSegmentsSet.addSegment(s));
@ -210,7 +210,7 @@ export class AnalyticController {
}
return this._analyticService.updateSegments(
anomaly.key, this._labelingDataAddedSegments, this._labelingDataDeletedSegments
anomaly.id, this._labelingDataAddedSegments, this._labelingDataDeletedSegments
);
}
@ -286,14 +286,14 @@ export class AnalyticController {
throw new Error('anomalyType not defined');
}
if(this._statusRunners.has(anomalyType.key)) {
if(this._statusRunners.has(anomalyType.id)) {
return;
}
this._statusRunners.add(anomalyType.key);
this._statusRunners.add(anomalyType.id);
var statusGenerator = this._analyticService.getAnomalyTypeStatusGenerator(
anomalyType.key, 1000
anomalyType.id, 1000
);
for await (const data of statusGenerator) {
@ -311,11 +311,11 @@ export class AnalyticController {
}
}
this._statusRunners.delete(anomalyType.key);
this._statusRunners.delete(anomalyType.id);
}
async runEnabledWaiter(anomalyType: AnalyticUnit) {
var enabled = await this._analyticService.getAlertEnabled(anomalyType.key);
var enabled = await this._analyticService.getAlertEnabled(anomalyType.id);
if(anomalyType.alertEnabled !== enabled) {
anomalyType.alertEnabled = enabled;
this._emitter.emit('anomaly-type-alert-change', anomalyType);
@ -325,7 +325,7 @@ export class AnalyticController {
async toggleAnomalyTypeAlertEnabled(anomalyType: AnalyticUnit) {
var enabled = anomalyType.alertEnabled;
anomalyType.alertEnabled = undefined;
await this._analyticService.setAlertEnabled(anomalyType.key, enabled);
await this._analyticService.setAlertEnabled(anomalyType.id, enabled);
anomalyType.alertEnabled = enabled;
this._emitter.emit('anomaly-type-alert-change', anomalyType);
}

2
src/graph_tooltip.ts

@ -203,7 +203,7 @@ export class GraphTooltip {
<div class="graph-tooltip-list-item">
<div class="graph-tooltip-series-name">
<i class="fa fa-exclamation" style="color:${s.anomalyType.color}"></i>
${s.anomalyType.name}:
${s.anomalyType.id}:
</div>
<div class="graph-tooltip-value">
<i class="fa ${ s.segment.labeled ? "fa-thumb-tack" : "fa-search-plus" }" aria-hidden="true"></i>

4
src/models/analytic_unit.ts

@ -42,7 +42,7 @@ export class AnalyticUnit {
//this._metric = new Metric(_panelObject.metric);
}
get key(): AnalyticUnitId { return this.name; }
get id(): AnalyticUnitId { return this._panelObject.id; }
set name(value: string) { this._panelObject.name = value; }
get name(): string { return this._panelObject.name; }
@ -147,7 +147,7 @@ export class AnalyticUnitsSet {
_rebuildIndex() {
this._items.forEach((a, i) => {
this._mapIdIndex[a.key] = i;
this._mapIdIndex[a.id] = i;
});
}

2
src/services/analytic_service.ts

@ -19,7 +19,7 @@ export class AnalyticService {
return this._backendSrv.post(
this._backendURL + '/analyticUnits',
{
name: newItem.name,
name: newItem.id,
metric: metric.toJSON(),
panelUrl: window.location.origin + window.location.pathname + `?panelId=${panelId}&fullscreen`,
datasource: datasourceRequest,

Loading…
Cancel
Save