-
-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prevent delete and archive on parent feature (#4913)
- Loading branch information
Showing
7 changed files
with
122 additions
and
20 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
frontend/src/component/common/FeatureArchiveDialog/FeatureArchiveNotAllowedDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { FC } from 'react'; | ||
import { Dialogue } from '../Dialogue/Dialogue'; | ||
import { styled } from '@mui/material'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
interface IFeatureArchiveNotAllowedDialogProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
features: string[]; | ||
project: string; | ||
} | ||
|
||
const StyledLink = styled(Link)(({ theme }) => ({ | ||
textDecoration: 'none', | ||
color: theme.palette.primary.main, | ||
fontWeight: theme.fontWeight.bold, | ||
})); | ||
export const FeatureArchiveNotAllowedDialog: FC< | ||
IFeatureArchiveNotAllowedDialogProps | ||
> = ({ isOpen, onClose, features, project }) => { | ||
return ( | ||
<Dialogue | ||
title="You can't archive a feature that other features depend on" | ||
open={isOpen} | ||
primaryButtonText='OK' | ||
onClick={onClose} | ||
> | ||
<p>The following features depend on your feature:</p> | ||
<ul> | ||
{features.map((feature) => ( | ||
<li key={feature}> | ||
<StyledLink | ||
to={`/projects/${project}/features/${feature}`} | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
> | ||
{feature} | ||
</StyledLink> | ||
</li> | ||
))} | ||
</ul> | ||
</Dialogue> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/lib/features/dependent-features/dependent-features-read-model-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { IDependency } from '../../types'; | ||
|
||
export interface IDependentFeaturesReadModel { | ||
getChildren(parent: string): Promise<string[]>; | ||
getChildren(parents: string[]): Promise<string[]>; | ||
getParents(child: string): Promise<IDependency[]>; | ||
getParentOptions(child: string): Promise<string[]>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters