Skip to content

Commit

Permalink
feat: redirect to workspace overview page after created success (open…
Browse files Browse the repository at this point in the history
…search-project#29)

Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam authored and SuZhou-Joe committed Jul 19, 2023
1 parent 9bca794 commit dafcf39
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@osd/i18n';
import { useOpenSearchDashboards } from '../../../../../plugins/opensearch_dashboards_react/public';

import { WorkspaceForm, WorkspaceFormData } from './workspace_form';
import { WORKSPACE_OP_TYPE_CREATE } from '../../../common/constants';
import { PATHS, WORKSPACE_APP_ID, WORKSPACE_OP_TYPE_CREATE } from '../../../common/constants';

export const WorkspaceCreator = () => {
const {
Expand All @@ -37,6 +37,15 @@ export const WorkspaceCreator = () => {
defaultMessage: 'Create workspace successfully',
}),
});
if (application && workspaces) {
window.location.href = workspaces.formatUrlWithWorkspaceId(
application.getUrlForApp(WORKSPACE_APP_ID, {
path: PATHS.overview,
absolute: true,
}),
result.result.id
);
}
return;
}
notifications?.toasts.addDanger({
Expand All @@ -46,7 +55,7 @@ export const WorkspaceCreator = () => {
text: result?.error,
});
},
[notifications?.toasts, workspaces?.client]
[notifications?.toasts, workspaces, application]
);

return (
Expand Down

0 comments on commit dafcf39

Please sign in to comment.