Skip to content

feat(dashboard variables): allow custom values#606

Open
github-vincent-miszczak wants to merge 5 commits intoVictoriaMetrics:mainfrom
github-vincent-miszczak:dashboard_var_custom_value
Open

feat(dashboard variables): allow custom values#606
github-vincent-miszczak wants to merge 5 commits intoVictoriaMetrics:mainfrom
github-vincent-miszczak:dashboard_var_custom_value

Conversation

@github-vincent-miszczak
Copy link
Copy Markdown

@github-vincent-miszczak github-vincent-miszczak commented Mar 10, 2026

When working with dashboard variables, fields do not necessarily exist at the time of creation/manipulation(when importing a dashboard from JSON for instance, then editing a variable).

This feature keeps the existing behavior, but also allows custom values from user or JSON.

image image

Summary by cubic

Enable custom field names in the dashboard variable editor so variables work even when the field doesn’t exist yet (e.g., after importing from JSON). Replaces the field dropdown with a CompatibleCombobox that supports freeform entries and better loading UX.

  • New Features
    • Switched to CompatibleCombobox (wrapper around @grafana/ui Combobox) with custom values via createCustomValue/onCreateOption.
    • Improved UX: "Select field" placeholder, empty -> null, loading via loading, keeps listing fetched fields, forwards onBlur.
    • On field change (selected or custom), immediately calls onChange with updated type, field, query, and limit.
    • Normalized fieldNames to { value, label, description? }; updated CHANGELOG.

Written for commit f06426c. Summary will update on new commits.

@github-vincent-miszczak github-vincent-miszczak marked this pull request as ready for review March 10, 2026 20:30
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown
Member

@arturminchukov arturminchukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! Overall looks good. Left a few comments.

Comment thread src/components/VariableQueryEditor/VariableQueryEditor.tsx Outdated
Comment thread src/components/VariableQueryEditor/VariableQueryEditor.tsx Outdated
@github-vincent-miszczak
Copy link
Copy Markdown
Author

@arturminchukov , thank you very much for the review.
I made changes following the comments, let me know if anything else needs adjustment.

@arturminchukov arturminchukov self-requested a review March 26, 2026 08:32
@arturminchukov arturminchukov self-assigned this Mar 26, 2026
@arturminchukov
Copy link
Copy Markdown
Member

arturminchukov commented Mar 30, 2026

I've tested it locally. Looks like it doesn't work as expected and do not change the value in Combobox, because Grafana's Combobox do not call onBlur. I created a pr to the Grafana to fix it - grafana/grafana#121179.

Maybe you can change to deprecated Select right now. It should work.
Another option it remove onBlur handle and use onChange.
Could you please fix lint errors?

@arturminchukov arturminchukov added enhancement New feature or request vl-datasource labels Mar 31, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 21 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/language_provider.ts">

<violation number="1" location="src/language_provider.ts:112">
P2: getStreamFieldList ignores fieldValueFilter, so stream field value searches won’t be server-side filtered (unlike getFieldList), causing unfiltered/large results and broken search behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread src/language_provider.ts
@github-vincent-miszczak
Copy link
Copy Markdown
Author

@arturminchukov my update using CompatibleCombobox broke the feature. I restored using onChange looks better now.

Copy link
Copy Markdown
Member

@arturminchukov arturminchukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for contributing!

@arturminchukov
Copy link
Copy Markdown
Member

arturminchukov commented Apr 14, 2026

@github-vincent-miszczak Could you please sign your commits? Here, you can find a guide on how to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request vl-datasource

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants