Commit 2bb46847 by Ryan McKinley Committed by GitHub

DataSource: don't filter hidden queries automatically (#20088)

parent e940edc7
...@@ -109,13 +109,6 @@ export interface DataSourcePluginMeta extends PluginMeta { ...@@ -109,13 +109,6 @@ export interface DataSourcePluginMeta extends PluginMeta {
queryOptions?: PluginMetaQueryOptions; queryOptions?: PluginMetaQueryOptions;
sort?: number; sort?: number;
streaming?: boolean; streaming?: boolean;
/**
* By default, hidden queries are not passed to the datasource
* Set this to true in plugin.json to have hidden queries passed to the
* DataSource query method
*/
hiddenQueries?: boolean;
} }
interface PluginMetaQueryOptions { interface PluginMetaQueryOptions {
......
...@@ -31,7 +31,6 @@ type DataSourcePlugin struct { ...@@ -31,7 +31,6 @@ type DataSourcePlugin struct {
Alerting bool `json:"alerting"` Alerting bool `json:"alerting"`
Explore bool `json:"explore"` Explore bool `json:"explore"`
Table bool `json:"tables"` Table bool `json:"tables"`
HiddenQueries bool `json:"hiddenQueries"`
Logs bool `json:"logs"` Logs bool `json:"logs"`
QueryOptions map[string]bool `json:"queryOptions,omitempty"` QueryOptions map[string]bool `json:"queryOptions,omitempty"`
BuiltIn bool `json:"builtIn,omitempty"` BuiltIn bool `json:"builtIn,omitempty"`
......
...@@ -118,10 +118,6 @@ export class PanelQueryRunner { ...@@ -118,10 +118,6 @@ export class PanelQueryRunner {
try { try {
const ds = await getDataSource(datasource, request.scopedVars); const ds = await getDataSource(datasource, request.scopedVars);
if (ds.meta && !ds.meta.hiddenQueries) {
request.targets = request.targets.filter(q => !q.hide);
}
// Attach the datasource name to each query // Attach the datasource name to each query
request.targets = request.targets.map(query => { request.targets = request.targets.map(query => {
if (!query.datasource) { if (!query.datasource) {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
"id": "cloudwatch", "id": "cloudwatch",
"category": "cloud", "category": "cloud",
"hiddenQueries": true,
"metrics": true, "metrics": true,
"alerting": true, "alerting": true,
"annotations": true, "annotations": true,
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"includes": [{ "type": "dashboard", "name": "Graphite Carbon Metrics", "path": "dashboards/carbon_metrics.json" }], "includes": [{ "type": "dashboard", "name": "Graphite Carbon Metrics", "path": "dashboards/carbon_metrics.json" }],
"hiddenQueries": true,
"metrics": true, "metrics": true,
"alerting": true, "alerting": true,
"annotations": true, "annotations": true,
......
...@@ -49,6 +49,9 @@ export class InputDatasource extends DataSourceApi<InputQuery, InputOptions> { ...@@ -49,6 +49,9 @@ export class InputDatasource extends DataSourceApi<InputQuery, InputOptions> {
query(options: DataQueryRequest<InputQuery>): Promise<DataQueryResponse> { query(options: DataQueryRequest<InputQuery>): Promise<DataQueryResponse> {
const results: DataFrame[] = []; const results: DataFrame[] = [];
for (const query of options.targets) { for (const query of options.targets) {
if (query.hide) {
continue;
}
let data = this.data; let data = this.data;
if (query.data) { if (query.data) {
data = query.data.map(v => toDataFrame(v)); data = query.data.map(v => toDataFrame(v));
......
...@@ -37,13 +37,6 @@ export class MixedDatasource extends DataSourceApi<DataQuery> { ...@@ -37,13 +37,6 @@ export class MixedDatasource extends DataSourceApi<DataQuery> {
mergeMap((dataSourceApi: DataSourceApi) => { mergeMap((dataSourceApi: DataSourceApi) => {
const datasourceRequest = cloneDeep(request); const datasourceRequest = cloneDeep(request);
// Remove any unused hidden queries
let newTargets = targets.slice();
if (!dataSourceApi.meta.hiddenQueries) {
newTargets = newTargets.filter((t: DataQuery) => !t.hide);
}
datasourceRequest.targets = newTargets;
datasourceRequest.requestId = `${dsName}${datasourceRequest.requestId || ''}`; datasourceRequest.requestId = `${dsName}${datasourceRequest.requestId || ''}`;
// all queries hidden return empty result for for this requestId // all queries hidden return empty result for for this requestId
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"builtIn": true, "builtIn": true,
"mixed": true, "mixed": true,
"metrics": true, "metrics": true,
"hiddenQueries": true,
"queryOptions": { "queryOptions": {
"minInterval": true "minInterval": true
......
...@@ -27,6 +27,9 @@ export class TestDataDataSource extends DataSourceApi<TestDataQuery> { ...@@ -27,6 +27,9 @@ export class TestDataDataSource extends DataSourceApi<TestDataQuery> {
// Start streams and prepare queries // Start streams and prepare queries
for (const target of options.targets) { for (const target of options.targets) {
if (target.hide) {
continue;
}
if (target.scenarioId === 'streaming_client') { if (target.scenarioId === 'streaming_client') {
streams.push(runStream(target, options)); streams.push(runStream(target, options));
} else { } else {
......
...@@ -5821,6 +5821,11 @@ caniuse-api@^3.0.0: ...@@ -5821,6 +5821,11 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2" lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0" lodash.uniq "^4.5.0"
caniuse-db@1.0.30000772:
version "1.0.30000772"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000772.tgz#51aae891768286eade4a3d8319ea76d6a01b512b"
integrity sha1-UarokXaChureSj2DGep21qAbUSs=
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000939, caniuse-lite@^1.0.30000947, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000999: caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000939, caniuse-lite@^1.0.30000947, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000999:
version "1.0.30000999" version "1.0.30000999"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment