-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
external js script are loaded but not recognized #190
Comments
Could you provide an example with the panel options, panel json or dashboard json? Here's how to copy the panel options https://gapit-htmlgraphics-panel.gapit.io/docs/guides/how-to-import-export/#copy-from-one-panel-to-another. |
{ |
Hmm, not sure. You could try using a bundler like https://github.com/gapitio/htmlgraphics-html-bundler-template |
I tried with bundler, but not always I was able on fix it. |
Loading external javascript within Grafana will always be tricky, especially if those scripts are placing objects on the global as new versions of Grafana or other plugins might interfere with those libraries or override them. If instead of creating script tags to load external code you use the same JS module loader Grafana uses (SystemJS) it will give back the packages objects allowing you to isolate your code from the outside world. It is worth noting that SystemJS is part of Grafana and is likely to receive updates across versions of Grafana which might require you to update your loading code. Below is an example of how this could be done based on the above
|
Using htmlgraphics panel, from grafana10.4 to 11 several js script, even loaded locally, are yes correctly loaded but then the object itself is not recognized. The problem is that this is happening with several script, pdf-lib.min.js just to name one.
You can reproduce it by loading this script https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js into the oninit section and check for the PDFLib object. It will be undefined
The text was updated successfully, but these errors were encountered: