mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: update panel alert tab (#33850)
This commit is contained in:
@@ -63,7 +63,7 @@ class GraphElement {
|
||||
data: any[] = [];
|
||||
panelWidth: number;
|
||||
eventManager: EventManager;
|
||||
thresholdManager: ThresholdManager;
|
||||
thresholdManager?: ThresholdManager;
|
||||
timeRegionManager: TimeRegionManager;
|
||||
legendElem: HTMLElement;
|
||||
|
||||
@@ -76,7 +76,10 @@ class GraphElement {
|
||||
|
||||
this.panelWidth = 0;
|
||||
this.eventManager = new EventManager(this.ctrl);
|
||||
this.thresholdManager = new ThresholdManager(this.ctrl);
|
||||
// unified alerting does not support threshold for graphs, at least for now
|
||||
if (!config.featureToggles.ngalert) {
|
||||
this.thresholdManager = new ThresholdManager(this.ctrl);
|
||||
}
|
||||
this.timeRegionManager = new TimeRegionManager(this.ctrl);
|
||||
// @ts-ignore
|
||||
this.tooltip = new GraphTooltip(this.elem, this.ctrl.dashboard, this.scope, () => {
|
||||
@@ -379,8 +382,9 @@ class GraphElement {
|
||||
}
|
||||
msg.appendTo(this.elem);
|
||||
}
|
||||
|
||||
this.thresholdManager.draw(plot);
|
||||
if (this.thresholdManager) {
|
||||
this.thresholdManager.draw(plot);
|
||||
}
|
||||
this.timeRegionManager.draw(plot);
|
||||
}
|
||||
|
||||
@@ -451,7 +455,9 @@ class GraphElement {
|
||||
}
|
||||
|
||||
// give space to alert editing
|
||||
this.thresholdManager.prepare(this.elem, this.data);
|
||||
if (this.thresholdManager) {
|
||||
this.thresholdManager.prepare(this.elem, this.data);
|
||||
}
|
||||
|
||||
// un-check dashes if lines are unchecked
|
||||
this.panel.dashes = this.panel.lines ? this.panel.dashes : false;
|
||||
@@ -460,7 +466,9 @@ class GraphElement {
|
||||
const options: any = this.buildFlotOptions(this.panel);
|
||||
this.prepareXAxis(options, this.panel);
|
||||
this.configureYAxisOptions(this.data, options);
|
||||
this.thresholdManager.addFlotOptions(options, this.panel);
|
||||
if (this.thresholdManager) {
|
||||
this.thresholdManager.addFlotOptions(options, this.panel);
|
||||
}
|
||||
this.timeRegionManager.addFlotOptions(options, this.panel);
|
||||
this.eventManager.addFlotEvents(this.annotations, options);
|
||||
this.sortedSeries = this.sortSeries(this.data, this.panel);
|
||||
|
||||
Reference in New Issue
Block a user