Skip to content

Commit

Permalink
Merge pull request #14274 from Budibase/fix/accomodate-missing-auto-t…
Browse files Browse the repository at this point in the history
…rigger

Fix to accomodate automations without triggers
  • Loading branch information
deanhannigan authored Jul 30, 2024
2 parents ba3f69e + d2be5f6 commit 17c96f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
</div>
<div class="controls">
<div
class:disabled={!$selectedAutomation?.definition?.trigger}
on:click={() => {
testDataModal.show()
}}
Expand All @@ -80,6 +81,7 @@
automation._id,
automation.disabled
)}
disabled={!$selectedAutomation?.definition?.trigger}
value={!automation.disabled}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@
name: "Edit",
keyBind: null,
visible: true,
disabled: false,
disabled: !automation.definition.trigger,
callback: updateAutomationDialog.show,
},
{
icon: "Duplicate",
name: "Duplicate",
keyBind: null,
visible: true,
disabled: automation.definition.trigger.name === "Webhook",
disabled:
!automation.definition.trigger ||
automation.definition.trigger?.name === "Webhook",
callback: duplicateAutomation,
},
]
Expand All @@ -74,7 +76,7 @@
name: automation.disabled ? "Activate" : "Pause",
keyBind: null,
visible: true,
disabled: false,
disabled: !automation.definition.trigger,
callback: () => {
automationStore.actions.toggleDisabled(
automation._id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
})
$: groupedAutomations = filteredAutomations.reduce((acc, auto) => {
acc[auto.definition.trigger.event] ??= {
icon: auto.definition.trigger.icon,
name: (auto.definition.trigger?.name || "").toUpperCase(),
const catName = auto.definition?.trigger?.event || "No Trigger"
acc[catName] ??= {
icon: auto.definition?.trigger?.icon || "AlertCircle",
name: (auto.definition?.trigger?.name || "No Trigger").toUpperCase(),
entries: [],
}
acc[auto.definition.trigger.event].entries.push(auto)
acc[catName].entries.push(auto)
return acc
}, {})
Expand Down

0 comments on commit 17c96f7

Please sign in to comment.