Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 7ba46ec

Browse files
authored
Merge pull request #2 from HBOCodeLabs/eduelias/CAPS-5810-make-geolabel-optional
feat(label): hide location label in tooltip
2 parents 3211d1e + 5280fce commit 7ba46ec

7 files changed

Lines changed: 19 additions & 24718 deletions

File tree

package-lock.json

Lines changed: 0 additions & 24701 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "advanced-wordmap-panel",
2+
"name": "advanced-worldmap-panel",
33
"version": "1.0",
44
"description": "Advanced Worldmap Panel Plugin for Grafana",
55
"main": "src/module.js",

src/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {loadPluginCss} from 'grafana/app/plugins/sdk';
33
import WorldmapCtrl from './worldmap_ctrl';
44

55
loadPluginCss({
6-
dark: 'plugins/advanced-wordmap-panel/css/worldmap.dark.css',
7-
light: 'plugins/advanced-wordmap-panel/css/worldmap.light.css'
6+
dark: 'plugins/advanced-worldmap-panel/css/worldmap.dark.css',
7+
light: 'plugins/advanced-worldmap-panel/css/worldmap.light.css'
88
});
99

1010
export {

src/partials/editor.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ <h6 ng-show="ctrl.panel.locationData === 'table' || ctrl.panel.locationData ===
171171
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.tableQueryOptions.longitudeField" ng-change="ctrl.refresh()"
172172
ng-model-onblur />
173173
</div>
174+
<gf-form-switch class="gf-form" ng-show="ctrl.panel.locationData === 'geohash'" label="Hide Location Name" label-class="width-10" checked="ctrl.panel.hideLocationName" ng-model="ctrl.panel.hideLocationName" on-change="ctrl.render()"></gf-form-switch>
174175
<div class="gf-form" ng-show="ctrl.panel.locationData === 'geohash'">
175176
<label class="gf-form-label width-12">Location Name Field</label>
176177
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.esLocationName" ng-change="ctrl.refresh()"
@@ -189,16 +190,11 @@ <h6 ng-show="ctrl.panel.locationData === 'table' || ctrl.panel.locationData ===
189190
</div>
190191

191192
<div class="section gf-form-group">
192-
<h5 class="section-heading">Drawing Options</h5>
193-
<div class="gf-form">
194-
<label class="gf-form-label width-10">Minimum threshold value </label>
195-
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.minThreshold" ng-change="ctrl.render()"
196-
placeholder="10" ng-model-onblur />
197-
</div>
193+
<h5 class="section-heading">Coloring Options</h5>
198194
<div class="gf-form">
199195
<label class="gf-form-label width-10">Color property </label>
200196
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.colorMetric" ng-change="ctrl.render()"
201-
placeholder="Percent Column" ng-model-onblur />
197+
placeholder="Bucket Script" ng-model-onblur />
202198
</div>
203199
<div class="gf-form">
204200
<label class="gf-form-label width-10">Color label </label>
@@ -229,6 +225,11 @@ <h5 class="section-heading">Drawing Options</h5>
229225

230226
<div class="section gf-form-group">
231227
<h5 class="section-heading">Hide series</h5>
228+
<div class="gf-form">
229+
<label class="gf-form-label width-10">With values under </label>
230+
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.minValue" ng-change="ctrl.render()"
231+
placeholder="10" ng-model-onblur />
232+
</div>
232233
<gf-form-switch class="gf-form" label="With only nulls" label-class="width-10" checked="ctrl.panel.hideEmpty" on-change="ctrl.render()">
233234
</gf-form-switch>
234235
<gf-form-switch class="gf-form" label="With only zeros" label-class="width-10" checked="ctrl.panel.hideZero" on-change="ctrl.render()">

src/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "panel",
33
"name": "Advanced Worldmap Panel",
4-
"id": "advanced-wordmap-panel",
4+
"id": "advanced-worldmap-panel",
55

66
"info": {
77
"description": "World Map panel for Grafana. Displays time series data or geohash data from Elasticsearch overlaid on a world map.",

src/worldmap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default class WorldMap {
105105
return _.filter(data, o => {
106106
return !(this.ctrl.panel.hideEmpty && _.isNil(o.value))
107107
&& !(this.ctrl.panel.hideZero && o.value === 0)
108-
&& !(this.ctrl.panel.minThreshold && o.value <= this.ctrl.panel.minThreshold)
108+
&& !(this.ctrl.panel.minValue !== undefined && o.value <= this.ctrl.panel.minValue)
109109
});
110110
}
111111

@@ -196,8 +196,8 @@ export default class WorldMap {
196196

197197
createPopup(circle, locationName, value, colorValue) {
198198
const unit = value && value === 1 ? this.ctrl.panel.unitSingular : this.ctrl.panel.unitPlural;
199-
const firstLine = `${locationName}: ${value} ${(unit || '')}`.trim();
200-
const secondLine = colorValue !== undefined ? `${(this.ctrl.panel.colorLabel !== undefined ? this.ctrl.panel.colorLabel + ': ':'') + colorValue + (this.ctrl.panel.colorUnit || '')}`.trim(): '';
199+
const firstLine = `${this.ctrl.panel.hideLocationName ? "" : locationName + ": "}`+`${value} ${(unit || '')}`.trim();
200+
const secondLine = colorValue !== undefined ? `${(this.ctrl.panel.colorLabel !== undefined ? this.ctrl.panel.colorLabel + ': ':'') + (colorValue || '0') + (this.ctrl.panel.colorUnit || '')}`.trim(): '';
201201
const label = `${firstLine}${secondLine !== '' ? '<br>' + secondLine : ''}`;
202202
circle.bindPopup(label, {
203203
offset: (<any>window).L.point(0, -2),

src/worldmap_ctrl.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const panelDefaults = {
1616
mapCenterLongitude: 0,
1717
initialZoom: 1,
1818
valueName: "total",
19-
minThreshold: 0,
19+
minValue: 0,
2020
colorMetric:"",
2121
colorLabel: "",
2222
colorUnit:"%",
@@ -34,6 +34,7 @@ const panelDefaults = {
3434
unitPlural: "",
3535
showLegend: true,
3636
mouseWheelZoom: false,
37+
hideLocationName: false,
3738
esMetric: "Count",
3839
decimals: 0,
3940
hideEmpty: false,
@@ -143,7 +144,7 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
143144
this.panel.locationData !== "json result"
144145
) {
145146
$.getJSON(
146-
"public/plugins/advanced-wordmap-panel/data/" +
147+
"public/plugins/advanced-worldmap-panel/data/" +
147148
this.panel.locationData +
148149
".json"
149150
).then(this.reloadLocations.bind(this));
@@ -178,7 +179,7 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
178179
onInitEditMode() {
179180
this.addEditorTab(
180181
"Worldmap",
181-
"public/plugins/advanced-wordmap-panel/partials/editor.html",
182+
"public/plugins/advanced-worldmap-panel/partials/editor.html",
182183
2
183184
);
184185
}

0 commit comments

Comments
 (0)