Skip to content

Commit

Permalink
remove exit workspace logic
Browse files Browse the repository at this point in the history
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
  • Loading branch information
yuye-aws committed Sep 18, 2023
1 parent 3ecaf7d commit 3b0cd24
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,49 +151,13 @@ export const WorkspaceUpdater = () => {
}
};

const exitWorkspace = async () => {
let result;
try {
result = await workspaceClient.exitWorkspace();
} catch (error) {
notifications?.toasts.addDanger({
title: i18n.translate('workspace.exit.failed', {
defaultMessage: 'Failed to exit workspace',
}),
text: error instanceof Error ? error.message : JSON.stringify(error),
});
return;
}
if (result.success) {
if (http && application) {
const homeUrl = application.getUrlForApp('home', {
path: '/',
absolute: false,
});
const targetUrl = http.basePath.prepend(http.basePath.remove(homeUrl), {
withoutWorkspace: true,
});
await application.navigateToUrl(targetUrl);
}
} else {
notifications?.toasts.addDanger({
title: i18n.translate('workspace.exit.failed', {
defaultMessage: 'Failed to exit workspace',
}),
text: result?.error,
});
return;
}
};

return (
<EuiPage paddingSize="none">
<EuiPageBody panelled>
<EuiPageHeader
restrictWidth
pageTitle="Update Workspace"
rightSideItems={[
<EuiButton onClick={exitWorkspace}>Exit</EuiButton>,
<EuiButton color="danger" onClick={() => setDeleteWorkspaceModalVisible(true)}>
Delete
</EuiButton>,
Expand Down
8 changes: 0 additions & 8 deletions src/plugins/workspace/public/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ export class WorkspaceClient {
}
}

public async exitWorkspace(): Promise<IResponse<null>> {
this.workspaces.currentWorkspaceId$.next('');
return {
success: true,
result: null,
};
}

public async getCurrentWorkspaceId(): Promise<IResponse<WorkspaceAttribute['id']>> {
const currentWorkspaceId = this.workspaces.currentWorkspaceId$.getValue();
if (!currentWorkspaceId) {
Expand Down

0 comments on commit 3b0cd24

Please sign in to comment.