From 26d7065dc34039c131692ea19d5ae46cc3d19d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Thu, 7 Mar 2024 17:04:36 +0000 Subject: [PATCH] chore: add actions warning to delete project (#6467) https://linear.app/unleash/issue/2-1831/what-happens-with-automated-actions-if-the-project-is-archived Adds an actions-related warning to the project deletion. image --- .../Settings/DeleteProject.tsx | 49 ++++++++++++++----- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx index 6fa9aebc9f..6577636de9 100644 --- a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx @@ -4,18 +4,17 @@ import PermissionButton from 'component/common/PermissionButton/PermissionButton import { DeleteProjectDialogue } from '../../DeleteProject/DeleteProjectDialogue'; import { useState } from 'react'; import { useNavigate } from 'react-router'; +import { useUiFlag } from 'hooks/useUiFlag'; +import { useActions } from 'hooks/api/getters/useActions/useActions'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; const StyledContainer = styled('div')(({ theme }) => ({ + display: 'flex', + flexDirection: 'column', borderTop: `1px solid ${theme.palette.divider}`, -})); - -const StyledTitle = styled('div')(({ theme }) => ({ paddingTop: theme.spacing(4), - lineHeight: 2, -})); - -const StyledCounter = styled('div')(({ theme }) => ({ - paddingTop: theme.spacing(3), + gap: theme.spacing(2), })); const StyledButtonContainer = styled('div')(({ theme }) => ({ @@ -33,21 +32,45 @@ export const DeleteProject = ({ projectId, featureCount, }: IDeleteProjectProps) => { + const { isEnterprise } = useUiConfig(); + const automatedActionsEnabled = useUiFlag('automatedActions'); + const { actions } = useActions(projectId); const [showDelDialog, setShowDelDialog] = useState(false); const navigate = useNavigate(); return ( - Delete project -
+

Before you can delete a project, you must first archive all the feature toggles associated with it. Keep in mind that deleting a project will permanently remove all the archived feature toggles, and they cannot be recovered once deleted. -

- +

+ + Additionally, all configured actions for this project + will no longer be executed as they will be permanently + deleted. +

+ } + /> +

Currently there are{' '} {featureCount} feature toggles active - +

+ + Currently there are{' '} + + {actions.filter(({ enabled }) => enabled).length}{' '} + enabled actions + +

+ } + />