1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02: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 { DeleteProjectDialogue } from '../../DeleteProject/DeleteProjectDialogue';
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router'; 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 }) => ({ const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
borderTop: `1px solid ${theme.palette.divider}`, borderTop: `1px solid ${theme.palette.divider}`,
}));
const StyledTitle = styled('div')(({ theme }) => ({
paddingTop: theme.spacing(4), paddingTop: theme.spacing(4),
lineHeight: 2, gap: theme.spacing(2),
}));
const StyledCounter = styled('div')(({ theme }) => ({
paddingTop: theme.spacing(3),
})); }));
const StyledButtonContainer = styled('div')(({ theme }) => ({ const StyledButtonContainer = styled('div')(({ theme }) => ({
@ -33,21 +32,45 @@ export const DeleteProject = ({
projectId, projectId,
featureCount, featureCount,
}: IDeleteProjectProps) => { }: IDeleteProjectProps) => {
const { isEnterprise } = useUiConfig();
const automatedActionsEnabled = useUiFlag('automatedActions');
const { actions } = useActions(projectId);
const [showDelDialog, setShowDelDialog] = useState(false); const [showDelDialog, setShowDelDialog] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
return ( return (
<StyledContainer> <StyledContainer>
<StyledTitle>Delete project</StyledTitle> <p>
<div>
Before you can delete a project, you must first archive all the Before you can delete a project, you must first archive all the
feature toggles associated with it. Keep in mind that deleting a feature toggles associated with it. Keep in mind that deleting a
project will permanently remove all the archived feature project will permanently remove all the archived feature
toggles, and they cannot be recovered once deleted. toggles, and they cannot be recovered once deleted.
</div> </p>
<StyledCounter> <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{' '} Currently there are{' '}
<strong>{featureCount} feature toggles active</strong> <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> <StyledButtonContainer>
<PermissionButton <PermissionButton
permission={DELETE_PROJECT} permission={DELETE_PROJECT}