Skip to content
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

LeafLet.js not working with dynamicText Panel #223

Closed
samant-rags opened this issue Oct 22, 2023 · 16 comments · Fixed by #231
Closed

LeafLet.js not working with dynamicText Panel #223

samant-rags opened this issue Oct 22, 2023 · 16 comments · Fixed by #231
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@samant-rags
Copy link

getting L is underfined similar to this issue.
The resolution in the issue was to sequence the loading of script files.
Not sure how can we do the same in dynamicText Panel

https://stackoverflow.com/questions/44479562/l-is-not-defined-error-with-leaflet

@mikhail-vl mikhail-vl self-assigned this Oct 23, 2023
@mikhail-vl mikhail-vl added the question Further information is requested label Oct 23, 2023
@asimonok
Copy link
Collaborator

@samant-rags external scripts are loaded in the passed order but they don't work in edit panel mode. You have to open dashboard first to see loaded scripts and then open the edit panel mode. Also the lib requires rendered dom element so the initialization code should be added in After Render Code when it's ready - #231

@mikhail-vl mikhail-vl added enhancement New feature or request and removed question Further information is requested labels Nov 19, 2023
@mikhail-vl mikhail-vl added this to the Version 4.2.0 milestone Nov 19, 2023
@samant-rags
Copy link
Author

@samant-rags external scripts are loaded in the passed order but they don't work in edit panel mode. You have to open dashboard first to see loaded scripts and then open the edit panel mode. Also the lib requires rendered dom element so the initialization code should be added in After Render Code when it's ready - #231

Thanks a lot @asimonok @mikhail-vl
this works now with v4.2 with the new feature of Js code after content ready feature !!

@mikhail-vl
Copy link
Member

@samant-rags Thank you for confirming!

@mikhail-vl mikhail-vl reopened this Jan 8, 2024
@samant-rags
Copy link
Author

Seems like dynamicText Panel on Grafana 10.3 the External Scripts feature is missing ?

image

@samant-rags
Copy link
Author

Apologies guess i forgot to do this ...

image

@mikhail-vl
Copy link
Member

mikhail-vl commented Jan 11, 2024

Yes, disabling sanitizing is important and required from security considerations.

@yosiasz
Copy link

yosiasz commented Feb 20, 2024

@samant-rags you have this working? Can you share how you did it please? I am still getting that error in latest. thanks!

@samant-rags
Copy link
Author

hi @yosiasz yes this worked , hope you have disabled by setting below property in conf/custom.ini or default.ini
disable_sanitize_html = true

image

@yosiasz
Copy link

yosiasz commented Feb 21, 2024

Are you able to share js code?

@samant-rags
Copy link
Author

samant-rags commented Feb 22, 2024 via email

@yosiasz
Copy link

yosiasz commented Feb 22, 2024

Thanks so much @samant-rags

@yosiasz
Copy link

yosiasz commented Feb 22, 2024

@samant-rags and which version of leaflet solved the issue with L

Did you do something like this?

//const L = window.L
var L = window.L;

@samant-rags
Copy link
Author

samant-rags commented Feb 23, 2024 via email

@mikhail-vl
Copy link
Member

@samant-rags @yosiasz Thank you for providing examples. We included it in the documentation: https://volkovlabs.io/plugins/volkovlabs-dynamictext-panel/external/#leafletjs-interactive-maps

@yosiasz
Copy link

yosiasz commented Feb 26, 2024

Yaay!! Not seeing it there yet. probably coming once build pipeline finishes

@mikhail-vl
Copy link
Member

Yaay!! Not seeing it there yet. probably coming once build pipeline finishes

It's deployed, try to refresh to load updated content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
4 participants