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. 11
      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() {

11
src/panel/graph_panel/graph_renderer.ts

@ -78,7 +78,7 @@ export class GraphRenderer {
// this.eventManager = new EventManager(this.ctrl); // this.eventManager = new EventManager(this.ctrl);
this.flotOptions = {} this.flotOptions = {}
this.tooltip = new GraphTooltip( this.tooltip = new GraphTooltip(
$elem, this.dashboard, scope, () => this.sortedSeries, $elem, this.dashboard, scope, () => this.sortedSeries,
this._analyticController.getSegmentsSearcher() this._analyticController.getSegmentsSearcher()
@ -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;
@ -615,7 +618,7 @@ export class GraphRenderer {
return [tickIndex + 1, point[1]]; return [tickIndex + 1, point[1]];
}); });
}); });
ticks = _.flatten(ticks); ticks = _.flatten(ticks);
this.flotOptions.xaxis = { this.flotOptions.xaxis = {
timezone: this.dashboard.getTimezone(), timezone: this.dashboard.getTimezone(),

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