ryantxu / ajax-panel

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

Prevent iframe refresh #16

Closed PeggyFree closed 6 years ago

PeggyFree commented 6 years ago

Hello,

Thank you for this precious plugin. I'll deal with json data later. For now I could'nt find a way to prevent grafana from refreshing the ajax/iframe panel. It makes my ajax panel unusable as is. How do you deal with this?

printer2_2018-08-27_11h25_05

ryantxu commented 6 years ago

Check that your url is not changing with every request and make sure you have the setting to only reload when the url changes

ggg

ryantxu commented 6 years ago

Wait, actually... the 'only changes' check does not apply to iframe, but changes to the URL will cause the iframe to update

PeggyFree commented 6 years ago

Thank you for your help. To be honnest I don't understand the role of the javascript parameters, I let them by default :

`{ from:ctrl.range.from.format('x'), // x is unix ms timestamp

to:ctrl.range.to.format('x'),

height:ctrl.height,

now:Date.now(),

interval: ctrl.template('$__interval'),

sample: 'Not escaped: $__interval',

since:ctrl.lastRequestTime }`

Do I need to change this code? I don't see a refresh command, but I may be wrong from the beginning. I just put a webcam url as an iframe.

ryantxu commented 6 years ago

If you don't need the parameters to change based on the page, you can remove all of them... but if that is the case, you can also just use the built-in text panel with html:

<iframe src=....
PeggyFree commented 6 years ago

Thank you for your answer, now it is perfect. Ajax was not necessary for my need, indeed. I'll use it later for other needs. I'll have to send rest calls to Octoprint soon.