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:
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user