Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable passing data source info within ISM #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading