DataSourceSrv: include alias in type filter (#104308)

This commit is contained in:
Ryan McKinley
2025-04-22 21:34:56 +03:00
committed by GitHub
parent 4b1fa81394
commit 82332819ef
2 changed files with 14 additions and 26 deletions
@@ -29,10 +29,7 @@
"liveNow": false,
"panels": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"fieldConfig": {
"defaults": {
"color": {
@@ -110,10 +107,7 @@
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"description": "Should be smaller given the longer value",
"fieldConfig": {
"defaults": {
@@ -193,10 +187,7 @@
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"fieldConfig": {
"defaults": {
"color": {
@@ -274,10 +265,7 @@
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"fieldConfig": {
"defaults": {
"color": {
@@ -436,10 +424,7 @@
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"fieldConfig": {
"defaults": {
"color": {
@@ -518,10 +503,7 @@
"type": "barchart"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"datasource": { "type": "testdata" },
"description": "",
"fieldConfig": {
"defaults": {
@@ -259,8 +259,14 @@ export class DatasourceSrv implements DataSourceService {
if (filters.filter && !filters.filter(x)) {
return false;
}
if (filters.type && (Array.isArray(filters.type) ? !filters.type.includes(x.type) : filters.type !== x.type)) {
return false;
if (filters.type) {
if (Array.isArray(filters.type)) {
if (!filters.type.includes(x.type)) {
return false;
}
} else if (!(x.type === filters.type || x.meta.aliasIDs?.includes(filters.type!))) {
return false;
}
}
if (
!filters.all &&