Merge pull request #14928 from grafana/davkal/14926-loki-missing

Explore: Fix datasource selector being empty with single datasource
This commit is contained in:
David 2019-01-17 14:49:55 +01:00 committed by GitHub
commit 6f6c4652dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,11 +161,17 @@ export function initializeExplore(
},
});
if (exploreDatasources.length > 1) {
if (exploreDatasources.length >= 1) {
let instance;
if (datasource) {
instance = await getDatasourceSrv().get(datasource);
} else {
try {
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();
}
dispatch(loadDatasource(exploreId, instance));