mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-06-12 17:34:27 +02:00
Show delete action for duplicate base environments
This commit is contained in:
@@ -184,6 +184,9 @@ function EnvironmentEditDialogSidebar({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const singleEnvironment = items.length === 1;
|
const singleEnvironment = items.length === 1;
|
||||||
|
const canDeleteEnvironment =
|
||||||
|
isSubEnvironment(environment) ||
|
||||||
|
(isBaseEnvironment(environment) && baseEnvironments.length > 1);
|
||||||
|
|
||||||
const menuItems: DropdownItem[] = [
|
const menuItems: DropdownItem[] = [
|
||||||
{
|
{
|
||||||
@@ -228,9 +231,7 @@ function EnvironmentEditDialogSidebar({
|
|||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
hotKeyAction: 'sidebar.selected.delete',
|
hotKeyAction: 'sidebar.selected.delete',
|
||||||
hotKeyLabelOnly: true,
|
hotKeyLabelOnly: true,
|
||||||
hidden:
|
hidden: !canDeleteEnvironment,
|
||||||
(isBaseEnvironment(environment) && baseEnvironments.length <= 1) ||
|
|
||||||
!isSubEnvironment(environment),
|
|
||||||
leftSlot: <Icon icon="trash" />,
|
leftSlot: <Icon icon="trash" />,
|
||||||
onSelect: () => handleDeleteEnvironment(environment),
|
onSelect: () => handleDeleteEnvironment(environment),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user