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;
}
addLabelSegment(segment: Segment) {
var asegment = this.labelingUnit.addLabeledSegment(segment);
addLabelSegment(segment: Segment, deleted?: boolean) {
var asegment = this.labelingUnit.addLabeledSegment(segment, deleted);
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
this.events.on('init-edit-mode', this.onInitEditMode.bind(this));
}
rebindDKey() {

11
src/panel/graph_panel/graph_renderer.ts

@ -78,7 +78,7 @@ export class GraphRenderer {
// this.eventManager = new EventManager(this.ctrl);
this.flotOptions = {}
this.tooltip = new GraphTooltip(
$elem, this.dashboard, scope, () => this.sortedSeries,
this._analyticController.getSegmentsSearcher()
@ -150,9 +150,11 @@ export class GraphRenderer {
this._analyticController.deleteLabelingAnalyticUnitSegmentsInRange(
segment.from, segment.to
);
} else {
this._analyticController.addLabelSegment(segment);
}
this._analyticController.addLabelSegment(
segment, this._analyticController.labelingDeleteMode
);
this.renderPanel();
return;
}
@ -194,6 +196,7 @@ export class GraphRenderer {
}
public render(renderData) {
this.data = renderData || this.data;
if (!this.data) {
return;
@ -615,7 +618,7 @@ export class GraphRenderer {
return [tickIndex + 1, point[1]];
});
});
ticks = _.flatten(ticks);
ticks = _.flatten(ticks);
this.flotOptions.xaxis = {
timezone: this.dashboard.getTimezone(),

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

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

Loading…
Cancel
Save