fetzerch / grafana-sunandmoon-datasource

SunAndMoon is a datasource plugin for Grafana that calculates the position of Sun and Moon as well as the Moon illumination. ☀️🌙🧛‍♂️
MIT License
41 stars 8 forks source link

plugin not working with grafana v6.3.0-beta2 (commit: c8740d9) #18

Closed clarkspark closed 5 years ago

clarkspark commented 5 years ago

I've recently updated to grafana v6.30-beta2 on Debian Bullseye using the https://packages.grafana.com/oss/deb beta repo. The installed sun-and-moon plugin is version 0.1.4. Prior to the update the sun-and-moon plugin was working flawlessly. I now get an error for the sun-and-moon panel. The error displayed in the left corner of the panel is:

e.query(...).then is not a function

I can provide more information if it will help troubleshoot if I can be directed to where it might be located.

fetzerch commented 5 years ago

It seems that query is expected to return a promise now. The following patch should do, I'll try to find some time to create a new release in the next day.

+++ b/src/datasource.ts
@@ -197,7 +197,7 @@ export class SunAndMoonDatasource {
       targetSeries.push({"target": series[metric].text,
                          "datapoints": series[metric].values});
     }
-    return {"data": targetSeries};
+    return this.$q.when({"data": targetSeries});
   }

   annotationQuery(options) {
clarkspark commented 5 years ago

fetzerch, I made the change above manually in the file located in (for me): /var/lib/grafana/plugins/fetzerch-sunandmoon-datasource/src/datasource.js and a similiar change in: /var/lib/grafana/plugins/fetzerch-sunandmoon-datasource/dist/src/datasource.js

and it did not seem to allievate the issue. I'm not sure that it should have, but thought I'd let you know.

Thanks

fetzerch commented 5 years ago

Can you try with the dist directory of the current github master? The dist directory gets updated by running npm run build, I'm not sure if patching that file manually works.

I've tried the change here where I could reproduce the issue without the patch.

clarkspark commented 5 years ago

Fetzerch, I deleted my /var/lib/grafana/plugins/grafana-sunandmoon-datasource dir and replaced it with the a clone of https://github.com/fetzerch/grafana-sunandmoon-datasource.git and confirmed that your patch resolved the issue. Sorry if I wasted your time and you shouldn't feel an paticular pressure to release a new version release which addresses the issue as I'm not sure when 6.3 will be released. Thanks.

fetzerch commented 5 years ago

Thanks for the confirmation. No worries, there are a few more fixes for the 0.1.5 release and I had that on my todo list for a while. The official grafana plugin repo should hopefully get updated with the new version in a couple of days.