1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-27 00:19:39 +01:00

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.

<img width="1008" alt="image"
src="https://github.com/Unleash/unleash/assets/14320932/06fcaab0-c4a1-4ba3-8879-0c188f3bc01a">
This commit is contained in:
Nuno Góis 2024-03-07 17:04:36 +00:00 committed by GitHub
parent 7b402ad6b3
commit 26d7065dc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 (
<StyledContainer>
<StyledTitle>Delete project</StyledTitle>
<div>
<p>
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.
</div>
<StyledCounter>
</p>
<ConditionallyRender
condition={isEnterprise() && automatedActionsEnabled}
show={
<p>
Additionally, all configured actions for this project
will no longer be executed as they will be permanently
deleted.
</p>
}
/>
<p>
Currently there are{' '}
<strong>{featureCount} feature toggles active</strong>
</StyledCounter>
</p>
<ConditionallyRender
condition={isEnterprise() && automatedActionsEnabled}
show={
<p>
Currently there are{' '}
<strong>
{actions.filter(({ enabled }) => enabled).length}{' '}
enabled actions
</strong>
</p>
}
/>
<StyledButtonContainer>
<PermissionButton
permission={DELETE_PROJECT}