mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-17 01:17:29 +02:00
feat: update description on project deletion (#7539)
Improving the project deletion experience by adding information about API keys and refining the messaging, making it easier to comprehend.
This commit is contained in:
parent
963d051632
commit
1d7cd2e274
@ -4,6 +4,10 @@ import { formatUnknownError } from 'utils/formatUnknownError';
|
|||||||
import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
|
import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi';
|
||||||
import useProjects from 'hooks/api/getters/useProjects/useProjects';
|
import useProjects from 'hooks/api/getters/useProjects/useProjects';
|
||||||
import useToast from 'hooks/useToast';
|
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 {
|
interface IDeleteProjectDialogueProps {
|
||||||
project: string;
|
project: string;
|
||||||
@ -21,6 +25,8 @@ export const DeleteProjectDialogue = ({
|
|||||||
const { deleteProject } = useProjectApi();
|
const { deleteProject } = useProjectApi();
|
||||||
const { refetch: refetchProjectOverview } = useProjects();
|
const { refetch: refetchProjectOverview } = useProjects();
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
|
const { isEnterprise } = useUiConfig();
|
||||||
|
const automatedActionsEnabled = useUiFlag('automatedActions');
|
||||||
|
|
||||||
const onClick = async (e: React.SyntheticEvent) => {
|
const onClick = async (e: React.SyntheticEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -45,6 +51,16 @@ export const DeleteProjectDialogue = ({
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
title='Really delete project'
|
title='Really delete project'
|
||||||
/>
|
>
|
||||||
|
<Typography>
|
||||||
|
This will irreversibly remove the project, all feature flags
|
||||||
|
archived in it, all API keys scoped to only this project
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={isEnterprise() && automatedActionsEnabled}
|
||||||
|
show=', and all actions configured for it'
|
||||||
|
/>
|
||||||
|
.
|
||||||
|
</Typography>
|
||||||
|
</Dialogue>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -36,41 +36,59 @@ export const DeleteProject = ({
|
|||||||
const automatedActionsEnabled = useUiFlag('automatedActions');
|
const automatedActionsEnabled = useUiFlag('automatedActions');
|
||||||
const { actions } = useActions(projectId);
|
const { actions } = useActions(projectId);
|
||||||
const [showDelDialog, setShowDelDialog] = useState(false);
|
const [showDelDialog, setShowDelDialog] = useState(false);
|
||||||
|
const actionsCount = actions.filter(({ enabled }) => enabled).length;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<p>
|
<p>
|
||||||
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 flags associated with it. Keep in mind that deleting a
|
feature flags associated with it
|
||||||
project will permanently remove all the archived feature flags,
|
{isEnterprise() && automatedActionsEnabled
|
||||||
and they cannot be recovered once deleted.
|
? 'and disable all actions that are in it'
|
||||||
|
: ''}
|
||||||
|
.
|
||||||
</p>
|
</p>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={isEnterprise() && automatedActionsEnabled}
|
condition={featureCount > 0}
|
||||||
show={
|
show={
|
||||||
<p>
|
<p>
|
||||||
Additionally, all configured actions for this project
|
Currently there {featureCount <= 1 ? 'is' : 'are'}{' '}
|
||||||
will no longer be executed as they will be permanently
|
|
||||||
deleted.
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<p>
|
|
||||||
Currently there are{' '}
|
|
||||||
<strong>{featureCount} feature flags active</strong>
|
|
||||||
</p>
|
|
||||||
<ConditionallyRender
|
|
||||||
condition={isEnterprise() && automatedActionsEnabled}
|
|
||||||
show={
|
|
||||||
<p>
|
|
||||||
Currently there are{' '}
|
|
||||||
<strong>
|
<strong>
|
||||||
{actions.filter(({ enabled }) => enabled).length}{' '}
|
{featureCount} active feature{' '}
|
||||||
enabled actions
|
{featureCount === 1 ? 'flag' : 'flags'}.
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={
|
||||||
|
isEnterprise() &&
|
||||||
|
automatedActionsEnabled &&
|
||||||
|
actionsCount > 0
|
||||||
|
}
|
||||||
|
show={
|
||||||
|
<p>
|
||||||
|
Currently there {actionsCount <= 1 ? 'is' : 'are'}{' '}
|
||||||
|
<strong>
|
||||||
|
{actionsCount} enabled{' '}
|
||||||
|
{actionsCount === 1 ? 'action' : 'actions'}.
|
||||||
|
</strong>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<p>
|
||||||
|
Keep in mind that deleting a project{' '}
|
||||||
|
<strong>will permanently remove</strong>
|
||||||
|
<ul>
|
||||||
|
<li>all archived feature flags in this project</li>
|
||||||
|
<li>API keys configured to access only this project</li>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={isEnterprise() && automatedActionsEnabled}
|
||||||
|
show={<li>all actions configured for this project</li>}
|
||||||
|
/>
|
||||||
|
</ul>
|
||||||
|
and they <strong>cannot be recovered</strong> once deleted.
|
||||||
|
</p>
|
||||||
<StyledButtonContainer>
|
<StyledButtonContainer>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
permission={DELETE_PROJECT}
|
permission={DELETE_PROJECT}
|
||||||
|
Loading…
Reference in New Issue
Block a user