From 13fdc51ec8c745f888de012ba703caae8874bb82 Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Mon, 13 Nov 2023 15:03:18 +0800 Subject: [PATCH] fix(console): allow dev tenant deletion (#4869) --- .../TenantSettings/TenantBasicSettings/index.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx b/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx index c160bc83d..8705ad82c 100644 --- a/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx +++ b/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx @@ -31,8 +31,14 @@ const tenantProfileToForm = (tenant?: TenantResponse): TenantSettingsForm => { function TenantBasicSettings() { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const api = useCloudApi(); - const { currentTenant, currentTenantId, updateTenant, removeTenant, navigateTenant } = - useContext(TenantsContext); + const { + currentTenant, + currentTenantId, + isDevTenant, + updateTenant, + removeTenant, + navigateTenant, + } = useContext(TenantsContext); const [isDeletionModalOpen, setIsDeletionModalOpen] = useState(false); const [isDeleting, setIsDeleting] = useState(false); const { show: showModal } = useConfirmModal(); @@ -76,8 +82,9 @@ function TenantBasicSettings() { const onClickDeletionButton = async () => { if ( - currentTenant?.subscription.planId !== ReservedPlanId.free || - currentTenant.openInvoices.length > 0 + !isDevTenant && + (currentTenant?.subscription.planId !== ReservedPlanId.free || + currentTenant.openInvoices.length > 0) ) { await showModal({ title: 'tenants.delete_modal.cannot_delete_title',