ryantxu / ajax-panel

Ajax Panel Plugin for Grafana
MIT License
153 stars 154 forks source link

Incompatible with Grafana version 6.7.1 - Uncaught (in promise) TypeError: e.headers is not a function #60

Open GlennMatthys opened 4 years ago

GlennMatthys commented 4 years ago

After upgrading Grafana to version 6.7.1, this panel no longer works, the following error is logged in the browser's console:

module.js:16 Uncaught (in promise) TypeError: e.headers is not a function
    at t.process (module.js:16)
    at eval (module.js:16)

image

Panel configuration: image

Grafana version: 6.7.1 Browser: Chrome 80.0.3987.162 (Official Build) (64-bit)

RedShift1 commented 4 years ago

@ryantxu can you please have a look at this?

blacklight commented 4 years ago

My two cents

juancarlosm commented 4 years ago

There is also a missing this.$scope.$digest(); after call to backendSvr, without this call some panels didn't get updated before scroll down

See grafana CHANGELOG

6.7.0-beta1 (2020-03-12) Breaking changes

Notice about changes in backendSrv for plugin authors In our mission to migrate away from AngularJS to React we have removed all AngularJS dependencies in the core data retrieval service backendSrv.

Removing the AngularJS dependencies in backendSrv has the unfortunate side effect of AngularJS digest no longer being triggered for any request made with backendSrv. Because of this, external plugins using backendSrv directly may suffer from strange behaviour in the UI.

To remedy this issue, as a plugin author you need to trigger the digest after a direct call to backendSrv.

Example:

(backendSrv.get(‘http://your.url/api’).then(result => {
    this.result = result;
    this.$scope.$digest();
});)

Another unfortunate outcome from this work in backendSrv is that the response format for .headers() changed from a function to an object.

jayden-xie commented 4 years ago

I upgraded to Grafana 7 recently, and find the Ajax plugin does not work sometimes (If you scroll down to the panel you can find it refreshing...), when you open the dashboard, the ajax panel does not load, and no error found in console log. And when you click refresh button of the dashboard on the right top, the ajax panel fails to refresh sometimes.