mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Dashboard: Reverted the changes of hiding multi-select and all variable in the datasource picker (#53521)
* REVERT PanelEdit: Hide multi-/all-select datasource variables in datasource picker, PR 52142 * user essentials mob! 🔱 lastFile:public/app/features/dashboard/dashgrid/PanelChrome.tsx * user essentials mob! 🔱 lastFile:public/app/features/dashboard/dashgrid/PanelChrome.tsx * removed todo comments Co-authored-by: polinaboneva <polina.boneva@grafana.com> Co-authored-by: Joao Silva <joao.silva@grafana.com> Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
This commit is contained in:
parent
07681a737d
commit
4926767737
@ -244,11 +244,15 @@ export class DatasourceSrv implements DataSourceService {
|
||||
|
||||
if (filters.variables) {
|
||||
for (const variable of this.templateSrv.getVariables()) {
|
||||
if (variable.type !== 'datasource' || variable.multi || variable.includeAll) {
|
||||
if (variable.type !== 'datasource') {
|
||||
continue;
|
||||
}
|
||||
const dsName = variable.current.value === 'default' ? this.defaultName : variable.current.value;
|
||||
const dsSettings = !Array.isArray(dsName) && this.settingsMapByName[dsName];
|
||||
let dsValue = variable.current.value === 'default' ? this.defaultName : variable.current.value;
|
||||
if (Array.isArray(dsValue) && dsValue.length === 1) {
|
||||
// Support for multi-value variables with only one selected datasource
|
||||
dsValue = dsValue[0];
|
||||
}
|
||||
const dsSettings = !Array.isArray(dsValue) && this.settingsMapByName[dsValue];
|
||||
|
||||
if (dsSettings) {
|
||||
const key = `$\{${variable.name}\}`;
|
||||
|
@ -25,7 +25,6 @@ import {
|
||||
VariableQueryEditorProps,
|
||||
VariableWithMultiSupport,
|
||||
VariableWithOptions,
|
||||
DataSourceVariableModel,
|
||||
} from './types';
|
||||
|
||||
/** @deprecated use a if (model.type === "query") type narrowing check instead */
|
||||
@ -43,10 +42,6 @@ export const isConstant = (model: VariableModel): model is ConstantVariableModel
|
||||
return model.type === 'constant';
|
||||
};
|
||||
|
||||
export const isDataSource = (model: VariableModel): model is DataSourceVariableModel => {
|
||||
return model.type === 'datasource';
|
||||
};
|
||||
|
||||
export const isMulti = (model: VariableModel): model is VariableWithMultiSupport => {
|
||||
const withMulti = model as VariableWithMultiSupport;
|
||||
return withMulti.hasOwnProperty('multi') && typeof withMulti.multi === 'boolean';
|
||||
|
Loading…
Reference in New Issue
Block a user