mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
only display scan button if there is at least one existing selector that returned an empty result
This commit is contained in:
@@ -133,7 +133,12 @@ export function ensureQueries(queries?: DataQuery[]): DataQuery[] {
|
||||
* A target is non-empty when it has keys other than refId and key.
|
||||
*/
|
||||
export function hasNonEmptyQuery(queries: DataQuery[]): boolean {
|
||||
return queries.some(query => Object.keys(query).length > 2);
|
||||
return queries.some(
|
||||
query =>
|
||||
Object.keys(query)
|
||||
.map(k => query[k])
|
||||
.filter(v => v).length > 2
|
||||
);
|
||||
}
|
||||
|
||||
export function calculateResultsFromQueryTransactions(
|
||||
@@ -148,15 +153,17 @@ export function calculateResultsFromQueryTransactions(
|
||||
new TableModel(),
|
||||
...queryTransactions.filter(qt => qt.resultType === 'Table' && qt.done && qt.result).map(qt => qt.result)
|
||||
);
|
||||
const logsResult =
|
||||
datasource && datasource.mergeStreams
|
||||
const logsResult = {
|
||||
...datasource && datasource.mergeStreams
|
||||
? datasource.mergeStreams(
|
||||
_.flatten(
|
||||
queryTransactions.filter(qt => qt.resultType === 'Logs' && qt.done && qt.result).map(qt => qt.result)
|
||||
),
|
||||
graphInterval
|
||||
)
|
||||
: undefined;
|
||||
: undefined,
|
||||
queryEmpty: queryTransactions.filter(qt => qt.resultType === 'Logs' && qt.done).every(qt => qt.result.length === 0),
|
||||
};
|
||||
|
||||
return {
|
||||
graphResult,
|
||||
|
||||
Reference in New Issue
Block a user