mirror of
https://github.com/grafana/grafana.git
synced 2026-08-13 06:34:55 -05:00
Merge branch 'influxdb_alias_columns' of https://github.com/thuck/grafana into thuck-influxdb_alias_columns
This commit is contained in:
@@ -62,6 +62,7 @@ You can switch to raw query mode by pressing the pen icon.
|
||||
|
||||
- $m = replaced with measurement name
|
||||
- $measurement = replaced with measurement name
|
||||
- $col = replaced with column name
|
||||
- $tag_hostname = replaced with the value of the hostname tag
|
||||
- You can also use [[tag_hostname]] pattern replacement syntax
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ function (_) {
|
||||
}
|
||||
|
||||
if (self.alias) {
|
||||
seriesName = self._getSeriesName(series);
|
||||
seriesName = self._getSeriesName(series, j);
|
||||
} else if (series.tags) {
|
||||
seriesName = seriesName + ' {' + tags.join(', ') + '}';
|
||||
}
|
||||
@@ -54,13 +54,14 @@ function (_) {
|
||||
return output;
|
||||
};
|
||||
|
||||
p._getSeriesName = function(series) {
|
||||
p._getSeriesName = function(series, index) {
|
||||
var regex = /\$(\w+)|\[\[([\s\S]+?)\]\]/g;
|
||||
|
||||
return this.alias.replace(regex, function(match, g1, g2) {
|
||||
var group = g1 || g2;
|
||||
|
||||
if (group === 'm' || group === 'measurement') { return series.name; }
|
||||
if (group === 'col') { return series.columns[index]; }
|
||||
if (group.indexOf('tag_') !== 0) { return match; }
|
||||
|
||||
var tag = group.replace('tag_', '');
|
||||
|
||||
@@ -212,6 +212,7 @@
|
||||
<ul>
|
||||
<li>$m = replaced with measurement name</li>
|
||||
<li>$measurement = replaced with measurement name</li>
|
||||
<li>$col = replaced with column name</li>
|
||||
<li>$tag_hostname = replaced with the value of the hostname tag</li>
|
||||
<li>You can also use [[tag_hostname]] pattern replacement syntax</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user