ajax-panel icon indicating copy to clipboard operation
ajax-panel copied to clipboard

Panels not updating

Open sebastiaopf opened this issue 5 years ago • 4 comments

I have an AJAX Panel reading from an API, configured to get the results as JSON and display using angular templates.

Everything works when I'm editing the panel, but after I close and reopen the dashboard the panel is empty. It remains empty even when I refresh the dashboard.

If I edit the panel again, and change anything on the Request tab, nothing happens and the panel remains empty.

If I change anything on the display tab the panel is shown correctly, but only for a single refresh. After I close the dashboard same problem happens again.

Using plugin 0.0.5 and Grafana 5.4.0. Panel JSON below:

{
  "gridPos": {
    "h": 6,
    "w": 7,
    "x": 0,
    "y": 0
  },
  "header_js": "{}",
  "id": 2,
  "links": [],
  "method": "GET",
  "mode": "template",
  "params_js": "",
  "responseType": "json",
  "showTime": false,
  "showTimeFormat": "LTS",
  "showTimePrefix": null,
  "showTimeValue": "request",
  "skipSameURL": false,
  "template": "<h4>Repository</h4>\n<p>{{ response.snapshots[0].repository }}</p>\n\n<h4>Snapshot</h4>\n<p>{{ response.snapshots[0].snapshot }}</p>\n\n<h4>Progress</h4>\n<p><progress  value=\"{{ response.snapshots[0].stats.processed.size_in_bytes }}\" \n              max=\"{{ response.snapshots[0].stats.total.size_in_bytes }}\"\n              style=\"width: 400px;\"\n              ></progress> </p>\n",
  "templateResponse": true,
  "title": "Snapshot Progress",
  "type": "ryantxu-ajax-panel",
  "url": "http://XXXXXXXXX",
  "withCredentials": false
}

sebastiaopf avatar Jan 09 '19 19:01 sebastiaopf

+1

brjborja avatar Jan 22 '19 10:01 brjborja

Have a very similar use case, and experiencing very similar behavior. The actual API call doesn't appear to get executed unless the user (for example) goes into Edit mode for the panel.

Haven't properly dug into it, but thought I'd bring it up. Will do some more testing over the coming days and try to narrow down the conditions under which this occurs.

svet-b avatar Apr 24 '19 18:04 svet-b

After upgrading to Grafana v6, the issue does not appear to be there any longer.

Probably beside the point, but when running on Grafana v5 we were also experiencing other glitches with this plugin - such as GET parameters often not getting included in the request - so it looks like there may be more general incompatibilities with v5 (at least for v0.0.6 of the plugin).

svet-b avatar May 03 '19 09:05 svet-b

I encountered similar issue with AJAX panel talking to JFrog Artifactory REST API, where the panel seemed to only refresh and perform a GET request when the panel was in edit mode. It turned out that CORS-related header settings on the reverse proxy in front of the Artifactory server was causing the issue. Particularly, Access-Control-Allow-Headers needs to be set specifically (do not use wildcard *) for the API key I was using X-JFrog-Art-API (or for basic authentication, alternatively).

mikequentel avatar May 13 '23 15:05 mikequentel