From d60140087134fec60db62c48642b49d596bebbbc Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 23 Jul 2024 10:21:09 +0200 Subject: [PATCH] Don't allow edit or delete actions for row actions --- .../AutomationPanel/AutomationNavItem.svelte | 86 ++++++++++--------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte index b8d9c66cf3..25f1a3648b 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte @@ -35,47 +35,53 @@ } const getContextMenuItems = () => { - return [ - { - icon: "Delete", - name: "Delete", - keyBind: null, - visible: true, - disabled: false, - callback: confirmDeleteDialog.show, + const isRowAction = automation.definition.trigger.name === "Row Action" + const result = [] + if (!isRowAction) { + result.push( + ...[ + { + icon: "Delete", + name: "Delete", + keyBind: null, + visible: true, + disabled: false, + callback: confirmDeleteDialog.show, + }, + { + icon: "Edit", + name: "Edit", + keyBind: null, + visible: true, + disabled: false, + callback: updateAutomationDialog.show, + }, + { + icon: "Duplicate", + name: "Duplicate", + keyBind: null, + visible: true, + disabled: automation.definition.trigger.name === "Webhook", + callback: duplicateAutomation, + }, + ] + ) + } + + result.push({ + icon: automation.disabled ? "CheckmarkCircle" : "Cancel", + name: automation.disabled ? "Activate" : "Pause", + keyBind: null, + visible: true, + disabled: false, + callback: () => { + automationStore.actions.toggleDisabled( + automation._id, + automation.disabled + ) }, - { - icon: "Edit", - name: "Edit", - keyBind: null, - visible: true, - disabled: false, - callback: updateAutomationDialog.show, - }, - { - icon: "Duplicate", - name: "Duplicate", - keyBind: null, - visible: true, - disabled: - automation.definition.trigger.name === "Webhook" || - automation.definition.trigger.name === "Row Action", - callback: duplicateAutomation, - }, - { - icon: automation.disabled ? "CheckmarkCircle" : "Cancel", - name: automation.disabled ? "Activate" : "Pause", - keyBind: null, - visible: true, - disabled: false, - callback: () => { - automationStore.actions.toggleDisabled( - automation._id, - automation.disabled - ) - }, - }, - ] + }) + return result } const openContextMenu = e => {