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

Repurpose shared Javascript function across panels #14

Closed
addisonklinke opened this issue Aug 27, 2023 · 1 comment · Fixed by #15
Closed

Repurpose shared Javascript function across panels #14

addisonklinke opened this issue Aug 27, 2023 · 1 comment · Fixed by #15

Comments

@addisonklinke
Copy link

addisonklinke commented Aug 27, 2023

I've written a few helper functions to post-process the BQL results into the format I want for e-charts. Would it be feasible to have a separate JS file containing these that can be included in the YAML on a per-panel basis? I think this has a few benefits

  1. Reduce code duplication
  2. Allow viewing/editing JS with proper syntax highlighting
  3. Enable unit testing of JS functions (currently I add assertions to my script, but this increases runtime unnecessarily)
@andreasgerstmayr
Copy link
Owner

Yeah, I think having a dashboards.js next to the dashboards.yaml which common helper functions would be a nice addition.

Can you give #15 a try? It loads a file dashboards.js in the same directory as dashboards.yaml, and all functions declared there are accessible in every panel.

andreasgerstmayr added a commit that referenced this issue Mar 11, 2024
…l or in an external file) (#15)

* load optional shared JavaScript helper functions from dashboards.js

Resolves: #14

* improve file ext substitution method

* introduce utils script

* delete unused import

* formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants