Skip to content

Commit

Permalink
[master] fix: Fix delete workspace with deleting project on workspace…
Browse files Browse the repository at this point in the history
… baseinfo page (#4389)

fix: Fix delete workspace with deleting project on workspace baseinfo page

Signed-off-by: lannyfu <[email protected]>
Co-authored-by: lannyfu <[email protected]>
  • Loading branch information
ks-ci-bot and fuchunlan authored Dec 24, 2024
1 parent 09bd2b9 commit 8d9d2eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function Workspaces(): JSX.Element {
(item: { namespace?: string; name: string }) => ({
namespace: item.namespace,
name: item.name,
deleteProject: checkkboxRef.current,
shouldDeleteResource: checkkboxRef.current,
...params,
}),
);
Expand Down Expand Up @@ -167,7 +167,7 @@ export default function Workspaces(): JSX.Element {
const deleteParams = [record].map(item => ({
namespace: item.namespace,
name: item.name,
deleteProject: checkkboxRef.current,
shouldDeleteResource: checkkboxRef.current,
...params,
}));
await workspaceStore.batchDelete(deleteParams);
Expand Down
19 changes: 6 additions & 13 deletions packages/shared/src/stores/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,14 @@ const patch = async (params: PathParams, data: Record<string, any>) => {

interface DeleteWorkspaceOptions extends PathParams {
shouldDeleteResource?: boolean;
deleteProject?: boolean;
}

const deleteWorkspace = ({
shouldDeleteResource,
deleteProject,
...params
}: DeleteWorkspaceOptions) => {
const data = !shouldDeleteResource
? {
kind: 'DeleteOptions',
apiVersion: 'v1',
propagationPolicy: deleteProject ? 'Background' : 'Orphan',
}
: {};
const deleteWorkspace = ({ shouldDeleteResource, ...params }: DeleteWorkspaceOptions) => {
const data = {
kind: 'DeleteOptions',
apiVersion: 'v1',
propagationPolicy: shouldDeleteResource ? 'Background' : 'Orphan',
};
return request.delete<never, OriginalWorkspace, Record<string, any>>(getDetailUrl(params), {
data,
});
Expand Down

0 comments on commit 8d9d2eb

Please sign in to comment.