diff --git a/packages/bbui/src/Badge/Badge.svelte b/packages/bbui/src/Badge/Badge.svelte index 737d4133d8..4bc701d983 100644 --- a/packages/bbui/src/Badge/Badge.svelte +++ b/packages/bbui/src/Badge/Badge.svelte @@ -7,6 +7,7 @@ export let orange = false export let yellow = false export let seafoam = false + export let green = false export let active = false export let inactive = false @@ -17,6 +18,7 @@ class:spectrum-Label--large={size === "L"} class:spectrum-Label--grey={grey} class:spectrum-Label--red={red} + class:spectrum-Label--green={green} class:spectrum-Label--orange={orange} class:spectrum-Label--yellow={yellow} class:spectrum-Label--seafoam={seafoam} diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 156dbfba11..049e08edb4 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -17,7 +17,6 @@ const automationActions = store => ({ state.blockDefinitions = { TRIGGER: jsonResponses[1].trigger, ACTION: jsonResponses[1].action, - LOGIC: jsonResponses[1].logic, } // if previously selected find the new obj and select it if (selected) { @@ -47,10 +46,12 @@ const automationActions = store => ({ }) }, save: async ({ automation }) => { + console.log(automation) const UPDATE_AUTOMATION_URL = `/api/automations` const response = await api.put(UPDATE_AUTOMATION_URL, automation) const json = await response.json() store.update(state => { + console.log(state) const existingIdx = state.automations.findIndex( existing => existing._id === automation._id ) @@ -85,7 +86,7 @@ const automationActions = store => ({ const response = await api.post(`/api/automations/${_id}/test`, testData) const json = await response.json() store.update(state => { - state.testResults = json + state.selectedAutomation.testResults = json return state }) }, @@ -143,7 +144,6 @@ export const getAutomationStore = () => { blockDefinitions: { TRIGGER: [], ACTION: [], - LOGIC: [], }, selectedAutomation: null, } diff --git a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte deleted file mode 100644 index a04541cfad..0000000000 --- a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte +++ /dev/null @@ -1,114 +0,0 @@ - - -
- {#each tabs as tab, idx} -
- onChangeTab(idx)} - > - {tab.label} - -
- {/each} -
- (selectedIndex = null)} - bind:this={popover} - {anchor} - align="left" -> - - {#each blocks as [stepId, blockDefinition]} - addBlockToAutomation(stepId, blockDefinition)} - /> - {/each} - - - - - - - diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index a4401c5cdc..0a2ec3bb2b 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -26,13 +26,10 @@ let resultsModal let setupToggled let blockComplete - - $: testResult = $automationStore?.testResults - ? $automationStore.testResults.steps.filter( - step => step.stepId === block.stepId - ) - : null - + $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( + step => step.stepId === block.stepId + ) + $: console.log(testResult) $: instanceId = $database._id $: isTrigger = block.type === "TRIGGER" @@ -102,11 +99,11 @@ {block?.name?.toUpperCase() || ""} - {#if !!testResult} + {#if testResult} resultsModal.show()}> View response @@ -164,7 +161,7 @@ {/if} - + diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte index 3c4c92e81a..7fdb391820 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ResultsModal.svelte @@ -2,8 +2,10 @@ import { ModalContent, Icon, Detail, Badge, TextArea } from "@budibase/bbui" export let testResult + export let isTrigger let inputToggled let outputToggled + $: console.log(isTrigger)
- + {#if isTrigger || testResult[0].outputs.success} + + {:else} + + {/if}
diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte index 11cc7d49a9..ec7d137652 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte @@ -18,11 +18,7 @@ let schemaProperties = Object.entries(trigger.schema.outputs.properties || {}) // check to see if there is existing test data in the store - $: testData = Object.keys( - $automationStore.selectedAutomation?.automation?.testData - ).length - ? $automationStore.selectedAutomation.automation.testData - : {} + $: testData = $automationStore.selectedAutomation.automation.testData // Checj the schema to see if required fields have been entered $: isError = !trigger.schema.outputs.required.every( diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte index f70366773a..53946781ef 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte @@ -6,7 +6,7 @@ import EditAutomationPopover from "./EditAutomationPopover.svelte" $: selectedAutomationId = $automationStore.selectedAutomation?.automation?._id - + $: console.log($automationStore) onMount(() => { automationStore.actions.fetch() }) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 5082a8f74c..c16260779e 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -29,7 +29,7 @@ $: inputData = testData ? testData : block.inputs - async function onChange(e, key) { + const onChange = debounce(async function (e, key) { if (testData) { testData[key] = e.detail } else { @@ -39,7 +39,7 @@ automation: $automationStore.selectedAutomation?.automation, }) } - } + }, 800) function getAvailableBindings(block, automation) { if (!block || !automation) { @@ -131,7 +131,7 @@ {:else if value.customType === "row"} onChange(e, key), 800)} + on:change={e => onChange(e, key)} {bindings} /> {:else if value.customType === "webhookUrl"} diff --git a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte deleted file mode 100644 index b28ead272d..0000000000 --- a/packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte +++ /dev/null @@ -1,95 +0,0 @@ - - -
- Setup - setAutomationLive(!automationLive)} - dataCy="activate-automation" - text="Live" - /> -
-{#if $automationStore.selectedBlock} - -{:else if automation} -
{automation.name}
- -{/if} - - - - - - diff --git a/packages/server/src/automations/triggerInfo/app.js b/packages/server/src/automations/triggerInfo/app.js index 1c64795cf3..40d1531fa0 100644 --- a/packages/server/src/automations/triggerInfo/app.js +++ b/packages/server/src/automations/triggerInfo/app.js @@ -1,7 +1,7 @@ exports.definition = { name: "App Action", event: "app:trigger", - icon: "ri-window-fill", + icon: "Apps", tagline: "Automation fired from the frontend", description: "Trigger an automation from an action inside your app", stepId: "APP", diff --git a/packages/server/src/automations/triggerInfo/cron.js b/packages/server/src/automations/triggerInfo/cron.js index 31e79a4abf..9547da69fa 100644 --- a/packages/server/src/automations/triggerInfo/cron.js +++ b/packages/server/src/automations/triggerInfo/cron.js @@ -1,7 +1,7 @@ exports.definition = { name: "Cron Trigger", event: "cron:trigger", - icon: "ri-timer-line", + icon: "Clock", tagline: "Cron Trigger ({{inputs.cron}})", description: "Triggers automation on a cron schedule.", stepId: "CRON", diff --git a/packages/server/src/automations/triggerInfo/rowDeleted.js b/packages/server/src/automations/triggerInfo/rowDeleted.js index c7ead1fec4..ab6bbe320c 100644 --- a/packages/server/src/automations/triggerInfo/rowDeleted.js +++ b/packages/server/src/automations/triggerInfo/rowDeleted.js @@ -1,7 +1,7 @@ exports.definition = { name: "Row Deleted", event: "row:delete", - icon: "ri-delete-bin-line", + icon: "Delete", tagline: "Row is deleted from {{inputs.enriched.table.name}}", description: "Fired when a row is deleted from your database", stepId: "ROW_DELETED", diff --git a/packages/server/src/automations/triggerInfo/rowSaved.js b/packages/server/src/automations/triggerInfo/rowSaved.js index 3a21a26878..456a6d424b 100644 --- a/packages/server/src/automations/triggerInfo/rowSaved.js +++ b/packages/server/src/automations/triggerInfo/rowSaved.js @@ -1,7 +1,7 @@ exports.definition = { name: "Row Created", event: "row:save", - icon: "ri-save-line", + icon: "SaveFloppy", tagline: "Row is added to {{inputs.enriched.table.name}}", description: "Fired when a row is added to your database", stepId: "ROW_SAVED", diff --git a/packages/server/src/automations/triggerInfo/rowUpdated.js b/packages/server/src/automations/triggerInfo/rowUpdated.js index 099ce0a6b2..182c7c810e 100644 --- a/packages/server/src/automations/triggerInfo/rowUpdated.js +++ b/packages/server/src/automations/triggerInfo/rowUpdated.js @@ -1,7 +1,7 @@ exports.definition = { name: "Row Updated", event: "row:update", - icon: "ri-refresh-line", + icon: "Refresh", tagline: "Row is updated in {{inputs.enriched.table.name}}", description: "Fired when a row is updated in your database", stepId: "ROW_UPDATED", diff --git a/packages/server/src/automations/triggerInfo/webhook.js b/packages/server/src/automations/triggerInfo/webhook.js index dd83031d8f..56e139311c 100644 --- a/packages/server/src/automations/triggerInfo/webhook.js +++ b/packages/server/src/automations/triggerInfo/webhook.js @@ -1,7 +1,7 @@ exports.definition = { name: "Webhook", event: "web:trigger", - icon: "ri-global-line", + icon: "Send", tagline: "Webhook endpoint is hit", description: "Trigger an automation when a HTTP POST webhook is hit", stepId: "WEBHOOK",