Default none/dummy option for template variables?

Enable the Include All option for a template variable automatically makes that the default value. This can make things unusable for some dashboards since too expensive to load. Saving the template values with the dashboard is an ok workaround, but still a bit klunky in that we have to select arbitrary values that may confuse future visitors. Plus, it breaks down when the variable is populated by a templated data source: changing the data source resets the dependent variables back to All which causes the browser to catch fire.

Has anyone found a more elegant workaround? Thanks!

1 Like

Did you figure this out? I’m looking for a similar feature where it defaults to “None”. I’d like a user to choose All or specific options.

Unfortunately, I was not able to find a good solution.

I’m also looking for this feature. I will see if I can modify Grafana.

I also need the feature, that I can save my dashboard-variables with default value “None”…
Seems there is no option for this behaviour

I had the same issue. I have quite a hacky solution

In the grafana.dark..css and grafana.light..css files insert a line all at the beginning

@import utl('custom.css');

in the same folder as the grafana.dark/light css files, create a file named ‘custom.css’ (without quotes of course) In that file, enter these css rules

a[aria-label="Dashboard template variables Variable Value DropDown value link text All"] span::after,
span[aria-label="Dashboard template variables Variable Value DropDown option text All"]::after {
    content: "None";
    visibility: visible;
    Margin-left: -16px;
}
a[aria-label="Dashboard template variables Variable Value DropDown value link text All"] span,
span[aria-label="Dashboard template variables Variable Value DropDown option text All"] {
    visibility: hidden;
}

Now in the variable of the dashboard, switch on the include all option, and set the custom all value to ‘’ (two single quotes without any space) … click update and save the dashboard.

I tested this on Grafana 7.1.1 and 8.0.6 and at my installation it shows “None” instead of “All”: and my query shows " point IN(’’) " when None is selected. I am using only the mssql datasources, but this may work with other datasources as well.

NOTE: this is a hacky solution and you need to modify the default css file(s). This may also break when the html structure is updated, or another build is installed (then the css files need modification again)

Ha ha, that is quite a hack! I mean that in a positive way :clap:

1 Like

Please see:

https://localhost:3000/t/when-using-custom-template-vars-there-is-no-none-option-choosable/65/13?u=samucamarques