grafana / worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
MIT License
309 stars 199 forks source link

Add Clickthrough URL option for country circles #129

Closed ryft closed 4 years ago

ryft commented 6 years ago

This is a simple implementation of a panel option being used to navigate to a new URL on click.

Instances of $country in the clickthrough URL will be replaced with the selected country. In fact this should work regardless of location data type, so perhaps "country" is not the most appropriate keyword.

See #62 and #121.

CLAassistant commented 6 years ago

CLA assistant check
All committers have signed the CLA.

amotl commented 5 years ago

Dear James,

Introduction

We cherry-picked your improvements into our working branch at [1], wrote about this and further updates at [2] and just announced the outcome at [3], which you might also be interested in. Thanks a bunch for sharing your efforts.

Details

As you can see from the screenshot below, we improved the situation where only a field called country would get interpolated and extended this to a bunch of more variables coming from the dashboard and the database. You will find more details about this specific feature at [4], along with the other option for click-through URLs coming thoroughly from the database #190.

image

With kind regards, Andreas.

[1] https://github.com/hiveeyes/grafana-worldmap-panel [2] https://community.grafana.com/t/giving-the-grafana-worldmap-panel-some-love/17210 [3] https://community.hiveeyes.org/t/grafana-worldmap-panel-0-3-0-dev-series/1824 [4] https://community.hiveeyes.org/t/grafana-worldmap-panel-0-3-0-dev-series/1824/13

ronansalmon commented 5 years ago

Hi all, we have forked worldmap-panel and fixed the conflict and got this link clicking working. Are you interested in this patch ? Is so, I can push a PR.

Ronan.

amotl commented 5 years ago

Dear @ronansalmon,

click-through should work in https://github.com/hiveeyes/grafana-worldmap-panel already. Can you verify that?

With kind regards, Andreas.

ronansalmon commented 5 years ago

Dear @ronansalmon,

click-through should work in https://github.com/hiveeyes/grafana-worldmap-panel already. Can you verify that?

With kind regards, Andreas.

I tried, but the plugin does not work over here :

Plugin Error
this.$location is undefined

I tried both the 0.4.0 and the latest devel. We are using a pretty old version of Grafana v5.1.3 and I am not allowed to update it yet.

Ronan.

amotl commented 5 years ago

Dear @ronansalmon,

thanks for sharing your observations. May I humbly ask how you installed the latest release from [1]? The last time we tried, we have been able to get it running successfully by following the guidelines at [2].

With kind regards, Andreas.

[1] https://github.com/hiveeyes/grafana-worldmap-panel [2] https://community.grafana.com/t/giving-the-grafana-worldmap-panel-some-love/17210

ronansalmon commented 5 years ago

Hi, the plugin seams to be running with a recent grafana version. I will try to use it. Thanks,

Dear @ronansalmon,

thanks for sharing your observations. May I humbly ask how you installed the latest release from [1]? The last time we tried, we have been able to get it running successfully by following the guidelines at [2].

amotl commented 4 years ago

Dear @ryft and @ronansalmon,

The [forked] plugin seams to be running with a recent Grafana version. I will try to use it.

Thanks for letting us know. There are some minor updates on [1], mainly about the most recent build 0.6.0 together with respective instructions on how to install the refurbished panel now called Map Panel side-by-side with the canonical Worldmap Panel in order to give you some leg room trying it out, even on production installations of Grafana.

May we humbly ask @ryft to try out the clickthrough feature there (thanks for your contribution again!) and - given it works as intended - to close this PR?

With kind regards, Andreas.

[1] https://community.grafana.com/t/giving-the-grafana-worldmap-panel-some-love/17210/11

ryft commented 4 years ago

Hi Andreas, apologies for the delayed response, I'm happy to close this PR.

vmanju123 commented 4 years ago

Hi Ryft

I made these changes on my local source and compiled the plugin and i am able to launch the URL, how do i pass context into the URL, ? I have following issues

  1. I would like to pass start time , end time from the dashboard where i am launching worldmap panel, i use elastic search db in backend, grafana supports to and from built in variables for from and to time frames, I did not see the URL picking up the grafana built in variables
  2. I would like the URL to be launched in seperate tab ? is there a way to do this ?
  3. I would like to pass variables in the URL, I tried template variables but its not picking up the values of the variables in the URL

thanks vmanju123

amotl commented 4 years ago

Dear @vmanju123,

please have a look at https://github.com/grafana/worldmap-panel/pull/129#issuecomment-491541607 and https://github.com/grafana/worldmap-panel/issues/248#issuecomment-577635788 where we described that we implemented this feature within our fork [1,2]. It has incorporated more sophisticated drill-down/clickthrough features from the community as well as some advanced variable interpolation features from our own pen. Both features might help you here.

The updated plugin can be installed easily [3]. We hope this helps and we will be happy to hear about the outcome for you.

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel [2] https://community.panodata.org/t/grafana-map-panel/121 [3] https://community.panodata.org/t/grafana-map-panel/121#setup

vmanju123 commented 4 years ago

I tried downloading the latest DEV branch code 0.9.0 and compile it, I am seeing following error while compiling , I have grafana 6.5.2 code base

ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts [tsl] ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts(54,17) TS2339: Property 'url' does not exist on type 'JQueryXHR'.

ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts [tsl] ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts(69,17) TS2339: Property 'url' does not exist on type 'JQueryXHR'.

ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts [tsl] ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/core.ts(88,17) TS2339: Property 'url' does not exist on type 'JQueryXHR'.

ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/chrome.ts [tsl] ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/chrome.ts(65,5) TS2571: Object is of type 'unknown'.

ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/chrome.ts [tsl] ERROR in /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/src/chrome.ts(69,5) TS2571: Object is of type 'unknown'. Child mini-css-extract-plugin ../node_modules/css-loader/dist/cjs.js??ref--6-1!../node_modules/postcss-loader/src/index.js??ref--6-2!styles/dark.css: Entrypoint mini-css-extract-plugin = [0] ../node_modules/css-loader/dist/cjs.js??ref--6-1!../node_modules/postcss-loader/src??ref--6-2!./styles/dark.css 1.02 KiB {0} [built] [1] ../node_modules/css-loader/dist/runtime/api.js 2.04 KiB {0} [built] Child mini-css-extract-plugin ../node_modules/css-loader/dist/cjs.js??ref--6-1!../node_modules/postcss-loader/src/index.js??ref--6-2!styles/light.css: Entrypoint mini-css-extract-plugin = [0] ../node_modules/css-loader/dist/cjs.js??ref--6-1!../node_modules/postcss-loader/src??ref--6-2!./styles/light.css 778 bytes {0} [built] [1] ../node_modules/css-loader/dist/runtime/api.js 2.04 KiB {0} [built]

Trace: Build failed at /root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/node_modules/@grafana/src/cli/utils/useSpinner.ts:13:15 at step (/root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/node_modules/tslib/tslib.js:136:27) at Object.throw (/root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/node_modules/tslib/tslib.js:117:57) at rejected (/root/go/src/github.com/grafana/grafana/data/plugins/grafana-map-panel/node_modules/tslib/tslib.js:108:69) at ✖ Build failed

amotl commented 4 years ago

Dear @vmanju123,

thanks for the feedback. I have diverted further discussions to https://github.com/panodata/grafana-map-panel/issues/56 in order not to clutter the original issue.

With kind regards, Andreas.

vmanju123 commented 4 years ago

Thanks, coming back to original issue, I am trying to pass the URL as below https://xyz.com/d/xyz-monitor/xyz-monitor?&from=${__from}&to=${__to}&var-Filter=clientGeo|=|${__field_clientGeo}&var-Filter=applicationDescription|=|${__field_applicationDescription}

in the above URL clientGeo is the geo hashpoint and applicationDescription is another field both from elastic search, I can see from and to picking up the time fields form the main panel but clientGeo and applicationDescription are not resolving to values, both clientGeo and applicationDescription are in the elastic query and returning data to main panel, but not getting resolved to values in the click through URL

amotl commented 4 years ago

Dear @vmanju123,

the variable interpolation feature does not have anything to do with this pull request. Please open an issue about that on our fork [1].

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-map-panel

vmanju123 commented 4 years ago

ok & thanks, makes sense