DataSourceSrv: include alias in type filter (#104308) (#104336)

pull/104436/head
Ryan McKinley 2 months ago committed by GitHub
parent b0d42f432a
commit 584593c411
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 30
      devenv/dev-dashboards/panel-barchart/barchart-autosizing.json
  2. 8
      public/app/features/plugins/datasource_srv.ts

@ -29,10 +29,7 @@
"liveNow": false, "liveNow": false,
"panels": [ "panels": [
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -110,10 +107,7 @@
"type": "barchart" "type": "barchart"
}, },
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"description": "Should be smaller given the longer value", "description": "Should be smaller given the longer value",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -193,10 +187,7 @@
"type": "barchart" "type": "barchart"
}, },
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -274,10 +265,7 @@
"type": "barchart" "type": "barchart"
}, },
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -436,10 +424,7 @@
"type": "barchart" "type": "barchart"
}, },
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
@ -518,10 +503,7 @@
"type": "barchart" "type": "barchart"
}, },
{ {
"datasource": { "datasource": { "type": "testdata" },
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {

@ -259,9 +259,15 @@ export class DatasourceSrv implements DataSourceService {
if (filters.filter && !filters.filter(x)) { if (filters.filter && !filters.filter(x)) {
return false; return false;
} }
if (filters.type && (Array.isArray(filters.type) ? !filters.type.includes(x.type) : filters.type !== x.type)) { if (filters.type) {
if (Array.isArray(filters.type)) {
if (!filters.type.includes(x.type)) {
return false; return false;
} }
} else if (!(x.type === filters.type || x.meta.aliasIDs?.includes(filters.type!))) {
return false;
}
}
if ( if (
!filters.all && !filters.all &&
x.meta.metrics !== true && x.meta.metrics !== true &&

Loading…
Cancel
Save