Skip to content

Commit

Permalink
feat: redirect to overview page after workspace switch (opensearch-pr…
Browse files Browse the repository at this point in the history
…oject#26)

Signed-off-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
wanglam authored and SuZhou-Joe committed Aug 31, 2023
1 parent dfb5c28 commit 4094def
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ export function WorkspaceDropdownList(props: WorkspaceDropdownListProps) {
/** switch the workspace */
setLoading(true);
const id = workspaceOption[0].key!;
const newUrl = coreStart.workspaces?.formatUrlWithWorkspaceId(window.location.href, id);
const newUrl = coreStart.workspaces?.formatUrlWithWorkspaceId(
coreStart.application.getUrlForApp(WORKSPACE_APP_ID, {
path: PATHS.overview,
absolute: true,
}),
id
);
if (newUrl) {
window.location.href = newUrl;
}
setLoading(false);
},
[coreStart.workspaces]
[coreStart.workspaces, coreStart.application]
);

const onCreateWorkspaceClick = () => {
Expand Down

0 comments on commit 4094def

Please sign in to comment.