diff --git a/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index 4017e85ac..454441601 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -202,7 +202,7 @@ export default class Main extends Component { dataSourceId: string; dataSourceLabel: string; }; - dataSourceId = parsedDataSourceId || ""; + dataSourceId = parsedDataSourceId; dataSourceLabel = parsedDataSourceLabel || ""; if (dataSourceId) { @@ -213,7 +213,12 @@ export default class Main extends Component { dataSourceId, dataSourceLabel, dataSourceReadOnly: false, - dataSourceLoading: props.multiDataSourceEnabled, + /** + * undefined: need data source picker to help to determine which data source to use. + * empty string: using the local cluster. + * string: using the selected data source. + */ + dataSourceLoading: dataSourceId === undefined ? props.multiDataSourceEnabled : false, }; } diff --git a/public/plugin.ts b/public/plugin.ts index 83896364d..99f25b5b4 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -24,8 +24,6 @@ import { ManagementOverViewPluginSetup } from "../../../src/plugins/management_o import { DataSourceManagementPluginSetup } from "../../../src/plugins/data_source_management/public"; import { dataSourceObservable } from "./pages/Main/Main"; import { BehaviorSubject } from "rxjs"; -import { useLocation } from "react-router-dom"; -import { DataSourceOption } from "src/plugins/data/public"; interface IndexManagementSetupDeps { managementOverview?: ManagementOverViewPluginSetup; @@ -53,19 +51,7 @@ export class IndexManagementPlugin implements Plugin { - // let url = new URL(window.location.hash); - // console.log("current url", url); - // let params = new URLSearchParams(window.location.search); - // // replace dataSourceId with the selected data source - // // let dataSourceId = params.get("dataSourceId"); - let dataSourceId = dataSourceObservable.value?.id; - console.log("updating dataSourceId", dataSourceId); - let hash = ""; - if (dataSourceId) { - hash = `#/?dataSourceId=${dataSourceId}`; - // url.searchParams.set("dataSourceId", dataSourceId); - } - console.log("updated url", `${hash}`); + const hash = `#/?dataSourceId=${dataSourceObservable.value?.id || ""}`; return { defaultPath: hash, };