mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #14408 from grafana/davkal/fix-14407
Explore: Hide scanning again after result was found
This commit is contained in:
commit
a9fc77b411
@ -675,7 +675,8 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState(state => {
|
this.setState(state => {
|
||||||
const { history, queryTransactions, scanning } = state;
|
const { history, queryTransactions } = state;
|
||||||
|
let { scanning } = state;
|
||||||
|
|
||||||
// Transaction might have been discarded
|
// Transaction might have been discarded
|
||||||
const transaction = queryTransactions.find(qt => qt.id === transactionId);
|
const transaction = queryTransactions.find(qt => qt.id === transactionId);
|
||||||
@ -712,15 +713,21 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|||||||
const nextHistory = updateHistory(history, datasourceId, queries);
|
const nextHistory = updateHistory(history, datasourceId, queries);
|
||||||
|
|
||||||
// Keep scanning for results if this was the last scanning transaction
|
// Keep scanning for results if this was the last scanning transaction
|
||||||
if (_.size(result) === 0 && scanning) {
|
if (scanning) {
|
||||||
const other = nextQueryTransactions.find(qt => qt.scanning && !qt.done);
|
if (_.size(result) === 0) {
|
||||||
if (!other) {
|
const other = nextQueryTransactions.find(qt => qt.scanning && !qt.done);
|
||||||
this.scanTimer = setTimeout(this.scanPreviousRange, 1000);
|
if (!other) {
|
||||||
|
this.scanTimer = setTimeout(this.scanPreviousRange, 1000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// We can stop scanning if we have a result
|
||||||
|
scanning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...results,
|
...results,
|
||||||
|
scanning,
|
||||||
history: nextHistory,
|
history: nextHistory,
|
||||||
queryTransactions: nextQueryTransactions,
|
queryTransactions: nextQueryTransactions,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user