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

Textbox variable: Option to supply value when set to empty #13751

Open
davewat opened this issue Oct 18, 2018 · 11 comments
Open

Textbox variable: Option to supply value when set to empty #13751

davewat opened this issue Oct 18, 2018 · 11 comments

Comments

@davewat
Copy link
Contributor

davewat commented Oct 18, 2018

Please include this information:

What Grafana version are you using? 5.3.1

What datasource are you using? Elasticsearch

What OS are you running grafana on? CentOS 7.4

What did you do? Empty Textbox for Lucene query

What was the expected result? Returns all results

What happened instead? Returns nothing

We are using the new Textbox template variable to create Lucene queries for Elasticsearch. We supply a default value, however, if a user then deletes the value, the query submitted will be an empty query. Would be useful if there was an option to supply an "on empty" value, that will be the default query if the user clears the text box, as the average user may not know the result of the empty set query (zero results). Would also be useful to have an option to show or hide the "on empty" value to the user, based on preference of the dashboard creator. This may have uses outside of Textbox and Elasticsearch/ Lucene as well.

textbox_new_1

@davewat
Copy link
Contributor Author

davewat commented Oct 19, 2018

Adding additional screenshots of functionality:
1- Without this change, or with the "Empty Value" disabled, if the user clears the TextBox the Lucene query is passed "empty" which results in zero results. The user would expect to get all results instead.
2- With the empty value set to "*" (useful for Lucene but could be something else depending on use case), the value of * is sent, and results in all fields. More technical users preferred this.
3 - With the View Empty Value also checked, when the field is cleared, the default empty value is also shown, to indicate what is was changed to, to aid some users understanding.

empty_disabled

empty_hidden

empty_shown

@davewat
Copy link
Contributor Author

davewat commented Oct 19, 2018

View of updated form:

show_value_updated

@davewat
Copy link
Contributor Author

davewat commented Nov 20, 2018

@marefr Might we see this in 5.4 beta? Thanks.
#13752

@marefr
Copy link
Member

marefr commented Nov 20, 2018

@davewat v5.4.0-beta1 is already out. Unfortunately this will have to wait until we have time to review it properly.

@hugohaggmark
Copy link
Contributor

I think this is still a valid feature request that shouldn't be very hard to add.

@avlitman
Copy link

avlitman commented Jan 22, 2021

For me as a user it’s very critical.. It’s breaks the panel. are you planing to
fix it ? I can see a lot of users notice this issue.. this bug from 2018 and still a lot of users hit this issue.
it will be very appreciated if you can fix this important issue.
Also can be a good solution to add a flag that when empty convert to null.
Thank you !

@VladislavYak
Copy link

+1

@hugohaggmark
Copy link
Contributor

@pkolyvas adding you to this as well

@tommysitehost
Copy link

This is very useful feature that would increase usability for textbox variable.

@aminabromand
Copy link

current possible workaround:
use a regex query:
my_metric{ my_field=~".*$mytextbox.*" }

if mytextbox is empty the regex will look like .*.* and thus match everything.

Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

@github-actions github-actions bot added the stale Issue with no recent activity label Mar 16, 2024
@dprokop dprokop changed the title Feat - Textbox - Option to supply value when set to empty Textbox variable: Option to supply value when set to empty Mar 25, 2024
@grafanabot grafanabot added the team/grafana-dashboards Dashboards squad label Mar 25, 2024
@github-actions github-actions bot removed the stale Issue with no recent activity label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📝 Backlog
Development

No branches or pull requests

8 participants