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:
Leo 2022-08-10 15:30:00 +02:00 committed by GitHub
parent 07681a737d
commit 4926767737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -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}\}`;

View File

@ -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';