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

Fixes height issue on first render, and error handling issue #216

Closed torkelo closed 5 years ago

torkelo commented 5 years ago

Fixes #212 (longer delay needed), and found a better way to do it than calling resize after render Fixes #213 (Error handling is needed here until we fix https://github.com/grafana/grafana/issues/18766)

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

amotl commented 5 years ago

Dear @torkelo,

thanks for fixing the timing/rendering issue. As the changeset is pretty large, I would like to humbly ask you about the gist of this change. Maybe you can point it out to me to enable me porting this to [1].

With kind regards, Andreas.

[1] https://github.com/hiveeyes/hiveeyes-micropython-firmware

amotl commented 4 years ago

I see that the essential change corresponding to fixing https://github.com/grafana/grafana/issues/15406 and #213 is in src/worldmap_ctrl.ts:

// delay first render as the map panel sizing is bugged first render even though the element has correct height
if (firstRender) {
  firstRender = false;
  setTimeout(render, 100);
  return;
}

and also doing

ctrl.map.resize();

instead of

setTimeout(() => {
  ctrl.map.resize();
}, 1);

Right?

We also recognize it is already part of @ryantxu's branch at https://github.com/hiveeyes/grafana-worldmap-panel/tree/with-toolkit.

So, thanks again for that!

amotl commented 4 years ago

@ryantxu: The essence of the other commit f6521000 by @torkelo seems to be

} catch (err) {
  appEvents.emit('alert-error', ['Data error', err.toString()])
}

... wrapping the code which is now in WorldmapCore::decodeData method in core.ts.

However, as specifically error handling has improved significantly over there, we believe it should be okay already. Nevertheless, we wanted give that detail a short note here.