Skip to content

Commit

Permalink
Merge pull request #1 from SuZhou-Joe/fix/mds-navigation-change
Browse files Browse the repository at this point in the history
feat: enable passing data source info within ISM
  • Loading branch information
CaptainDredge authored Jul 16, 2024
2 parents 0669e17 + cba65db commit 1332675
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
9 changes: 7 additions & 2 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default class Main extends Component<MainProps, MainState> {
dataSourceId: string;
dataSourceLabel: string;
};
dataSourceId = parsedDataSourceId || "";
dataSourceId = parsedDataSourceId;
dataSourceLabel = parsedDataSourceLabel || "";

if (dataSourceId) {
Expand All @@ -213,7 +213,12 @@ export default class Main extends Component<MainProps, MainState> {
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,
};
}

Expand Down
16 changes: 1 addition & 15 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,19 +51,7 @@ export class IndexManagementPlugin implements Plugin<IndexManagementPluginSetup,
}

private updateDefaultRouteOfManagementApplications: AppUpdater = () => {
// 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,
};
Expand Down

0 comments on commit 1332675

Please sign in to comment.