From 711f4954c10e4437d34bc04d12934f494854887b Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:19:57 +0200 Subject: [PATCH 1/3] feat: update description on project deletion --- .../DeleteProject/DeleteProjectDialogue.tsx | 15 ++++- .../Settings/DeleteProject.tsx | 62 +++++++++++-------- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx b/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx index 15459ccfad5e..adfc8516d149 100644 --- a/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx +++ b/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx @@ -4,6 +4,9 @@ import { formatUnknownError } from 'utils/formatUnknownError'; import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi'; import useProjects from 'hooks/api/getters/useProjects/useProjects'; import useToast from 'hooks/useToast'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { useUiFlag } from 'hooks/useUiFlag'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IDeleteProjectDialogueProps { project: string; @@ -21,6 +24,8 @@ export const DeleteProjectDialogue = ({ const { deleteProject } = useProjectApi(); const { refetch: refetchProjectOverview } = useProjects(); const { setToastData, setToastApiError } = useToast(); + const { isEnterprise } = useUiConfig(); + const automatedActionsEnabled = useUiFlag('automatedActions'); const onClick = async (e: React.SyntheticEvent) => { e.preventDefault(); @@ -45,6 +50,14 @@ export const DeleteProjectDialogue = ({ onClick={onClick} onClose={onClose} title='Really delete project' - /> + > + This will irreversibly remove the project, all feature flags + archived in it, all API keys scoped to only this project + + . + ); }; diff --git a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx index 9802c20a2a92..1e1e56e9b23e 100644 --- a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx @@ -36,41 +36,51 @@ export const DeleteProject = ({ const automatedActionsEnabled = useUiFlag('automatedActions'); const { actions } = useActions(projectId); const [showDelDialog, setShowDelDialog] = useState(false); + const actionsCount = actions.filter(({ enabled }) => enabled).length; const navigate = useNavigate(); return ( -

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

0 || actionsCount > 0} show={ -

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

+ <> +

+ Before you can delete a project, you must first + archive all the feature flags associated with it. +

+

+ Currently there are{' '} + {featureCount} feature flags active +

+ + Currently there are{' '} + + {actionsCount} enabled actions + +

+ } + /> + } />

- Currently there are{' '} - {featureCount} feature flags active + Keep in mind that deleting a project{' '} + will permanently remove +

    +
  • all archived feature flags in this project
  • +
  • API keys configured to access only this project
  • + all actions configured for this project} + /> +
+ and they cannot be recovered once deleted.

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

- } - /> Date: Thu, 4 Jul 2024 17:13:47 +0200 Subject: [PATCH 2/3] fix: review input --- .../DeleteProject/DeleteProjectDialogue.tsx | 17 ++++++++++------- .../ProjectSettings/Settings/DeleteProject.tsx | 12 ++++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx b/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx index adfc8516d149..a163647c4a16 100644 --- a/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx +++ b/frontend/src/component/project/Project/DeleteProject/DeleteProjectDialogue.tsx @@ -7,6 +7,7 @@ import useToast from 'hooks/useToast'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { useUiFlag } from 'hooks/useUiFlag'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; +import { Typography } from '@mui/material'; interface IDeleteProjectDialogueProps { project: string; @@ -51,13 +52,15 @@ export const DeleteProjectDialogue = ({ onClose={onClose} title='Really delete project' > - This will irreversibly remove the project, all feature flags - archived in it, all API keys scoped to only this project - - . + + This will irreversibly remove the project, all feature flags + archived in it, all API keys scoped to only this project + + . + ); }; diff --git a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx index 1e1e56e9b23e..efa02b84aefe 100644 --- a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx @@ -40,14 +40,18 @@ export const DeleteProject = ({ const navigate = useNavigate(); return ( +

+ Before you can delete a project, you must first archive all the + feature flags associated with it + {isEnterprise() && automatedActionsEnabled + ? 'and disable all actions that are in it' + : ''} + . +

0 || actionsCount > 0} show={ <> -

- Before you can delete a project, you must first - archive all the feature flags associated with it. -

Currently there are{' '} {featureCount} feature flags active From 5f904e18db1e3b3e2da01c0aa22f328ff93fac8e Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:31:51 +0200 Subject: [PATCH 3/3] reword delete project active items section --- .../Settings/DeleteProject.tsx | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx index efa02b84aefe..883523efb521 100644 --- a/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/Settings/DeleteProject.tsx @@ -49,27 +49,31 @@ export const DeleteProject = ({ .

0 || actionsCount > 0} + condition={featureCount > 0} show={ - <> -

- Currently there are{' '} - {featureCount} feature flags active -

- - Currently there are{' '} - - {actionsCount} enabled actions - -

- } - /> - +

+ Currently there {featureCount <= 1 ? 'is' : 'are'}{' '} + + {featureCount} active feature{' '} + {featureCount === 1 ? 'flag' : 'flags'}. + +

+ } + /> + 0 + } + show={ +

+ Currently there {actionsCount <= 1 ? 'is' : 'are'}{' '} + + {actionsCount} enabled{' '} + {actionsCount === 1 ? 'action' : 'actions'}. + +

} />