mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Fix datasource selector being empty with single datasource
- The "missing" action was triggered unless the number of datasource >1 🤦
- Made datasource preselection more robust in case the requested datasource is already gone
This commit is contained in:
parent
af8425da08
commit
648a775acb
@ -161,11 +161,17 @@ export function initializeExplore(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (exploreDatasources.length > 1) {
|
if (exploreDatasources.length >= 1) {
|
||||||
let instance;
|
let instance;
|
||||||
if (datasource) {
|
if (datasource) {
|
||||||
instance = await getDatasourceSrv().get(datasource);
|
try {
|
||||||
} else {
|
instance = await getDatasourceSrv().get(datasource);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Checking on instance here because requested datasource could be deleted already
|
||||||
|
if (!instance) {
|
||||||
instance = await getDatasourceSrv().get();
|
instance = await getDatasourceSrv().get();
|
||||||
}
|
}
|
||||||
dispatch(loadDatasource(exploreId, instance));
|
dispatch(loadDatasource(exploreId, instance));
|
||||||
|
Loading…
Reference in New Issue
Block a user