diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js
index e1db07053e..2c1636b359 100644
--- a/packages/builder/src/builderStore/store/automation/index.js
+++ b/packages/builder/src/builderStore/store/automation/index.js
@@ -3,14 +3,14 @@ import api from "../../api"
import Automation from "./Automation"
import { cloneDeep } from "lodash/fp"
-const automationActions = store => ({
+const automationActions = (store) => ({
fetch: async () => {
const responses = await Promise.all([
api.get(`/api/automations`),
api.get(`/api/automations/definitions/list`),
])
- const jsonResponses = await Promise.all(responses.map(x => x.json()))
- store.update(state => {
+ const jsonResponses = await Promise.all(responses.map((x) => x.json()))
+ store.update((state) => {
state.automations = jsonResponses[0]
state.blockDefinitions = {
TRIGGER: jsonResponses[1].trigger,
@@ -31,7 +31,7 @@ const automationActions = store => ({
const CREATE_AUTOMATION_URL = `/api/automations`
const response = await api.post(CREATE_AUTOMATION_URL, automation)
const json = await response.json()
- store.update(state => {
+ store.update((state) => {
state.automations = [...state.automations, json.automation]
store.actions.select(json.automation)
return state
@@ -41,9 +41,9 @@ const automationActions = store => ({
const UPDATE_AUTOMATION_URL = `/api/automations`
const response = await api.put(UPDATE_AUTOMATION_URL, automation)
const json = await response.json()
- store.update(state => {
+ store.update((state) => {
const existingIdx = state.automations.findIndex(
- existing => existing._id === automation._id
+ (existing) => existing._id === automation._id
)
state.automations.splice(existingIdx, 1, json.automation)
state.automations = state.automations
@@ -56,9 +56,9 @@ const automationActions = store => ({
const DELETE_AUTOMATION_URL = `/api/automations/${_id}/${_rev}`
await api.delete(DELETE_AUTOMATION_URL)
- store.update(state => {
+ store.update((state) => {
const existingIdx = state.automations.findIndex(
- existing => existing._id === _id
+ (existing) => existing._id === _id
)
state.automations.splice(existingIdx, 1)
state.automations = state.automations
@@ -72,24 +72,24 @@ const automationActions = store => ({
const TRIGGER_AUTOMATION_URL = `/api/automations/${_id}/trigger`
return await api.post(TRIGGER_AUTOMATION_URL)
},
- select: automation => {
- store.update(state => {
+ select: (automation) => {
+ store.update((state) => {
state.selectedAutomation = new Automation(cloneDeep(automation))
state.selectedBlock = null
return state
})
},
- addBlockToAutomation: block => {
- store.update(state => {
+ addBlockToAutomation: (block) => {
+ store.update((state) => {
const newBlock = state.selectedAutomation.addBlock(cloneDeep(block))
state.selectedBlock = newBlock
return state
})
},
- deleteAutomationBlock: block => {
- store.update(state => {
+ deleteAutomationBlock: (block) => {
+ store.update((state) => {
const idx = state.selectedAutomation.automation.definition.steps.findIndex(
- x => x.id === block.id
+ (x) => x.id === block.id
)
state.selectedAutomation.deleteBlock(block.id)
diff --git a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte
index c832ddd8bc..a598c6831e 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte
@@ -1,93 +1,31 @@
-
@@ -61,6 +69,7 @@ flex-direction: row; justify-content: flex-start; align-items: center; + gap: var(--spacing-xs); } header span { flex: 1 1 auto; @@ -74,7 +83,13 @@ } header i { font-size: 20px; - margin-right: 5px; + } + header i.delete { + opacity: 0.5; + } + header i.delete:hover { + cursor: pointer; + opacity: 1; } .ACTION { diff --git a/packages/builder/src/components/automation/AutomationBuilder/flowchart/api.js b/packages/builder/src/components/automation/AutomationBuilder/flowchart/api.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/builder/src/components/automation/AutomationBuilder/flowchart/index.js b/packages/builder/src/components/automation/AutomationBuilder/flowchart/index.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte new file mode 100644 index 0000000000..c4a39d69b9 --- /dev/null +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte @@ -0,0 +1,34 @@ + + +