Enable deletion of relation fields (#5338)

In this PR
1. Enable deletion of relation fields in the product and via the api
(migration part was missing in the api)
3. Change wording, only use "deactivate" and "delete" everywhere (and
not a mix of the two + "disable", "erase")
This commit is contained in:
Marie
2024-05-13 17:43:51 +02:00
committed by GitHub
parent 0018ec78b0
commit b9154f315e
30 changed files with 519 additions and 117 deletions

View File

@ -12,14 +12,14 @@ type SettingsObjectFieldInactiveActionDropdownProps = {
isCustomField?: boolean;
fieldType?: FieldMetadataType;
onActivate: () => void;
onErase: () => void;
onDelete: () => void;
scopeKey: string;
};
export const SettingsObjectFieldInactiveActionDropdown = ({
onActivate,
scopeKey,
onErase,
onDelete,
isCustomField,
fieldType,
}: SettingsObjectFieldInactiveActionDropdownProps) => {
@ -32,15 +32,12 @@ export const SettingsObjectFieldInactiveActionDropdown = ({
closeDropdown();
};
const handleErase = () => {
onErase();
const handleDelete = () => {
onDelete();
closeDropdown();
};
const isErasable =
isCustomField &&
fieldType !== FieldMetadataType.Relation &&
fieldType !== FieldMetadataType.Address;
const isDeletable = isCustomField && fieldType !== FieldMetadataType.Address;
return (
<Dropdown
@ -56,12 +53,12 @@ export const SettingsObjectFieldInactiveActionDropdown = ({
LeftIcon={IconArchiveOff}
onClick={handleActivate}
/>
{isErasable && (
{isDeletable && (
<MenuItem
text="Erase"
text="Delete"
accent="danger"
LeftIcon={IconTrash}
onClick={handleErase}
onClick={handleDelete}
/>
)}
</DropdownMenuItemsContainer>