diff --git a/packages/playground/src/utils/delete_deployment.ts b/packages/playground/src/utils/delete_deployment.ts index 44e37d1654..11ef548762 100644 --- a/packages/playground/src/utils/delete_deployment.ts +++ b/packages/playground/src/utils/delete_deployment.ts @@ -12,6 +12,7 @@ export interface DeleteDeploymentOptions { projectName: ProjectName; ip?: string[]; k8s?: boolean; + isCaprover?: boolean; } export async function deleteDeployment(grid: GridClient, options: DeleteDeploymentOptions) { @@ -49,8 +50,8 @@ export async function deleteDeployment(grid: GridClient, options: DeleteDeployme } return grid.k8s.delete({ name: options.name }); } - - if (options.deploymentName) { + // if Caprover deployment should handled by machines.delete + if (options.deploymentName && !options.isCaprover) { return grid.machines.delete_machine({ deployment_name: options.deploymentName, name: options.name }); } diff --git a/packages/playground/src/weblets/tf_deployment_list.vue b/packages/playground/src/weblets/tf_deployment_list.vue index 4d443536a8..6898d34d7b 100644 --- a/packages/playground/src/weblets/tf_deployment_list.vue +++ b/packages/playground/src/weblets/tf_deployment_list.vue @@ -510,11 +510,6 @@ async function onDelete(k8s = false) { try { const projectNameLower = props.projectName?.toLowerCase(); const allSelectedItems = [...selectedItems.value]; - selectedItems.value.forEach(item => { - if (item.projectName?.toLowerCase().includes(ProjectName.Caprover.toLowerCase()) && item.workers) { - allSelectedItems.push(...item.workers); - } - }); await allSelectedItems.reduce(async (acc, item) => { await acc; @@ -531,6 +526,7 @@ async function onDelete(k8s = false) { projectName: item.projectName, ip: getDeploymentIps(item), k8s, + isCaprover: item.projectName?.toLowerCase().includes(ProjectName.Caprover.toLowerCase()), }); } } catch (e: any) {