Skip to content

Commit 6024e9a

Browse files
wanglamruanyl
authored andcommitted
feat: redirect to overview page after workspace switch (opensearch-project#26)
Signed-off-by: Lin Wang <wonglam@amazon.com>
1 parent b56117d commit 6024e9a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/plugins/workspace/public/containers/workspace_dropdown_list/workspace_dropdown_list.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,19 @@ export function WorkspaceDropdownList(props: WorkspaceDropdownListProps) {
5757
/** switch the workspace */
5858
setLoading(true);
5959
const id = workspaceOption[0].key!;
60-
const newUrl = coreStart.workspaces?.formatUrlWithWorkspaceId(window.location.href, id);
60+
const newUrl = coreStart.workspaces?.formatUrlWithWorkspaceId(
61+
coreStart.application.getUrlForApp(WORKSPACE_APP_ID, {
62+
path: PATHS.overview,
63+
absolute: true,
64+
}),
65+
id
66+
);
6167
if (newUrl) {
6268
window.location.href = newUrl;
6369
}
6470
setLoading(false);
6571
},
66-
[coreStart.workspaces]
72+
[coreStart.workspaces, coreStart.application]
6773
);
6874

6975
const onCreateWorkspaceClick = () => {

0 commit comments

Comments
 (0)