Skip to content

Support Grafana Template Variables - #124

Open
YKawesome wants to merge 12 commits into
mainfrom
113-support-grafana-query-template-variables
Open

Support Grafana Template Variables#124
YKawesome wants to merge 12 commits into
mainfrom
113-support-grafana-query-template-variables

Conversation

@YKawesome

@YKawesome YKawesome commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds functionality for users to create text-based variables which are substituted at runtime via Grafana to allow for more dynamic queries/dashboards.

Changes

  • TelemetryFields.tsx
    • Updates channelValues to construct new ComboboxOptions for variables
    • Adds getChannelOptionsWithVariables to remove normal channel options when variables are being used
    • Updates onChannelChange to parse custom channel constructions by matching against any component.channel pairs
    • Uses the MultiCombobox custom value/description protocol to create new options when users use variables
    • Adds visual autocomplete using infoOptions to show valid variable choices/combinations as users type
  • datasource.ts
    • Loads template variables into the query at runtime
    • Shows the Key selector when a variable query resolution results in multi-key channels
    • Updates a useEffect to add a dependency for resolved channels so that changing variable values updates the key dropdown
  • QueryEditor.test.tsx
    • Mocks @grafana/runtime using a custom getTemplateSrv stub

Screenshots

Screenshot 2026-07-21 at 3 22 15 PM Screenshot 2026-07-21 at 3 21 45 PM Screenshot 2026-07-21 at 3 12 39 PM

Notes

Warning

This feature has only been tested with Text Box variables.

Closes #113

@YKawesome YKawesome linked an issue Jul 21, 2026 that may be closed by this pull request
@YKawesome YKawesome self-assigned this Jul 21, 2026
@YKawesome
YKawesome marked this pull request as ready for review July 21, 2026 22:24
@YKawesome
YKawesome requested a review from Kronos3 July 22, 2026 17:56
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Grafana plugin dev build

A development build of the Grafana datasource plugin is available for this PR (updated on every push).

To try it, set GF_INSTALL_PLUGINS to https://github.com/nasa/hermes/releases/download/grafana-plugin-pr-124/nasa-hermes-datasource.zip;nasa-hermes-datasource.

@YKawesome
YKawesome marked this pull request as draft August 11, 2026 21:19
@YKawesome
YKawesome marked this pull request as ready for review August 12, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Grafana query template variables

1 participant