Skip to content

Commit 7a2ccab

Browse files
committed
Rename "point_" prefix to "__field_" when interpolating datapoint field values
1 parent 02ec0b6 commit 7a2ccab

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
add basic variable interpolation based on keys from `dataPoint`.
2929
- Introduce the regular Grafana templating mechanism for interpolating variables
3030
into clickthrough links. As we are now interpolating dashboard **and** `dataPoint`
31-
variables, the latter one will get prefixed with `point_` to avoid collisions.
31+
variables, the latter one will get prefixed with `__field_` to avoid collisions.
3232
- Apply Grafana-style variable interpolation to **all** panel settings.
3333
- Add query parameters into the interpolation dictionary, prefixed by `request_`.
3434
- Use request parameters prefixed with "panel-" to optionally override the
@@ -47,6 +47,7 @@
4747
- Add `hideTimepickerNavigation` option.
4848
- Add `circleOptions.strokeEnabled` and `circleOptions.strokeWeight`.
4949
- Add options `customAttribution` and `customAttributionText`.
50+
- Rename `point_` prefix to `__field_` when interpolating datapoint field values
5051

5152
## v0.2.0
5253

src/data_formatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ export default class DataFormatter {
363363
link: link,
364364
};
365365

366-
// Add all values from the original datapoint as attributes prefixed with `point_`.
366+
// Add all values from the original datapoint as attributes prefixed with `__field_`.
367367
for (let key in datapoint) {
368368
const value = datapoint[key];
369-
key = 'point_' + key;
369+
key = '__field_' + key;
370370
dataValue[key] = value;
371371
}
372372

src/partials/editor.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,11 @@ <h5>Popup labels</h5>
446446
<div class="gf-form-group">
447447
<h5>Clickthrough links</h5>
448448
<div class="gf-form">
449-
<label class="gf-form-label width-10">Clickthrough URL</label>
450-
<input type="text" class="input-small gf-form-input width-20" ng-model="ctrl.panel.clickthroughUrl" ng-change="ctrl.refresh()" ng-model-onblur />
449+
<label class="gf-form-label width-10">
450+
Clickthrough URL
451+
<i class="grafana-tip fa fa-question-circle" bs-tooltip="'Address field values by prefixing $__field, e.g. $__field_geohash'"></i>
452+
</label>
453+
<input type="text" class="input-small gf-form-input width-20" ng-model="ctrl.panel.clickthroughUrl" ng-change="ctrl.refresh()" ng-model-onblur/>
451454
</div>
452455
<div class="gf-form">
453456
<label class="gf-form-label width-10">Clickthrough Window</label>

src/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class PluginSettings {
7878
// When given, use request variable "panel-*", making things like these possible.
7979
// - ?panel-mapCenterLatitude=62.2
8080
// - ?panel-showZoomControl=false
81-
// - ?panel-clickthroughUrl=/path/to/?geohash=$point_geohash
81+
// - ?panel-clickthroughUrl=/path/to/?geohash=$__field_geohash
8282
// - https://daq.example.org/d/D1Fx12kWk/magic-dashboard?panel-clickthroughUrl=/path/to/?foobar=$request_foobar&foobar=hello
8383
const panel_query_name = 'panel-' + name;
8484
const panel_query_value = this._request[panel_query_name];

0 commit comments

Comments
 (0)