mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-21 23:42:03 +00:00
Added YLabel splitter and Extra info on tooltip
Actually, custom label are not allowed, it directly uses the provided by the query result as the target/alias This feature allows to: - Split YLabel to store its partials and reuse them on link and extra tooltip field - Override YLabel with splitted and custom values - Added Extra Tooltip to show metadata to the user on each serie
This commit is contained in:
@@ -112,6 +112,7 @@ export class StatusmapTooltip {
|
||||
|
||||
let timestamp = bucket.to;
|
||||
let yLabel = bucket.yLabel;
|
||||
let pLabels = bucket.pLabels;
|
||||
let value = bucket.value;
|
||||
let values = bucket.values;
|
||||
// TODO create option for this formatting.
|
||||
@@ -188,6 +189,11 @@ export class StatusmapTooltip {
|
||||
// Grafana 7.0 compatible
|
||||
scopedVars[`__url_time_range`] = {value: this.panelCtrl.retrieveTimeVar()};
|
||||
|
||||
//New vars based on partialLabels:
|
||||
for (let i in pLabels) {
|
||||
scopedVars[`__y_label_${i}`] = {value: pLabels[i]};
|
||||
}
|
||||
|
||||
for (let item of items) {
|
||||
if (_.isEmpty(item.urlTemplate)) {
|
||||
item.link = "#";
|
||||
@@ -217,6 +223,11 @@ export class StatusmapTooltip {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.panel.tooltip.showCustomContent) {
|
||||
let customContent: string = this.panelCtrl.templateSrv.replace(this.panel.tooltip.customContent, scopedVars)
|
||||
tooltipHtml += `<div>${customContent}</div>`
|
||||
}
|
||||
|
||||
tooltipHtml += _.join(_.map(items, v => `
|
||||
<div>
|
||||
<a href="${v.link}" target="_blank">
|
||||
|
||||
Reference in New Issue
Block a user