Browse Source

_labelingDataDeletedSegments -> _labelingDataRemovedSegments

master
rozetko 6 years ago
parent
commit
256ba37969
  1. 16
      src/panel/graph_panel/controllers/analytic_controller.ts

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

@ -37,7 +37,7 @@ export class AnalyticController {
private _selectedAnalyticUnitId: AnalyticUnitId = null; private _selectedAnalyticUnitId: AnalyticUnitId = null;
private _labelingDataAddedSegments: SegmentsSet<AnalyticSegment>; private _labelingDataAddedSegments: SegmentsSet<AnalyticSegment>;
private _labelingDataDeletedSegments: SegmentsSet<AnalyticSegment>; private _labelingDataRemovedSegments: SegmentsSet<AnalyticSegment>;
private _newAnalyticUnit: AnalyticUnit = null; private _newAnalyticUnit: AnalyticUnit = null;
private _creatingNewAnalyticType: boolean = false; private _creatingNewAnalyticType: boolean = false;
private _savingNewAnalyticUnit: boolean = false; private _savingNewAnalyticUnit: boolean = false;
@ -54,7 +54,7 @@ export class AnalyticController {
_panelObject.analyticUnits = _panelObject.anomalyTypes || []; _panelObject.analyticUnits = _panelObject.anomalyTypes || [];
} }
this._labelingDataAddedSegments = new SegmentArray<AnalyticSegment>(); this._labelingDataAddedSegments = new SegmentArray<AnalyticSegment>();
this._labelingDataDeletedSegments = new SegmentArray<AnalyticSegment>(); this._labelingDataRemovedSegments = new SegmentArray<AnalyticSegment>();
this._analyticUnitsSet = new AnalyticUnitsSet(this._panelObject.analyticUnits); this._analyticUnitsSet = new AnalyticUnitsSet(this._panelObject.analyticUnits);
this._thresholds = []; this._thresholds = [];
this.updateThresholds(); this.updateThresholds();
@ -161,7 +161,7 @@ export class AnalyticController {
this._labelingDataAddedSegments.getSegments().forEach(s => { this._labelingDataAddedSegments.getSegments().forEach(s => {
this.labelingUnit.segments.remove(s.id); this.labelingUnit.segments.remove(s.id);
}); });
this._labelingDataDeletedSegments.getSegments().forEach(s => { this._labelingDataRemovedSegments.getSegments().forEach(s => {
this.labelingUnit.segments.addSegment(s); this.labelingUnit.segments.addSegment(s);
}); });
this.dropLabeling(); this.dropLabeling();
@ -169,7 +169,7 @@ export class AnalyticController {
dropLabeling() { dropLabeling() {
this._labelingDataAddedSegments.clear(); this._labelingDataAddedSegments.clear();
this._labelingDataDeletedSegments.clear(); this._labelingDataRemovedSegments.clear();
this.labelingUnit.selected = false; this.labelingUnit.selected = false;
this._selectedAnalyticUnitId = null; this._selectedAnalyticUnitId = null;
this._tempIdCounted = -1; this._tempIdCounted = -1;
@ -228,7 +228,7 @@ export class AnalyticController {
var allSegmentsSet = new SegmentArray(allSegmentsList); var allSegmentsSet = new SegmentArray(allSegmentsList);
if(analyticUnit.selected) { if(analyticUnit.selected) {
this._labelingDataAddedSegments.getSegments().forEach(s => allSegmentsSet.addSegment(s)); this._labelingDataAddedSegments.getSegments().forEach(s => allSegmentsSet.addSegment(s));
this._labelingDataDeletedSegments.getSegments().forEach(s => allSegmentsSet.remove(s.id)); this._labelingDataRemovedSegments.getSegments().forEach(s => allSegmentsSet.remove(s.id));
} }
analyticUnit.segments = allSegmentsSet; analyticUnit.segments = allSegmentsSet;
} }
@ -241,7 +241,7 @@ export class AnalyticController {
if( if(
this._labelingDataAddedSegments.length === 0 && this._labelingDataAddedSegments.length === 0 &&
this._labelingDataDeletedSegments.length === 0 this._labelingDataRemovedSegments.length === 0
) { ) {
return []; return [];
} }
@ -249,7 +249,7 @@ export class AnalyticController {
await this._analyticService.updateMetric(unit.id, this._currentMetric, this._currentDatasource); await this._analyticService.updateMetric(unit.id, this._currentMetric, this._currentDatasource);
return this._analyticService.updateSegments( return this._analyticService.updateSegments(
unit.id, this._labelingDataAddedSegments, this._labelingDataDeletedSegments unit.id, this._labelingDataAddedSegments, this._labelingDataRemovedSegments
); );
} }
@ -320,7 +320,7 @@ export class AnalyticController {
const allRemovedSegs = this.labelingUnit.removeSegmentsInRange(from, to); const allRemovedSegs = this.labelingUnit.removeSegmentsInRange(from, to);
allRemovedSegs.forEach(s => { allRemovedSegs.forEach(s => {
if(!this._labelingDataAddedSegments.has(s.id)) { if(!this._labelingDataAddedSegments.has(s.id)) {
this._labelingDataDeletedSegments.addSegment(s); this._labelingDataRemovedSegments.addSegment(s);
} }
}); });
this._labelingDataAddedSegments.removeInRange(from, to); this._labelingDataAddedSegments.removeInRange(from, to);

Loading…
Cancel
Save