1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00

Add new actions modal and integration with flowchart

This commit is contained in:
Peter Clement 2021-09-07 14:32:43 +01:00
parent e00e9f970f
commit 3e851c5eae
18 changed files with 275 additions and 96 deletions

View file

@ -0,0 +1,10 @@
<svg width="71" height="55" viewBox="0 0 71 55" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0)">
<path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="#5865F2"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="71" height="55" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 270 270" style="enable-background:new 0 0 270 270;" xml:space="preserve">
<style type="text/css">
.st0{fill:#E01E5A;}
.st1{fill:#36C5F0;}
.st2{fill:#2EB67D;}
.st3{fill:#ECB22E;}
</style>
<g>
<g>
<path class="st0" d="M99.4,151.2c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9h12.9V151.2z"/>
<path class="st0" d="M105.9,151.2c0-7.1,5.8-12.9,12.9-12.9s12.9,5.8,12.9,12.9v32.3c0,7.1-5.8,12.9-12.9,12.9
s-12.9-5.8-12.9-12.9V151.2z"/>
</g>
<g>
<path class="st1" d="M118.8,99.4c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9s12.9,5.8,12.9,12.9v12.9H118.8z"/>
<path class="st1" d="M118.8,105.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9H86.5c-7.1,0-12.9-5.8-12.9-12.9
s5.8-12.9,12.9-12.9H118.8z"/>
</g>
<g>
<path class="st2" d="M170.6,118.8c0-7.1,5.8-12.9,12.9-12.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9h-12.9V118.8z"/>
<path class="st2" d="M164.1,118.8c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9V86.5c0-7.1,5.8-12.9,12.9-12.9
c7.1,0,12.9,5.8,12.9,12.9V118.8z"/>
</g>
<g>
<path class="st3" d="M151.2,170.6c7.1,0,12.9,5.8,12.9,12.9c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9v-12.9H151.2z"/>
<path class="st3" d="M151.2,164.1c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9h32.3c7.1,0,12.9,5.8,12.9,12.9
c0,7.1-5.8,12.9-12.9,12.9H151.2z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,140 @@
<script>
import { ModalContent, Layout, Detail, Body, Icon } from "@budibase/bbui"
import { automationStore } from "builderStore"
import DiscordLogo from "assets/discord.svg"
import ZapierLogo from "assets/zapier.png"
import IntegromatLogo from "assets/integromat.png"
import SlackLogo from "assets/integromat.png"
let selectedAction
let actionVal
export let blockComplete
let externalActionsPredicate = [
{ name: "zapier", logo: ZapierLogo },
{ name: "discord", logo: DiscordLogo },
{ name: "slack", logo: SlackLogo },
{ name: "integromat", logo: IntegromatLogo },
]
let actions = Object.entries($automationStore.blockDefinitions.ACTION)
const externalActions = actions.reduce((acc, elm) => {
const [k, v] = elm
if (externalActionsPredicate.some(pred => pred.name === k)) {
acc[k] = v
}
return acc
}, {})
const internalActions = actions.reduce((acc, elm) => {
const [k, v] = elm
if (!externalActionsPredicate.some(pred => pred.name === k)) {
acc[k] = v
}
return acc
}, {})
const selectAction = action => {
actionVal = action
selectedAction = action.name
}
function addBlockToAutomation() {
const newBlock = $automationStore.selectedAutomation.constructBlock(
"ACTION",
actionVal.stepId,
actionVal
)
automationStore.actions.addBlockToAutomation(newBlock)
}
</script>
<ModalContent
title="Create Automation"
confirmText="Save"
size="M"
disabled={!selectedAction}
onConfirm={() => {
blockComplete = true
addBlockToAutomation()
}}
>
<Body size="XS">Select an app or event.</Body>
<Layout noPadding>
<Body size="S">Apps</Body>
<div class="item-list">
{#each Object.entries(externalActions) as [idx, action]}
<div
class="item"
class:selected={selectedAction === action.name}
on:click={() => selectAction(action)}
>
<div class="item-body">
<img
width="20"
height="20"
src={externalActionsPredicate.find(val => val.name === idx).logo}
alt="zapier"
/>
<span class="icon-spacing">
<Body size="XS">{idx.charAt(0).toUpperCase() + idx.slice(1)}</Body
></span
>
</div>
</div>
{/each}
</div>
<Detail size="S">Actions</Detail>
<div class="item-list">
{#each Object.entries(internalActions) as [idx, action]}
<div
class="item"
class:selected={selectedAction === action.name}
on:click={() => selectAction(action)}
>
<div class="item-body">
<Icon name={action.icon} />
<span class="icon-spacing">
<Body size="XS">{action.name}</Body></span
>
</div>
</div>
{/each}
</div>
</Layout>
</ModalContent>
<style>
.icon-spacing {
margin-left: var(--spacing-m);
}
.item-body {
display: flex;
margin-left: var(--spacing-m);
}
.item-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
grid-gap: var(--spectrum-alias-grid-baseline);
}
.item {
cursor: pointer;
display: grid;
grid-gap: var(--spectrum-alias-grid-margin-xsmall);
padding: var(--spectrum-alias-item-padding-s);
background: var(--spectrum-alias-background-color-secondary);
transition: 0.3s all;
border: solid #3b3d3c;
border-radius: 5px;
box-sizing: border-box;
border-width: 2px;
}
.item:hover,
.selected {
background: var(--spectrum-alias-background-color-tertiary);
}
</style>

View file

@ -10,6 +10,7 @@
Button,
ActionButton,
notifications,
StatusLight,
} from "@budibase/bbui"
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
import CreateWebhookModal from "components/automation/shared/CreateWebhookModal.svelte"
@ -25,6 +26,7 @@
let testDataModal
let actionModal
let setupComplete
let blockComplete
let testToggled
$: setupToggled = !setupComplete || false
@ -83,92 +85,105 @@
<div
class={`block ${block.type} hoverable`}
class:selected
on:click={() => onSelect(block)}
on:click={() => {
blockComplete = false
onSelect(block)
}}
>
<div class="blockSection">
<div style="display: flex;">
<svg
width="35px"
height="35px"
class="spectrum-Icon"
style="color:grey;"
focusable="false"
>
<use xlink:href="#spectrum-icon-18-{block.icon}" />
</svg>
<div class="iconAlign">
<Body size="XS">When this happens:</Body>
<div class="splitHeader">
<div>
<svg
width="35px"
height="35px"
class="spectrum-Icon"
style="color:grey;"
focusable="false"
>
<use xlink:href="#spectrum-icon-18-{block.icon}" />
</svg>
<div class="iconAlign">
<Body size="XS">When this happens:</Body>
<Detail size="S">{block.name.toUpperCase()}</Detail>
<Detail size="S">{block?.name?.toUpperCase() || ""}</Detail>
</div>
</div>
{#if blockComplete}
<StatusLight positive={true} notice={false} />
{/if}
</div>
</div>
<Divider noMargin />
<div class="blockSection">
<Layout noPadding gap="S">
<div class="setup">
{#if !blockComplete}
<Divider noMargin />
<div class="blockSection">
<Layout noPadding gap="S">
<div class="splitHeader">
<div
on:click={() => {
if (!setupComplete) {
setupToggled = !setupToggled
}
}}
class="toggle"
>
{#if setupToggled}
<Icon size="M" name="ChevronDown" />
{:else}
<Icon size="M" name="ChevronRight" />
{/if}
<Detail size="S">Setup</Detail>
</div>
<div on:click={() => deleteStep()}>
<Icon name="DeleteOutline" />
</div>
</div>
{#if setupToggled}
<AutomationBlockSetup {block} {webhookModal} />
{#if block.inputs[schemaKey]}
<Button on:click={() => onContinue()} cta
>Continue and test trigger</Button
>
{/if}
{/if}
</Layout>
</div>
<Divider noMargin />
<div class="blockSection">
<Layout noPadding gap="S">
<div
on:click={() => {
if (!setupComplete) {
setupToggled = !setupToggled
if (setupComplete) {
testToggled = !testToggled
}
}}
class="toggle"
>
{#if setupToggled}
{#if testToggled}
<Icon size="M" name="ChevronDown" />
{:else}
<Icon size="M" name="ChevronRight" />
{/if}
<Detail size="S">Setup</Detail>
<Detail size="S">Test</Detail>
</div>
<div on:click={() => deleteStep()}>
<Icon name="DeleteOutline" />
</div>
</div>
{#if setupToggled}
<AutomationBlockSetup {block} {webhookModal} />
{#if block.inputs[schemaKey]}
<Button on:click={() => onContinue()} cta
>Continue and test trigger</Button
{#if testToggled}
<ActionButton on:click={testDataModal.show()} fullWidth icon="Add"
>Add test data</ActionButton
>
<Button
on:click={() => {
actionModal.show()
}}
cta>Save trigger and continue to action</Button
>
{/if}
{/if}
</Layout>
</div>
<Divider noMargin />
<div class="blockSection">
<Layout noPadding gap="S">
<div
on:click={() => {
if (setupComplete) {
testToggled = !testToggled
}
}}
class="toggle"
>
{#if testToggled}
<Icon size="M" name="ChevronDown" />
{:else}
<Icon size="M" name="ChevronRight" />
{/if}
<Detail size="S">Test</Detail>
</div>
{#if testToggled}
<ActionButton on:click={testDataModal.show()} fullWidth icon="Add"
>Add test data</ActionButton
>
<Button on:click={() => actionModal.show()} cta
>Save trigger and continue to action</Button
>
{/if}
</Layout>
</div>
</Layout>
</div>
{/if}
<Modal bind:this={actionModal} width="30%">
<ActionModal />
<ActionModal bind:blockComplete />
</Modal>
<Modal bind:this={webhookModal} width="30%">
@ -185,7 +200,7 @@
display: flex;
align-items: center;
}
.setup {
.splitHeader {
display: flex;
justify-content: space-between;
}

View file

@ -2,7 +2,6 @@
import { Heading, Body, Layout, Button, Modal } from "@budibase/bbui"
import { automationStore } from "builderStore"
import AutomationPanel from "components/automation/AutomationPanel/AutomationPanel.svelte"
import SetupPanel from "components/automation/SetupPanel/SetupPanel.svelte"
import CreateAutomationModal from "components/automation/AutomationPanel/CreateAutomationModal.svelte"
import CreateWebhookModal from "components/automation/shared/CreateWebhookModal.svelte"
$: automation = $automationStore.selectedAutomation?.automation
@ -40,11 +39,6 @@
</div>
{/if}
</div>
{#if $automationStore.selectedAutomation}
<div class="setup">
<SetupPanel />
</div>
{/if}
<Modal bind:this={modal}>
<CreateAutomationModal webhookModal />
</Modal>
@ -82,19 +76,6 @@
gap: var(--spacing-l);
overflow: hidden;
}
.setup {
padding: var(--spectrum-global-dimension-size-200);
border-left: var(--border-light);
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: var(--spacing-l);
background-color: var(--background);
overflow-y: auto;
}
.centered {
top: 0;
bottom: 0;

View file

@ -4,7 +4,7 @@ const { processStringSync } = require("@budibase/string-templates")
exports.definition = {
name: "Bash Scripting",
tagline: "Execute a bash command",
icon: "ri-terminal-box-line",
icon: "JourneyEvent",
description: "Run a bash script",
type: "ACTION",
internal: true,

View file

@ -6,7 +6,7 @@ const usage = require("../../utilities/usageQuota")
exports.definition = {
name: "Create Row",
tagline: "Create a {{inputs.enriched.table.name}} row",
icon: "ri-save-3-line",
icon: "SaveFloppy",
description: "Add a row to your database",
type: "ACTION",
internal: true,

View file

@ -2,7 +2,7 @@ let { wait } = require("../../utilities")
exports.definition = {
name: "Delay",
icon: "ri-time-line",
icon: "Clock",
tagline: "Delay for {{inputs.time}} milliseconds",
description: "Delay the automation until an amount of time has passed",
stepId: "DELAY",

View file

@ -4,7 +4,7 @@ const usage = require("../../utilities/usageQuota")
exports.definition = {
description: "Delete a row from your database",
icon: "ri-delete-bin-line",
icon: "DeleteOutline",
name: "Delete Row",
tagline: "Delete a {{inputs.enriched.table.name}} row",
type: "ACTION",

View file

@ -4,7 +4,7 @@ const { buildCtx } = require("./utils")
exports.definition = {
name: "External Data Connector",
tagline: "Execute Data Connector",
icon: "ri-database-2-line",
icon: "Data",
description: "Execute a query in an external data connector",
type: "ACTION",
stepId: "EXECUTE_QUERY",

View file

@ -4,7 +4,7 @@ const { buildCtx } = require("./utils")
exports.definition = {
name: "JS Scripting",
tagline: "Execute JavaScript Code",
icon: "ri-terminal-box-line",
icon: "Code",
description: "Run a piece of JavaScript code in your automation",
type: "ACTION",
internal: true,

View file

@ -18,7 +18,7 @@ exports.PrettyFilterConditions = PrettyFilterConditions
exports.definition = {
name: "Filter",
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
icon: "ri-git-branch-line",
icon: "Branch2",
description: "Filter any automations which do not meet certain conditions",
type: "LOGIC",
internal: true,

View file

@ -20,7 +20,7 @@ const BODY_REQUESTS = [RequestType.POST, RequestType.PUT, RequestType.PATCH]
exports.definition = {
name: "Outgoing webhook",
tagline: "Send a {{inputs.requestMethod}} request",
icon: "ri-send-plane-line",
icon: "Send",
description: "Send a request of specified method to a URL",
type: "ACTION",
internal: true,

View file

@ -3,7 +3,7 @@ const { sendSmtpEmail } = require("../../utilities/workerRequests")
exports.definition = {
description: "Send an email using SMTP",
tagline: "Send SMTP email to {{inputs.to}}",
icon: "ri-mail-open-line",
icon: "Email",
name: "Send Email (SMTP)",
type: "ACTION",
internal: true,

View file

@ -7,7 +7,7 @@
exports.definition = {
name: "Backend log",
tagline: "Console log a value in the backend",
icon: "ri-server-line",
icon: "Monitoring",
description: "Logs the given text to the server (using console.log)",
type: "ACTION",
internal: true,

View file

@ -4,7 +4,7 @@ const automationUtils = require("../automationUtils")
exports.definition = {
name: "Update Row",
tagline: "Update a {{inputs.enriched.table.name}} row",
icon: "ri-refresh-line",
icon: "Refresh",
description: "Update a row in your database",
type: "ACTION",
internal: true,