mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelEdit: Hide multi-/all-select datasource variables in datasource picker (#52142)
This commit is contained in:
@@ -24,7 +24,7 @@ import {
|
||||
instanceSettings as expressionInstanceSettings,
|
||||
} from 'app/features/expressions/ExpressionDatasource';
|
||||
|
||||
import { DataSourceVariableModel } from '../variables/types';
|
||||
import { isDataSource } from '../variables/guard';
|
||||
|
||||
import { importDataSourcePlugin } from './plugin_loader';
|
||||
|
||||
@@ -245,11 +245,12 @@ export class DatasourceSrv implements DataSourceService {
|
||||
});
|
||||
|
||||
if (filters.variables) {
|
||||
for (const variable of this.templateSrv.getVariables().filter((variable) => variable.type === 'datasource')) {
|
||||
const dsVar = variable as DataSourceVariableModel;
|
||||
const first = dsVar.current.value === 'default' ? this.defaultName : dsVar.current.value;
|
||||
const dsName = first as unknown as string;
|
||||
const dsSettings = this.settingsMapByName[dsName];
|
||||
for (const variable of this.templateSrv.getVariables()) {
|
||||
if (!isDataSource(variable) || variable.multi || variable.includeAll) {
|
||||
continue;
|
||||
}
|
||||
const dsName = variable.current.value === 'default' ? this.defaultName : variable.current.value;
|
||||
const dsSettings = !Array.isArray(dsName) && this.settingsMapByName[dsName];
|
||||
|
||||
if (dsSettings) {
|
||||
const key = `$\{${variable.name}\}`;
|
||||
|
Reference in New Issue
Block a user