Merge branch 'master' into global-bindings
This commit is contained in:
commit
ce7432ad71
|
@ -66,6 +66,7 @@
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
"@zerodevx/svelte-json-view": "^1.0.7",
|
||||||
"codemirror": "^5.59.0",
|
"codemirror": "^5.59.0",
|
||||||
"dayjs": "^1.10.8",
|
"dayjs": "^1.10.8",
|
||||||
"downloadjs": "1.4.7",
|
"downloadjs": "1.4.7",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon, Divider, Tabs, Tab, TextArea, Label } from "@budibase/bbui"
|
import { Icon, Divider, Tabs, Tab, Label } from "@budibase/bbui"
|
||||||
import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte"
|
import FlowItemHeader from "./FlowChart/FlowItemHeader.svelte"
|
||||||
import { ActionStepID } from "constants/backend/automations"
|
import { ActionStepID } from "constants/backend/automations"
|
||||||
|
import { JsonView } from "@zerodevx/svelte-json-view"
|
||||||
|
|
||||||
export let automation
|
export let automation
|
||||||
export let testResults
|
export let testResults
|
||||||
|
@ -14,13 +15,6 @@
|
||||||
return results?.steps.filter(x => x.stepId !== ActionStepID.LOOP || [])
|
return results?.steps.filter(x => x.stepId !== ActionStepID.LOOP || [])
|
||||||
}
|
}
|
||||||
|
|
||||||
function textArea(results, message) {
|
|
||||||
if (!results) {
|
|
||||||
return message
|
|
||||||
}
|
|
||||||
return JSON.stringify(results, null, 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
$: filteredResults = prepTestResults(testResults)
|
$: filteredResults = prepTestResults(testResults)
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
|
@ -71,26 +65,34 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<Tabs noHorizPadding selected="Input">
|
<Tabs quiet noHorizPadding selected="Input">
|
||||||
<Tab title="Input">
|
<Tab title="Input">
|
||||||
<TextArea
|
<div class="wrap">
|
||||||
minHeight="160px"
|
{#if filteredResults?.[idx]?.inputs}
|
||||||
disabled
|
<JsonView depth={2} json={filteredResults?.[idx]?.inputs} />
|
||||||
value={textArea(filteredResults?.[idx]?.inputs, "No input")}
|
{:else}
|
||||||
/>
|
No input
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab title="Output">
|
<Tab title="Output">
|
||||||
<TextArea
|
<div class="wrap">
|
||||||
minHeight="160px"
|
{#if filteredResults?.[idx]?.inputs}
|
||||||
disabled
|
<JsonView
|
||||||
value={textArea(filteredResults?.[idx]?.outputs, "No output")}
|
depth={2}
|
||||||
/>
|
json={filteredResults?.[idx]?.outputs}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
No input
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if blocks.length - 1 !== idx}
|
{#if blocks.length - 1 !== idx}
|
||||||
<div class="separator" />
|
<div class="separator" />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -104,6 +106,33 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrap {
|
||||||
|
font-family: monospace;
|
||||||
|
background-color: var(
|
||||||
|
--spectrum-textfield-m-background-color,
|
||||||
|
var(--spectrum-global-color-gray-50)
|
||||||
|
);
|
||||||
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
||||||
|
font-size: 12px;
|
||||||
|
max-height: 160px; /* Adjusted max-height */
|
||||||
|
height: 160px;
|
||||||
|
--jsonPaddingLeft: 20px;
|
||||||
|
--jsonborderleft: 20px;
|
||||||
|
overflow: auto;
|
||||||
|
overflow: overlay;
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding-left: var(--spacing-s);
|
||||||
|
padding-top: var(--spacing-xl);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap::-webkit-scrollbar {
|
||||||
|
width: 7px; /* width of the scrollbar */
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap::-webkit-scrollbar-track {
|
||||||
|
background: transparent; /* transparent track */
|
||||||
|
}
|
||||||
.tabs {
|
.tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -1,44 +1,117 @@
|
||||||
<script>
|
<script>
|
||||||
import AutomationList from "./AutomationList.svelte"
|
|
||||||
import CreateAutomationModal from "./CreateAutomationModal.svelte"
|
import CreateAutomationModal from "./CreateAutomationModal.svelte"
|
||||||
import { Modal, Icon } from "@budibase/bbui"
|
import { Modal, notifications, Layout } from "@budibase/bbui"
|
||||||
import Panel from "components/design/Panel.svelte"
|
import NavHeader from "components/common/NavHeader.svelte"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
import {
|
||||||
|
automationStore,
|
||||||
|
selectedAutomation,
|
||||||
|
userSelectedResourceMap,
|
||||||
|
} from "builderStore"
|
||||||
|
import NavItem from "components/common/NavItem.svelte"
|
||||||
|
import EditAutomationPopover from "./EditAutomationPopover.svelte"
|
||||||
|
|
||||||
export let modal
|
export let modal
|
||||||
export let webhookModal
|
export let webhookModal
|
||||||
|
let searchString
|
||||||
|
|
||||||
|
$: selectedAutomationId = $selectedAutomation?._id
|
||||||
|
|
||||||
|
$: filteredAutomations = $automationStore.automations
|
||||||
|
.filter(automation => {
|
||||||
|
return (
|
||||||
|
!searchString ||
|
||||||
|
automation.name.toLowerCase().includes(searchString.toLowerCase())
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.sort((a, b) => {
|
||||||
|
const lowerA = a.name.toLowerCase()
|
||||||
|
const lowerB = b.name.toLowerCase()
|
||||||
|
return lowerA > lowerB ? 1 : -1
|
||||||
|
})
|
||||||
|
|
||||||
|
$: showNoResults = searchString && !filteredAutomations.length
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
await automationStore.actions.fetch()
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error("Error getting automations list")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function selectAutomation(id) {
|
||||||
|
automationStore.actions.select(id)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Panel title="Automations" borderRight noHeaderBorder titleCSS={false}>
|
<div class="side-bar">
|
||||||
<span class="panel-title-content" slot="panel-title-content">
|
<div class="side-bar-controls">
|
||||||
<div class="header">
|
<NavHeader
|
||||||
<div>Automations</div>
|
title="Automations"
|
||||||
<div on:click={modal.show} class="add-automation-button">
|
placeholder="Search for automation"
|
||||||
<Icon name="Add" />
|
bind:value={searchString}
|
||||||
</div>
|
onAdd={() => modal.show()}
|
||||||
</div>
|
/>
|
||||||
</span>
|
</div>
|
||||||
<AutomationList />
|
<div class="side-bar-nav">
|
||||||
</Panel>
|
{#each filteredAutomations as automation}
|
||||||
|
<NavItem
|
||||||
|
text={automation.name}
|
||||||
|
selected={automation._id === selectedAutomationId}
|
||||||
|
on:click={() => selectAutomation(automation._id)}
|
||||||
|
selectedBy={$userSelectedResourceMap[automation._id]}
|
||||||
|
>
|
||||||
|
<EditAutomationPopover {automation} />
|
||||||
|
</NavItem>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
{#if showNoResults}
|
||||||
|
<Layout paddingY="none" paddingX="L">
|
||||||
|
<div class="no-results">
|
||||||
|
There aren't any automations matching that name
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<CreateAutomationModal {webhookModal} />
|
<CreateAutomationModal {webhookModal} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.header {
|
.side-bar {
|
||||||
|
flex: 0 0 260px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
border-right: var(--border-light);
|
||||||
|
background: var(--spectrum-global-color-gray-100);
|
||||||
|
overflow: hidden;
|
||||||
|
transition: margin-left 300ms ease-out;
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.side-bar {
|
||||||
|
margin-left: -262px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-bar-controls {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
gap: var(--spacing-l);
|
||||||
gap: var(--spacing-m);
|
padding: 0 var(--spacing-l);
|
||||||
|
}
|
||||||
|
.side-bar-nav {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-automation-button {
|
.no-results {
|
||||||
margin-left: 130px;
|
color: var(--spectrum-global-color-gray-600);
|
||||||
color: var(--grey-7);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-automation-button:hover {
|
|
||||||
color: var(--ink);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -99,7 +99,7 @@ export async function run({ inputs }: AutomationStepInput) {
|
||||||
} else {
|
} else {
|
||||||
result = false
|
result = false
|
||||||
}
|
}
|
||||||
return { success: true, result }
|
return { success: true, result, refValue: field, comparisonValue: value }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return { success: false, result: false }
|
return { success: false, result: false }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue