From 93b1e4438f33d29947ebd647d13a9503a89ea80f Mon Sep 17 00:00:00 2001 From: Yuye Zhu Date: Tue, 19 Sep 2023 07:42:32 +0800 Subject: [PATCH] remove exit workspace logic (#179) Signed-off-by: yuye-aws --- .../workspace_updater/workspace_updater.tsx | 36 ------------------- .../workspace/public/workspace_client.ts | 8 ----- 2 files changed, 44 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx b/src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx index ad44a15a7675..e0681d8a62b1 100644 --- a/src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx +++ b/src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx @@ -151,41 +151,6 @@ 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 ( @@ -193,7 +158,6 @@ export const WorkspaceUpdater = () => { restrictWidth pageTitle="Update Workspace" rightSideItems={[ - Exit, setDeleteWorkspaceModalVisible(true)}> Delete , diff --git a/src/plugins/workspace/public/workspace_client.ts b/src/plugins/workspace/public/workspace_client.ts index 60adc80a3d26..7302a9a63f1c 100644 --- a/src/plugins/workspace/public/workspace_client.ts +++ b/src/plugins/workspace/public/workspace_client.ts @@ -128,14 +128,6 @@ export class WorkspaceClient { } } - public async exitWorkspace(): Promise> { - this.workspaces.currentWorkspaceId$.next(''); - return { - success: true, - result: null, - }; - } - public async getCurrentWorkspaceId(): Promise> { const currentWorkspaceId = this.workspaces.currentWorkspaceId$.getValue(); if (!currentWorkspaceId) {