Browse Source

fix: Active delete segment is hidden #175

master
Coin de Gamma 6 years ago
parent
commit
b19308fe06
  1. 4
      src/panel/graph_panel/controllers/analytic_controller.ts
  2. 1
      src/panel/graph_panel/graph_ctrl.ts
  3. 7
      src/panel/graph_panel/graph_renderer.ts
  4. 4
      src/panel/graph_panel/models/analytic_unit.ts

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

@ -185,8 +185,8 @@ export class AnalyticController {
return this.labelingUnit.deleteMode; return this.labelingUnit.deleteMode;
} }
addLabelSegment(segment: Segment) { addLabelSegment(segment: Segment, deleted?: boolean) {
var asegment = this.labelingUnit.addLabeledSegment(segment); var asegment = this.labelingUnit.addLabeledSegment(segment, deleted);
this._labelingDataAddedSegments.addSegment(asegment); this._labelingDataAddedSegments.addSegment(asegment);
} }

1
src/panel/graph_panel/graph_ctrl.ts

@ -155,7 +155,6 @@ class GraphCtrl extends MetricsPanelCtrl {
// because of https://github.com/hastic/hastic-grafana-app/issues/162 // because of https://github.com/hastic/hastic-grafana-app/issues/162
this.events.on('init-edit-mode', this.onInitEditMode.bind(this)); this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
} }
rebindDKey() { rebindDKey() {

7
src/panel/graph_panel/graph_renderer.ts

@ -150,9 +150,11 @@ export class GraphRenderer {
this._analyticController.deleteLabelingAnalyticUnitSegmentsInRange( this._analyticController.deleteLabelingAnalyticUnitSegmentsInRange(
segment.from, segment.to segment.from, segment.to
); );
} else {
this._analyticController.addLabelSegment(segment);
} }
this._analyticController.addLabelSegment(
segment, this._analyticController.labelingDeleteMode
);
this.renderPanel(); this.renderPanel();
return; return;
} }
@ -194,6 +196,7 @@ export class GraphRenderer {
} }
public render(renderData) { public render(renderData) {
this.data = renderData || this.data; this.data = renderData || this.data;
if (!this.data) { if (!this.data) {
return; return;

4
src/panel/graph_panel/models/analytic_unit.ts

@ -80,8 +80,8 @@ export class AnalyticUnit {
this._panelObject.visible = value; this._panelObject.visible = value;
} }
addLabeledSegment(segment: Segment): AnalyticSegment { addLabeledSegment(segment: Segment, deleted: boolean): AnalyticSegment {
var asegment = new AnalyticSegment(true, segment.id, segment.from, segment.to); var asegment = new AnalyticSegment(true, segment.id, segment.from, segment.to, deleted);
this._segmentSet.addSegment(asegment); this._segmentSet.addSegment(asegment);
return asegment; return asegment;
} }

Loading…
Cancel
Save