Commit 85b0df55 by Torkel Ödegaard

Minor refactoring of testdata query order PR #16122

parent c91e5a2d
...@@ -51,25 +51,19 @@ export class TestDataDatasource implements DataSourceApi<TestDataQuery> { ...@@ -51,25 +51,19 @@ export class TestDataDatasource implements DataSourceApi<TestDataQuery> {
// Returns data in the order it was asked for. // Returns data in the order it was asked for.
// if the response has data with different refId, it is ignored // if the response has data with different refId, it is ignored
for (let i = 0; i < queries.length; i++) { for (const query of queries) {
const query = queries[i];
const results = res.data.results[query.refId]; const results = res.data.results[query.refId];
if (results) { if (!results) {
if (results.tables) {
for (const table of results.tables) {
data.push(table as TableData);
}
}
if (results.series) {
for (const series of results.series) {
data.push({
target: series.name,
datapoints: series.points,
});
}
}
} else {
console.warn('No Results for:', query); console.warn('No Results for:', query);
continue;
}
for (const table of results.tables || []) {
data.push(table as TableData);
}
for (const series of results.series || []) {
data.push({ target: series.name, datapoints: series.points });
} }
} }
......
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