mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-22 15:53:09 +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:
Vendored
+17
-4
@@ -152,6 +152,7 @@ System.register(["d3", "jquery", "lodash"], function (_export, _context) {
|
||||
|
||||
var timestamp = bucket.to;
|
||||
var yLabel = bucket.yLabel;
|
||||
var pLabels = bucket.pLabels;
|
||||
var value = bucket.value;
|
||||
var values = bucket.values; // TODO create option for this formatting.
|
||||
|
||||
@@ -222,7 +223,14 @@ System.register(["d3", "jquery", "lodash"], function (_export, _context) {
|
||||
|
||||
scopedVars["__url_time_range"] = {
|
||||
value: this.panelCtrl.retrieveTimeVar()
|
||||
};
|
||||
}; //New vars based on partialLabels:
|
||||
|
||||
for (var _i in pLabels) {
|
||||
scopedVars["__y_label_".concat(_i)] = {
|
||||
value: pLabels[_i]
|
||||
};
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
@@ -242,10 +250,10 @@ System.register(["d3", "jquery", "lodash"], function (_export, _context) {
|
||||
|
||||
var valueDateVar = void 0;
|
||||
|
||||
for (var _i = 0; _i < bucket.values.length; _i++) {
|
||||
valueDateVar = "__value_".concat(_i, "_date");
|
||||
for (var _i2 = 0; _i2 < bucket.values.length; _i2++) {
|
||||
valueDateVar = "__value_".concat(_i2, "_date");
|
||||
scopedVars[valueDateVar] = {
|
||||
value: this.dashboard.formatDate(+bucket.values[_i], dateFormat)
|
||||
value: this.dashboard.formatDate(+bucket.values[_i2], dateFormat)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -280,6 +288,11 @@ System.register(["d3", "jquery", "lodash"], function (_export, _context) {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.panel.tooltip.showCustomContent) {
|
||||
var customContent = this.panelCtrl.templateSrv.replace(this.panel.tooltip.customContent, scopedVars);
|
||||
tooltipHtml += "<div>".concat(customContent, "</div>");
|
||||
}
|
||||
|
||||
tooltipHtml += _.join(_.map(items, function (v) {
|
||||
return "\n <div>\n <a href=\"".concat(v.link, "\" target=\"_blank\">\n <div class=\"dashlist-item\">\n <p class=\"dashlist-link dashlist-link-dash-db\">\n <span style=\"word-wrap: break-word;\" class=\"dash-title\">").concat(v.label, "</span><span class=\"dashlist-star\">\n <i class=\"fa fa-").concat(v.urlIcon, "\"></i>\n </span></p> </div></a><div>");
|
||||
}), "\n");
|
||||
|
||||
Reference in New Issue
Block a user