windmill-components 1.22.42 → 1.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AppConnect.svelte +93 -47
- package/components/AppConnect.svelte.d.ts +2 -2
- package/components/ArgInfo.svelte +0 -5
- package/components/ArgInput.svelte +91 -64
- package/components/ArgInput.svelte.d.ts +8 -3
- package/components/Button.svelte +4 -4
- package/components/CenteredPage.svelte +1 -1
- package/components/CollapseLink.svelte +12 -0
- package/components/CollapseLink.svelte.d.ts +19 -0
- package/components/CronInput.svelte +84 -0
- package/components/CronInput.svelte.d.ts +18 -0
- package/components/DisplayResult.svelte +28 -15
- package/components/Editor.svelte +136 -66
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +56 -45
- package/components/FlowBuilder.svelte +155 -70
- package/components/FlowEditor.svelte +79 -200
- package/components/FlowEditor.svelte.d.ts +3 -2
- package/components/FlowJobResult.svelte +1 -1
- package/components/FlowPreview.svelte +18 -24
- package/components/FlowPreviewContent.svelte +68 -0
- package/components/FlowPreviewContent.svelte.d.ts +21 -0
- package/components/FlowStatusViewer.svelte +85 -37
- package/components/FlowStatusViewer.svelte.d.ts +3 -2
- package/components/FlowViewer.svelte +85 -45
- package/components/FlowViewer.svelte.d.ts +2 -1
- package/components/IconedResourceType.svelte +30 -5
- package/components/InputTransformForm.svelte +209 -0
- package/components/InputTransformForm.svelte.d.ts +26 -0
- package/components/InputTransformsViewer.svelte +19 -0
- package/components/InputTransformsViewer.svelte.d.ts +17 -0
- package/components/InviteGlobalUser.svelte +2 -2
- package/components/InviteUser.svelte +2 -2
- package/components/JobStatus.svelte +32 -25
- package/components/Modal.svelte +44 -42
- package/components/ModuleStep.svelte +94 -79
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +1 -0
- package/components/Path.svelte.d.ts +1 -1
- package/components/RadioButton.svelte +11 -96
- package/components/RadioButton.svelte.d.ts +4 -2
- package/components/ResourceEditor.svelte +4 -5
- package/components/ResourceEditor.svelte.d.ts +2 -2
- package/components/ResourcePicker.svelte +25 -2
- package/components/ResourcePicker.svelte.d.ts +3 -0
- package/components/ResourceTypePicker.svelte +17 -29
- package/components/ResourceTypePicker.svelte.d.ts +1 -0
- package/components/RunForm.svelte +14 -15
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/SchemaEditor.svelte +87 -71
- package/components/SchemaEditor.svelte.d.ts +2 -0
- package/components/SchemaEditorProperty.svelte +11 -0
- package/components/SchemaEditorProperty.svelte.d.ts +17 -0
- package/components/SchemaForm.svelte +21 -127
- package/components/SchemaForm.svelte.d.ts +3 -4
- package/components/SchemaModal.svelte +20 -33
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/SchemaViewer.svelte +4 -6
- package/components/ScriptBuilder.svelte +40 -43
- package/components/ScriptEditor.svelte +71 -66
- package/components/ScriptPicker.svelte +10 -12
- package/components/ScriptPicker.svelte.d.ts +1 -1
- package/components/ScriptSchema.svelte +0 -5
- package/components/ShareModal.svelte +1 -1
- package/components/SharedBadge.svelte +12 -10
- package/components/StringTypeNarrowing.svelte +8 -4
- package/components/StringTypeNarrowing.svelte.d.ts +1 -0
- package/components/TableCustom.svelte +7 -9
- package/components/TableSimple.svelte +1 -1
- package/components/Toggle.svelte +8 -10
- package/components/Toggle.svelte.d.ts +5 -11
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +21 -6
- package/components/flows/CopyFirstStepSchema.svelte +7 -5
- package/components/flows/DynamicInputHelpBox.svelte +1 -1
- package/components/flows/FlowBox.svelte +3 -0
- package/components/flows/FlowBox.svelte.d.ts +23 -0
- package/components/flows/FlowBoxHeader.svelte +9 -0
- package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
- package/components/flows/FlowInput.svelte +20 -0
- package/components/flows/FlowInput.svelte.d.ts +14 -0
- package/components/flows/FlowInputs.svelte +7 -3
- package/components/flows/FlowModuleHeader.svelte +42 -40
- package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
- package/components/flows/FlowSettings.svelte +174 -0
- package/components/flows/FlowSettings.svelte.d.ts +21 -0
- package/components/flows/flowStore.d.ts +5 -2
- package/components/flows/flowStore.js +65 -9
- package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
- package/components/flows/utils.d.ts +11 -7
- package/components/flows/utils.js +114 -45
- package/components/icons/AirtableIcon.svelte +17 -0
- package/components/icons/AirtableIcon.svelte.d.ts +17 -0
- package/components/icons/GCloudIcon.svelte +16 -0
- package/components/icons/GCloudIcon.svelte.d.ts +17 -0
- package/components/icons/GItlabIcon.svelte +16 -0
- package/components/icons/GItlabIcon.svelte.d.ts +17 -0
- package/components/icons/GSheetsIcon.svelte +16 -0
- package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
- package/components/icons/GcalIcon.svelte +16 -0
- package/components/icons/GcalIcon.svelte.d.ts +17 -0
- package/components/icons/GdriveIcon.svelte +16 -0
- package/components/icons/GdriveIcon.svelte.d.ts +17 -0
- package/components/icons/GmailIcon.svelte +16 -0
- package/components/icons/GmailIcon.svelte.d.ts +17 -0
- package/components/icons/PostgresIcon.svelte +8 -49
- package/components/icons/Slack.svelte +9 -18
- package/components/icons/TogglIcon.svelte +59 -0
- package/components/icons/TogglIcon.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +35 -37
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +2 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
- package/components/propertyPicker/PropPicker.svelte +13 -15
- package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
- package/components/propertyPicker/WarningMessage.svelte +14 -41
- package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
- package/components/propertyPicker/utils.d.ts +1 -0
- package/components/propertyPicker/utils.js +25 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +11 -2
- package/gen/index.js +1 -2
- package/gen/models/CompletedJob.d.ts +1 -1
- package/gen/models/Flow.d.ts +3 -13
- package/gen/models/FlowMetadata.d.ts +9 -0
- package/gen/models/FlowMetadata.js +4 -0
- package/gen/models/FlowModuleValue.d.ts +5 -22
- package/gen/models/FlowModuleValue.js +1 -15
- package/gen/models/ForloopFlow.d.ts +8 -0
- package/gen/models/ForloopFlow.js +4 -0
- package/gen/models/InputTransform.d.ts +3 -12
- package/gen/models/InputTransform.js +1 -8
- package/gen/models/JavascriptTransform.d.ts +4 -0
- package/gen/models/JavascriptTransform.js +4 -0
- package/gen/models/MainArgSignature.d.ts +1 -1
- package/gen/models/NewSchedule.d.ts +1 -0
- package/gen/models/OpenFlowWPath.d.ts +4 -0
- package/gen/models/OpenFlowWPath.js +4 -0
- package/gen/models/PathFlow.d.ts +4 -0
- package/gen/models/PathFlow.js +4 -0
- package/gen/models/PathScript.d.ts +4 -0
- package/gen/models/PathScript.js +4 -0
- package/gen/models/RawScript.d.ts +12 -0
- package/gen/models/RawScript.js +11 -0
- package/gen/models/Schedule.d.ts +1 -1
- package/gen/models/StaticTransform.d.ts +4 -0
- package/gen/models/StaticTransform.js +4 -0
- package/gen/models/TokenResponse.d.ts +3 -3
- package/gen/models/Usage.d.ts +5 -0
- package/gen/models/Usage.js +4 -0
- package/gen/models/User.d.ts +2 -0
- package/gen/schemas/$AuditLog.d.ts +32 -0
- package/gen/schemas/$AuditLog.js +35 -0
- package/gen/schemas/$CompletedJob.d.ts +98 -0
- package/gen/schemas/$CompletedJob.js +103 -0
- package/gen/schemas/$ContextualVariable.d.ts +16 -0
- package/gen/schemas/$ContextualVariable.js +19 -0
- package/gen/schemas/$CreateResource.d.ts +22 -0
- package/gen/schemas/$CreateResource.js +25 -0
- package/gen/schemas/$CreateVariable.d.ts +26 -0
- package/gen/schemas/$CreateVariable.js +29 -0
- package/gen/schemas/$CreateWorkspace.d.ts +20 -0
- package/gen/schemas/$CreateWorkspace.js +23 -0
- package/gen/schemas/$EditResource.d.ts +13 -0
- package/gen/schemas/$EditResource.js +16 -0
- package/gen/schemas/$EditResourceType.d.ts +10 -0
- package/gen/schemas/$EditResourceType.js +13 -0
- package/gen/schemas/$EditSchedule.d.ts +20 -0
- package/gen/schemas/$EditSchedule.js +23 -0
- package/gen/schemas/$EditVariable.d.ts +16 -0
- package/gen/schemas/$EditVariable.js +19 -0
- package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
- package/gen/schemas/$EditWorkspaceUser.js +10 -0
- package/gen/schemas/$Flow.d.ts +23 -0
- package/gen/schemas/$Flow.js +26 -0
- package/gen/schemas/$FlowMetadata.d.ts +31 -0
- package/gen/schemas/$FlowMetadata.js +34 -0
- package/gen/schemas/$FlowPreview.d.ts +80 -0
- package/gen/schemas/$FlowPreview.js +83 -0
- package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
- package/gen/schemas/$GlobalUserInfo.js +29 -0
- package/gen/schemas/$Group.d.ts +23 -0
- package/gen/schemas/$Group.js +26 -0
- package/gen/schemas/$Job.d.ts +17 -0
- package/gen/schemas/$Job.js +20 -0
- package/gen/schemas/$ListableVariable.d.ts +35 -0
- package/gen/schemas/$ListableVariable.js +38 -0
- package/gen/schemas/$Login.d.ts +12 -0
- package/gen/schemas/$Login.js +15 -0
- package/gen/schemas/$MainArgSignature.d.ts +50 -0
- package/gen/schemas/$MainArgSignature.js +53 -0
- package/gen/schemas/$NewSchedule.d.ts +30 -0
- package/gen/schemas/$NewSchedule.js +33 -0
- package/gen/schemas/$NewToken.d.ts +11 -0
- package/gen/schemas/$NewToken.js +14 -0
- package/gen/schemas/$NewUser.d.ts +16 -0
- package/gen/schemas/$NewUser.js +19 -0
- package/gen/schemas/$Preview.d.ts +19 -0
- package/gen/schemas/$Preview.js +22 -0
- package/gen/schemas/$QueuedJob.d.ts +139 -0
- package/gen/schemas/$QueuedJob.js +144 -0
- package/gen/schemas/$Resource.d.ts +31 -0
- package/gen/schemas/$Resource.js +34 -0
- package/gen/schemas/$ResourceType.d.ts +17 -0
- package/gen/schemas/$ResourceType.js +20 -0
- package/gen/schemas/$Schedule.d.ts +47 -0
- package/gen/schemas/$Schedule.js +50 -0
- package/gen/schemas/$Script.d.ts +77 -0
- package/gen/schemas/$Script.js +80 -0
- package/gen/schemas/$ScriptArgs.d.ts +6 -0
- package/gen/schemas/$ScriptArgs.js +9 -0
- package/gen/schemas/$SlackToken.d.ts +24 -0
- package/gen/schemas/$SlackToken.js +27 -0
- package/gen/schemas/$TokenResponse.d.ts +23 -0
- package/gen/schemas/$TokenResponse.js +26 -0
- package/gen/schemas/$TruncatedToken.d.ts +25 -0
- package/gen/schemas/$TruncatedToken.js +28 -0
- package/gen/schemas/$Usage.d.ts +13 -0
- package/gen/schemas/$Usage.js +16 -0
- package/gen/schemas/$User.d.ts +42 -0
- package/gen/schemas/$User.js +45 -0
- package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
- package/gen/schemas/$UserWorkspaceList.js +31 -0
- package/gen/schemas/$WorkerPing.d.ts +31 -0
- package/gen/schemas/$WorkerPing.js +34 -0
- package/gen/schemas/$Workspace.d.ts +19 -0
- package/gen/schemas/$Workspace.js +22 -0
- package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
- package/gen/schemas/$WorkspaceInvite.js +19 -0
- package/gen/services/FlowService.d.ts +24 -23
- package/gen/services/FlowService.js +14 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -19
- package/gen/services/ScriptService.js +0 -14
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +85 -16
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +11 -13
- package/sql.d.ts +89 -0
- package/sql.js +817 -0
- package/stores.d.ts +0 -1
- package/stores.js +0 -6
- package/utils.d.ts +12 -5
- package/utils.js +55 -9
- package/components/RadioButtonV2.svelte +0 -33
- package/components/RadioButtonV2.svelte.d.ts +0 -20
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<script>import { sendUserToast } from '../../utils';
|
|
2
|
+
import { faFileExport, faFileImport, faGlobe } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { Dropdown, DropdownItem } from 'flowbite-svelte';
|
|
4
|
+
import Icon from 'svelte-awesome';
|
|
5
|
+
import Editor from '../Editor.svelte';
|
|
6
|
+
import FlowViewer from '../FlowViewer.svelte';
|
|
7
|
+
import Modal from '../Modal.svelte';
|
|
8
|
+
import RadioButton from '../RadioButton.svelte';
|
|
9
|
+
import CollapseLink from './../CollapseLink.svelte';
|
|
10
|
+
import CronInput from './../CronInput.svelte';
|
|
11
|
+
import FlowBox from './../flows/FlowBox.svelte';
|
|
12
|
+
import { flowStore, initFlow, mode } from './../flows/flowStore';
|
|
13
|
+
import { flowToMode } from './../flows/utils';
|
|
14
|
+
import Path from './../Path.svelte';
|
|
15
|
+
import Required from './../Required.svelte';
|
|
16
|
+
import SchemaForm from './../SchemaForm.svelte';
|
|
17
|
+
import Toggle from './../Toggle.svelte';
|
|
18
|
+
import Tooltip from './../Tooltip.svelte';
|
|
19
|
+
import FlowBoxHeader from './FlowBoxHeader.svelte';
|
|
20
|
+
export let pathError = '';
|
|
21
|
+
export let initialPath = '';
|
|
22
|
+
export let scheduleArgs = {};
|
|
23
|
+
export let scheduleEnabled = false;
|
|
24
|
+
export let scheduleCron = '0 */5 * * *';
|
|
25
|
+
export let open;
|
|
26
|
+
let jsonSetter;
|
|
27
|
+
let jsonViewer;
|
|
28
|
+
let jsonValue = '';
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Modal bind:this={jsonSetter}>
|
|
32
|
+
<div slot="title">Import JSON</div>
|
|
33
|
+
<div slot="content" class="h-full">
|
|
34
|
+
<Editor bind:code={jsonValue} lang={'json'} class="h-full" />
|
|
35
|
+
</div>
|
|
36
|
+
<div slot="submission">
|
|
37
|
+
<button
|
|
38
|
+
class="default-button px-4 py-2 font-semibold"
|
|
39
|
+
on:click={() => {
|
|
40
|
+
Object.assign($flowStore, JSON.parse(jsonValue))
|
|
41
|
+
initFlow($flowStore)
|
|
42
|
+
open = -1
|
|
43
|
+
sendUserToast('OpenFlow imported from JSON')
|
|
44
|
+
jsonSetter.closeModal()
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
Import
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
</Modal>
|
|
51
|
+
|
|
52
|
+
<Modal bind:this={jsonViewer}>
|
|
53
|
+
<div slot="title">See JSON</div>
|
|
54
|
+
<div slot="content" class="h-full">
|
|
55
|
+
<FlowViewer flow={flowToMode($flowStore, $mode)} tab="json" />
|
|
56
|
+
</div>
|
|
57
|
+
</Modal>
|
|
58
|
+
|
|
59
|
+
<FlowBox>
|
|
60
|
+
<FlowBoxHeader title="Flow Settings">
|
|
61
|
+
<div class="flex flex-row-reverse">
|
|
62
|
+
<Dropdown class="w-fit" placement="bottom-end">
|
|
63
|
+
<button slot="trigger" class="text-gray-900 bg-white dark:text-white dark:bg-gray-800">
|
|
64
|
+
...
|
|
65
|
+
</button>
|
|
66
|
+
<DropdownItem
|
|
67
|
+
on:click={() => {
|
|
68
|
+
jsonSetter.openModal()
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Icon data={faFileImport} scale={0.6} class="inline mr-2" />
|
|
72
|
+
Import from a JSON OpenFlow
|
|
73
|
+
</DropdownItem>
|
|
74
|
+
<DropdownItem
|
|
75
|
+
on:click={() => {
|
|
76
|
+
jsonViewer.openModal()
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<Icon data={faFileExport} scale={0.6} class="inline mr-2" />
|
|
80
|
+
Export to a JSON OpenFlow
|
|
81
|
+
</DropdownItem>
|
|
82
|
+
<DropdownItem
|
|
83
|
+
on:click={() => {
|
|
84
|
+
const url = new URL('https://hub.windmill.dev/flows/add')
|
|
85
|
+
const openFlow = {
|
|
86
|
+
value: $flowStore.value,
|
|
87
|
+
summary: $flowStore.summary,
|
|
88
|
+
description: $flowStore.description,
|
|
89
|
+
schema: $flowStore.schema
|
|
90
|
+
}
|
|
91
|
+
url.searchParams.append('flow', btoa(JSON.stringify(flowToMode(openFlow, $mode))))
|
|
92
|
+
window.open(url, '_blank')?.focus()
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
<Icon data={faGlobe} scale={0.6} class="inline mr-2" />
|
|
96
|
+
Publish to Hub
|
|
97
|
+
</DropdownItem>
|
|
98
|
+
</Dropdown>
|
|
99
|
+
</div>
|
|
100
|
+
</FlowBoxHeader>
|
|
101
|
+
|
|
102
|
+
<div class="p-6">
|
|
103
|
+
<Path
|
|
104
|
+
bind:error={pathError}
|
|
105
|
+
bind:path={$flowStore.path}
|
|
106
|
+
{initialPath}
|
|
107
|
+
namePlaceholder="my_flow"
|
|
108
|
+
kind="flow"
|
|
109
|
+
>
|
|
110
|
+
<div slot="ownerToolkit">
|
|
111
|
+
Flow permissions depend on their path. Select the group <span class="font-mono">all</span>
|
|
112
|
+
to share your flow, and <span class="font-mono">user</span> to keep it private.
|
|
113
|
+
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
114
|
+
</div>
|
|
115
|
+
</Path>
|
|
116
|
+
|
|
117
|
+
<label class="block mt-4">
|
|
118
|
+
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
119
|
+
<textarea
|
|
120
|
+
bind:value={$flowStore.summary}
|
|
121
|
+
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
122
|
+
placeholder="A very short summary of the flow displayed when the flow is listed"
|
|
123
|
+
rows="1"
|
|
124
|
+
/>
|
|
125
|
+
</label>
|
|
126
|
+
|
|
127
|
+
<div class="mt-4">
|
|
128
|
+
<RadioButton
|
|
129
|
+
options={[
|
|
130
|
+
[
|
|
131
|
+
{
|
|
132
|
+
title: 'UI or webhook triggered',
|
|
133
|
+
desc: 'Trigger this flow through the generated UI, a manual schedule or by calling the associated webhook'
|
|
134
|
+
},
|
|
135
|
+
'push'
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
title: 'Watching changes regularly',
|
|
140
|
+
desc: 'The first module of this flow is a trigger script whose purpose is to pull data from an external source and return all new items since last run. This flow is meant to be scheduled very regularly to reduce latency to react to new events. It will trigger the rest of the flow once per item. If no new items, the flow will be skipped.'
|
|
141
|
+
},
|
|
142
|
+
'pull'
|
|
143
|
+
]
|
|
144
|
+
]}
|
|
145
|
+
bind:value={$mode}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
{#if $mode == 'pull'}
|
|
149
|
+
<CollapseLink text="set primary schedule" open={true}>
|
|
150
|
+
<Tooltip>
|
|
151
|
+
The primary schedule of a flow is simply a schedule that has the same name as a flow. It
|
|
152
|
+
can be set and enabled directly within the flow editor. "Watching for new changes" flows
|
|
153
|
+
are meant to be watching regularly for new items in an external systems. The primary
|
|
154
|
+
schedule purpose is there to set the periodicity at which you want this watcher to
|
|
155
|
+
operate.
|
|
156
|
+
</Tooltip>
|
|
157
|
+
<Toggle
|
|
158
|
+
bind:checked={scheduleEnabled}
|
|
159
|
+
options={{
|
|
160
|
+
left: 'disabled',
|
|
161
|
+
right: 'enabled'
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
<div class="p-2 mt-2 rounded" class:bg-gray-300={!scheduleEnabled}>
|
|
165
|
+
{#if !scheduleEnabled}
|
|
166
|
+
<span class="font-black">No next scheduled run when disabled</span>
|
|
167
|
+
{/if}
|
|
168
|
+
<CronInput bind:schedule={scheduleCron} />
|
|
169
|
+
</div>
|
|
170
|
+
<SchemaForm schema={$flowStore.schema} bind:args={scheduleArgs} />
|
|
171
|
+
</CollapseLink>
|
|
172
|
+
{/if}
|
|
173
|
+
</div>
|
|
174
|
+
</FlowBox>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
pathError?: string | undefined;
|
|
5
|
+
initialPath?: string | undefined;
|
|
6
|
+
scheduleArgs?: Record<string, any> | undefined;
|
|
7
|
+
scheduleEnabled?: boolean | undefined;
|
|
8
|
+
scheduleCron?: string | undefined;
|
|
9
|
+
open: number;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export declare type FlowSettingsProps = typeof __propDef.props;
|
|
17
|
+
export declare type FlowSettingsEvents = typeof __propDef.events;
|
|
18
|
+
export declare type FlowSettingsSlots = typeof __propDef.slots;
|
|
19
|
+
export default class FlowSettings extends SvelteComponentTyped<FlowSettingsProps, FlowSettingsEvents, FlowSettingsSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { Schema } from '../../common';
|
|
2
|
-
import {
|
|
2
|
+
import { RawScript, type Flow } from '../../gen';
|
|
3
3
|
export declare type FlowMode = 'push' | 'pull';
|
|
4
|
+
export declare const mode: import("svelte/store").Writable<FlowMode>;
|
|
4
5
|
export declare const flowStore: import("svelte/store").Writable<Flow>;
|
|
5
6
|
export declare const schemasStore: import("svelte/store").Writable<Schema[]>;
|
|
6
7
|
export declare function initFlow(flow: Flow): void;
|
|
8
|
+
export declare function codeToStaticTemplate(code?: string): string | undefined;
|
|
9
|
+
export declare function flattenForloopFlows(flow: Flow): Flow;
|
|
7
10
|
export declare const isCopyFirstStepSchemaDisabled: import("svelte/store").Readable<boolean>;
|
|
8
11
|
export declare function addModule(i?: number): void;
|
|
9
12
|
export declare function pickScript(path: string, step: number): Promise<void>;
|
|
10
|
-
export declare function createInlineScriptModule(language:
|
|
13
|
+
export declare function createInlineScriptModule(language: RawScript.language, step: number, mode: FlowMode): Promise<void>;
|
|
11
14
|
export declare function loadSchema(step: number): Promise<void>;
|
|
12
15
|
export declare function fork(step: number): Promise<void>;
|
|
13
16
|
export declare function createScriptFromInlineScript(step: number): Promise<void>;
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawScript, ScriptService } from '../../gen';
|
|
2
2
|
import { initialCode } from '../../script_helpers';
|
|
3
3
|
import { userStore, workspaceStore } from '../../stores';
|
|
4
|
+
import { emptySchema } from '../../utils';
|
|
4
5
|
import { derived, get, writable } from 'svelte/store';
|
|
5
6
|
import { createInlineScriptModuleFromPath, getFirstStepSchema, loadSchemaFromModule, scrollIntoView } from './utils';
|
|
7
|
+
export const mode = writable('push');
|
|
6
8
|
export const flowStore = writable(undefined);
|
|
7
9
|
export const schemasStore = writable([]);
|
|
8
10
|
export function initFlow(flow) {
|
|
11
|
+
const newMode = flow.value.modules[1]?.value.type === 'forloopflow' ? 'pull' : 'push';
|
|
12
|
+
mode.set(newMode);
|
|
13
|
+
flow = flattenForloopFlows(flow);
|
|
14
|
+
flow.value.modules.forEach((mod) => {
|
|
15
|
+
Object.values(mod.input_transform).forEach((inp) => {
|
|
16
|
+
if (inp.type == 'javascript') {
|
|
17
|
+
// for now we use the value for dynamic expression when done in the static editor so we have to resort to this
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
inp.value = codeToStaticTemplate(inp.expr);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
9
23
|
schemasStore.set([]);
|
|
10
24
|
flowStore.set(flow);
|
|
11
25
|
// For each module in flow, we should load the corresponding schema
|
|
@@ -13,11 +27,36 @@ export function initFlow(flow) {
|
|
|
13
27
|
loadSchema(index);
|
|
14
28
|
});
|
|
15
29
|
}
|
|
30
|
+
export function codeToStaticTemplate(code) {
|
|
31
|
+
if (!code)
|
|
32
|
+
return undefined;
|
|
33
|
+
const lines = code
|
|
34
|
+
.split('\n')
|
|
35
|
+
.slice(1)
|
|
36
|
+
.filter((x) => x != '');
|
|
37
|
+
if (lines.length == 1) {
|
|
38
|
+
const line = lines[0].trim();
|
|
39
|
+
if (line[0] == '`' && line.charAt(line.length - 1) == '`') {
|
|
40
|
+
return line.slice(1, line.length - 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
export function flattenForloopFlows(flow) {
|
|
46
|
+
let newFlow = JSON.parse(JSON.stringify(flow));
|
|
47
|
+
const mod = newFlow.value.modules[1]?.value;
|
|
48
|
+
if (mod?.type === 'forloopflow') {
|
|
49
|
+
const oldModules = mod.value?.modules ?? [];
|
|
50
|
+
newFlow.value.modules = newFlow.value.modules.slice(0, 1);
|
|
51
|
+
newFlow.value.modules.push(...oldModules);
|
|
52
|
+
}
|
|
53
|
+
return newFlow;
|
|
54
|
+
}
|
|
16
55
|
export const isCopyFirstStepSchemaDisabled = derived(flowStore, (flow) => {
|
|
17
56
|
if (flow) {
|
|
18
57
|
const modules = flow.value.modules;
|
|
19
58
|
const [firstModule] = modules;
|
|
20
|
-
return (modules.length === 0 || (firstModule.value.
|
|
59
|
+
return (modules.length === 0 || (firstModule.value.type === 'script' && firstModule.value.path === ''));
|
|
21
60
|
}
|
|
22
61
|
else {
|
|
23
62
|
return true;
|
|
@@ -25,7 +64,7 @@ export const isCopyFirstStepSchemaDisabled = derived(flowStore, (flow) => {
|
|
|
25
64
|
});
|
|
26
65
|
export function addModule(i) {
|
|
27
66
|
const newModule = {
|
|
28
|
-
value: { type:
|
|
67
|
+
value: { type: 'script', path: '' },
|
|
29
68
|
input_transform: {}
|
|
30
69
|
};
|
|
31
70
|
flowStore.update((flow) => {
|
|
@@ -35,23 +74,34 @@ export function addModule(i) {
|
|
|
35
74
|
setTimeout(() => scrollIntoView(document.querySelector(`#module-${insertAt}`)), 100);
|
|
36
75
|
return flow;
|
|
37
76
|
});
|
|
77
|
+
schemasStore.update((schemas) => {
|
|
78
|
+
if (typeof i !== 'undefined') {
|
|
79
|
+
const previousSchema = schemas[i];
|
|
80
|
+
const hadSchema = Boolean(previousSchema);
|
|
81
|
+
if (hadSchema) {
|
|
82
|
+
schemas[i] = emptySchema();
|
|
83
|
+
schemas[i + 1] = previousSchema;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return schemas;
|
|
87
|
+
});
|
|
38
88
|
}
|
|
39
89
|
export async function pickScript(path, step) {
|
|
40
90
|
flowStore.update((flow) => {
|
|
41
91
|
if (flow.value.modules[step]) {
|
|
42
|
-
flow.value.modules[step].value
|
|
92
|
+
flow.value.modules[step].value = { type: 'script', path };
|
|
43
93
|
}
|
|
44
94
|
return flow;
|
|
45
95
|
});
|
|
46
96
|
await loadSchema(step);
|
|
47
97
|
}
|
|
48
98
|
export async function createInlineScriptModule(language, step, mode) {
|
|
49
|
-
const code = initialCode(language,
|
|
99
|
+
const code = initialCode(language, mode === 'pull' && step == 0);
|
|
50
100
|
flowStore.update((flow) => {
|
|
51
101
|
flow.value.modules[step].value = {
|
|
52
|
-
type:
|
|
102
|
+
type: 'rawscript',
|
|
53
103
|
content: code,
|
|
54
|
-
language
|
|
104
|
+
language
|
|
55
105
|
};
|
|
56
106
|
return flow;
|
|
57
107
|
});
|
|
@@ -73,6 +123,9 @@ export async function loadSchema(step) {
|
|
|
73
123
|
export async function fork(step) {
|
|
74
124
|
const flow = get(flowStore);
|
|
75
125
|
const flowModuleValue = flow.value.modules[step].value;
|
|
126
|
+
if (flowModuleValue.type !== 'script') {
|
|
127
|
+
throw new Error('Can only fork a script module');
|
|
128
|
+
}
|
|
76
129
|
if (flowModuleValue.path) {
|
|
77
130
|
const moduleValue = await createInlineScriptModuleFromPath(flowModuleValue.path);
|
|
78
131
|
flowStore.update((flow) => {
|
|
@@ -86,6 +139,9 @@ export async function createScriptFromInlineScript(step) {
|
|
|
86
139
|
const schemas = get(schemasStore);
|
|
87
140
|
const user = get(userStore);
|
|
88
141
|
const flowModuleValue = flow.value.modules[step].value;
|
|
142
|
+
if (flowModuleValue.type != 'rawscript') {
|
|
143
|
+
throw new Error("Can't create script from non-inline script");
|
|
144
|
+
}
|
|
89
145
|
const originalScriptPath = flowModuleValue.path;
|
|
90
146
|
const wasForked = Boolean(originalScriptPath);
|
|
91
147
|
let suffix = `step-${step}`;
|
|
@@ -112,7 +168,7 @@ export async function createScriptFromInlineScript(step) {
|
|
|
112
168
|
});
|
|
113
169
|
flowStore.update((flow) => {
|
|
114
170
|
flow.value.modules[step].value = {
|
|
115
|
-
type:
|
|
171
|
+
type: 'script',
|
|
116
172
|
path: availablePath
|
|
117
173
|
};
|
|
118
174
|
return flow;
|
|
@@ -157,5 +213,5 @@ export async function findNextAvailablePath(path) {
|
|
|
157
213
|
}
|
|
158
214
|
export function shouldPickOrCreateScript(flow, step) {
|
|
159
215
|
const module = flow.value.modules[step];
|
|
160
|
-
return module.value.
|
|
216
|
+
return module.value.type === 'script' && module.value.path === '';
|
|
161
217
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { Tooltip } from 'flowbite-svelte';
|
|
2
|
+
import Icon from 'svelte-awesome';
|
|
2
3
|
export let disabled = false;
|
|
3
4
|
export let icon;
|
|
4
5
|
export let label;
|
|
5
6
|
export let iconColor;
|
|
7
|
+
export let tooltip = undefined;
|
|
6
8
|
</script>
|
|
7
9
|
|
|
8
10
|
<button {disabled} type="button" on:click class="default-secondary-button-v2 mb-2 w-full">
|
|
9
11
|
<Icon data={icon} class={`w-4 h-4 mr-2 -ml-2 ${iconColor}`} />
|
|
10
12
|
{label}
|
|
13
|
+
{#if tooltip}
|
|
14
|
+
<Tooltip placement="bottom" content={tooltip}>(?)</Tooltip>
|
|
15
|
+
{/if}
|
|
11
16
|
</button>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Schema } from '../../common';
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
export declare function flowToMode(flow: Flow, mode: FlowMode): Flow;
|
|
5
|
-
export declare function flattenForloopFlows(flow: Flow): Flow;
|
|
2
|
+
import { type Flow, type FlowModule, type FlowModuleValue, type InputTransform, type Job } from '../../gen';
|
|
3
|
+
import { type FlowMode } from './flowStore';
|
|
4
|
+
export declare function flowToMode(flow: Flow | any, mode: FlowMode): Flow;
|
|
6
5
|
export declare function getTypeAsString(arg: any): string;
|
|
7
|
-
export declare function formatValue(arg: any): any;
|
|
8
6
|
export declare function getFirstStepSchema(flow: Flow): Promise<Schema>;
|
|
9
7
|
export declare function createInlineScriptModuleFromPath(path: string): Promise<FlowModuleValue>;
|
|
10
8
|
export declare function scrollIntoView(el: any): void;
|
|
@@ -13,5 +11,11 @@ export declare function loadSchemaFromModule(module: FlowModule): Promise<{
|
|
|
13
11
|
schema: Schema;
|
|
14
12
|
}>;
|
|
15
13
|
export declare function isCodeInjection(expr: string | undefined): boolean;
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
14
|
+
export declare function getDefaultExpr(i: number, key?: string, previousExpr?: string): string;
|
|
15
|
+
export declare function getPickableProperties(schema: Schema, args: Record<string, any>, previewResults: Record<number, Object>, mode: FlowMode, i: number): {
|
|
16
|
+
flow_input: any;
|
|
17
|
+
previous_result: any;
|
|
18
|
+
step: any[];
|
|
19
|
+
};
|
|
20
|
+
export declare function jobsToResults(jobs: Job[]): any;
|
|
21
|
+
export declare function runFlowPreview(args: Record<string, any>, flow: Flow): Promise<string>;
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JobService } from '../../gen';
|
|
2
2
|
import { inferArgs } from '../../infer';
|
|
3
3
|
import { loadSchema } from '../../scripts';
|
|
4
|
-
import {
|
|
4
|
+
import { workspaceStore } from '../../stores';
|
|
5
|
+
import { emptySchema, getScriptByPath, schemaToObject } from '../../utils';
|
|
6
|
+
import { get } from 'svelte/store';
|
|
7
|
+
import { mode } from './flowStore';
|
|
5
8
|
export function flowToMode(flow, mode) {
|
|
9
|
+
const newFlow = JSON.parse(JSON.stringify(flow));
|
|
10
|
+
newFlow.value.modules.forEach((mod) => {
|
|
11
|
+
Object.values(mod.input_transform).forEach((inp) => {
|
|
12
|
+
// for now we use the value for dynamic expression when done in the static editor so we have to resort to this
|
|
13
|
+
if (inp.type == 'javascript') {
|
|
14
|
+
//@ts-ignore
|
|
15
|
+
inp.value = undefined;
|
|
16
|
+
inp.expr = inp.expr.split('\n')
|
|
17
|
+
.filter((x) => x != '' && !x.startsWith(`import { previous_result, flow_input, step, variable, resource, params } from 'windmill@`))
|
|
18
|
+
.join('\n');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
//@ts-ignore
|
|
22
|
+
inp.expr = undefined;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
6
26
|
if (mode == 'pull') {
|
|
7
|
-
const newFlow = JSON.parse(JSON.stringify(flow));
|
|
8
27
|
const triggerModule = newFlow.value.modules[0];
|
|
9
28
|
const oldModules = newFlow.value.modules.slice(1);
|
|
10
29
|
if (triggerModule) {
|
|
11
|
-
triggerModule.stop_after_if_expr = 'result.
|
|
30
|
+
triggerModule.stop_after_if_expr = 'result.length == 0';
|
|
12
31
|
triggerModule.skip_if_stopped = true;
|
|
13
32
|
}
|
|
14
33
|
newFlow.value.modules = newFlow.value.modules.slice(0, 1);
|
|
15
34
|
if (oldModules.length > 0) {
|
|
16
35
|
newFlow.value.modules.push({
|
|
17
|
-
|
|
36
|
+
//TODO: once we allow arbitrary for loop, we will also allow arbitrary input transform here
|
|
37
|
+
input_transform: {},
|
|
18
38
|
value: {
|
|
19
|
-
type:
|
|
20
|
-
iterator: { type:
|
|
39
|
+
type: 'forloopflow',
|
|
40
|
+
iterator: { type: 'javascript', expr: 'result' },
|
|
21
41
|
value: {
|
|
22
42
|
modules: oldModules
|
|
23
|
-
}
|
|
43
|
+
},
|
|
44
|
+
skip_failures: true
|
|
24
45
|
}
|
|
25
46
|
});
|
|
26
47
|
}
|
|
27
|
-
return newFlow;
|
|
28
|
-
}
|
|
29
|
-
return flow;
|
|
30
|
-
}
|
|
31
|
-
export function flattenForloopFlows(flow) {
|
|
32
|
-
let newFlow = JSON.parse(JSON.stringify(flow));
|
|
33
|
-
if (newFlow.value.modules[1]?.value.type == FlowModuleValue.type.FORLOOPFLOW) {
|
|
34
|
-
const oldModules = newFlow.value.modules[1].value.value?.modules ?? [];
|
|
35
|
-
newFlow.value.modules = newFlow.value.modules.slice(0, 1);
|
|
36
|
-
newFlow.value.modules.push(...oldModules);
|
|
37
48
|
}
|
|
38
49
|
return newFlow;
|
|
39
50
|
}
|
|
@@ -41,17 +52,14 @@ export function getTypeAsString(arg) {
|
|
|
41
52
|
if (arg === null) {
|
|
42
53
|
return 'null';
|
|
43
54
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export function formatValue(arg) {
|
|
47
|
-
if (getTypeAsString(arg) === 'string') {
|
|
48
|
-
return `"${arg}"`;
|
|
55
|
+
if (arg === undefined) {
|
|
56
|
+
return 'undefined';
|
|
49
57
|
}
|
|
50
|
-
return arg;
|
|
58
|
+
return typeof arg;
|
|
51
59
|
}
|
|
52
60
|
export async function getFirstStepSchema(flow) {
|
|
53
61
|
const [firstModule] = flow.value.modules;
|
|
54
|
-
if (firstModule.value.type ===
|
|
62
|
+
if (firstModule.value.type === 'rawscript') {
|
|
55
63
|
const { language, content } = firstModule.value;
|
|
56
64
|
if (language && content) {
|
|
57
65
|
const schema = emptySchema();
|
|
@@ -59,7 +67,7 @@ export async function getFirstStepSchema(flow) {
|
|
|
59
67
|
return schema;
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
else if (firstModule.value.
|
|
70
|
+
else if (firstModule.value.type == 'script') {
|
|
63
71
|
return await loadSchema(firstModule.value.path);
|
|
64
72
|
}
|
|
65
73
|
return emptySchema();
|
|
@@ -67,7 +75,7 @@ export async function getFirstStepSchema(flow) {
|
|
|
67
75
|
export async function createInlineScriptModuleFromPath(path) {
|
|
68
76
|
const { content, language } = await getScriptByPath(path);
|
|
69
77
|
return {
|
|
70
|
-
type:
|
|
78
|
+
type: 'rawscript',
|
|
71
79
|
language: language,
|
|
72
80
|
content: content,
|
|
73
81
|
path
|
|
@@ -83,25 +91,25 @@ export function scrollIntoView(el) {
|
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
93
|
export async function loadSchemaFromModule(module) {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
94
|
+
const mod = module.value;
|
|
95
|
+
if (mod.type == 'rawscript' || mod.type === 'script') {
|
|
88
96
|
let schema;
|
|
89
|
-
if (
|
|
97
|
+
if (mod.type === 'rawscript') {
|
|
90
98
|
schema = emptySchema();
|
|
91
|
-
await inferArgs(
|
|
99
|
+
await inferArgs(mod.language, mod.content, schema);
|
|
92
100
|
}
|
|
93
101
|
else {
|
|
94
|
-
schema = await loadSchema(
|
|
102
|
+
schema = await loadSchema(mod.path);
|
|
95
103
|
}
|
|
96
104
|
const keys = Object.keys(schema?.properties ?? {});
|
|
97
105
|
let input_transform = module.input_transform;
|
|
98
|
-
if (JSON.stringify(Object.keys(
|
|
99
|
-
JSON.stringify(Object.keys(module.input_transform).sort())) {
|
|
106
|
+
if (JSON.stringify(keys.sort()) !== JSON.stringify(Object.keys(module.input_transform).sort())) {
|
|
100
107
|
input_transform = keys.reduce((accu, key) => {
|
|
101
|
-
|
|
108
|
+
let nv = module.input_transform[key] ?? {
|
|
102
109
|
type: 'static',
|
|
103
110
|
value: undefined
|
|
104
111
|
};
|
|
112
|
+
accu[key] = nv;
|
|
105
113
|
return accu;
|
|
106
114
|
}, {});
|
|
107
115
|
}
|
|
@@ -128,16 +136,77 @@ export function isCodeInjection(expr) {
|
|
|
128
136
|
}
|
|
129
137
|
return false;
|
|
130
138
|
}
|
|
131
|
-
export function
|
|
132
|
-
|
|
133
|
-
if (isRaw) {
|
|
134
|
-
expr = `JSON.parse(${expr})`;
|
|
135
|
-
}
|
|
136
|
-
return `import { previous_result, flow_input, step, variable, resource, params } from 'windmill'
|
|
137
|
-
${expr}`;
|
|
138
|
-
}
|
|
139
|
-
export function getDefaultExpr(i, key = 'myfield') {
|
|
139
|
+
export function getDefaultExpr(i, key = 'myfield', previousExpr) {
|
|
140
|
+
const expr = previousExpr ?? `previous_result.${key}`;
|
|
140
141
|
return `import { previous_result, flow_input, step, variable, resource, params } from 'windmill@${i}'
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
${expr}`;
|
|
144
|
+
}
|
|
145
|
+
export function getPickableProperties(schema, args, previewResults, mode, i) {
|
|
146
|
+
const flowInputAsObject = schemaToObject(schema, args);
|
|
147
|
+
const flowInput = mode === 'pull' && i >= 1
|
|
148
|
+
? computeFlowInputPull(previewResults[0], flowInputAsObject)
|
|
149
|
+
: flowInputAsObject;
|
|
150
|
+
let previous_result;
|
|
151
|
+
if (i === 0 || (i == 1 && mode == 'pull')) {
|
|
152
|
+
previous_result = flowInput;
|
|
153
|
+
}
|
|
154
|
+
else if (mode == 'pull') {
|
|
155
|
+
previous_result = previewResults[1] ? previewResults[1][i - 2] : undefined;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
previous_result = previewResults[i - 1];
|
|
159
|
+
}
|
|
160
|
+
let step;
|
|
161
|
+
if (i >= 1 && mode == 'push') {
|
|
162
|
+
step = Object.values(previewResults).slice(0, i);
|
|
163
|
+
}
|
|
164
|
+
else if (i >= 2 && mode == 'pull') {
|
|
165
|
+
step = Object.values(previewResults[1] ?? {}).slice(0, i - 1);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
step = [];
|
|
169
|
+
}
|
|
170
|
+
const pickableProperties = {
|
|
171
|
+
flow_input: flowInput,
|
|
172
|
+
previous_result,
|
|
173
|
+
step
|
|
174
|
+
};
|
|
175
|
+
return pickableProperties;
|
|
176
|
+
}
|
|
177
|
+
export function jobsToResults(jobs) {
|
|
178
|
+
return jobs.map((job) => {
|
|
179
|
+
if ('result' in job) {
|
|
180
|
+
return job.result;
|
|
181
|
+
}
|
|
182
|
+
else if (Array.isArray(job)) {
|
|
183
|
+
return jobsToResults(job);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
export async function runFlowPreview(args, flow) {
|
|
188
|
+
const newFlow = flowToMode(flow, get(mode));
|
|
189
|
+
return await JobService.runFlowPreview({
|
|
190
|
+
workspace: get(workspaceStore) ?? '',
|
|
191
|
+
requestBody: {
|
|
192
|
+
args,
|
|
193
|
+
value: newFlow.value,
|
|
194
|
+
path: newFlow.path
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function computeFlowInputPull(previewResult, flowInputAsObject) {
|
|
199
|
+
const iteratorValues = (previewResult && Array.isArray(previewResult)) ?
|
|
200
|
+
{
|
|
201
|
+
iter: {
|
|
202
|
+
value: previewResult[0],
|
|
203
|
+
index: `The current index of the iteration as a number (here from 0 to ${previewResult.length - 1})`
|
|
204
|
+
}
|
|
205
|
+
} : {
|
|
206
|
+
iter: {
|
|
207
|
+
value: 'The current value of the iteration as an object',
|
|
208
|
+
index: 'The current index of the iteration as a number'
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
return Object.assign(flowInputAsObject, iteratorValues);
|
|
143
212
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>export let height = '24px';
|
|
2
|
+
export let width = '24px';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
x="0px"
|
|
8
|
+
y="0px"
|
|
9
|
+
{width}
|
|
10
|
+
{height}
|
|
11
|
+
viewBox="0 0 50 50"
|
|
12
|
+
style=" fill:#000000;"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M 24.505859 4.0078125 C 23.980484 4.0080625 23.454344 4.1114062 22.964844 4.3164062 L 4.2226562 11.646484 C 3.4796562 11.959484 3 12.683281 3 13.488281 C 2.999 14.293281 3.4771406 15.017797 4.2441406 15.341797 L 23.236328 22.775391 C 23.613328 22.935391 24.018969 23.013672 24.417969 23.013672 C 24.802969 23.013672 25.181391 22.939875 25.525391 22.796875 L 45.771484 15.330078 C 46.519484 15.018078 47.001953 14.292422 47.001953 13.482422 C 47.000953 12.672422 46.516422 11.949047 45.732422 11.623047 L 26.046875 4.3144531 C 25.556875 4.1104531 25.031234 4.0075625 24.505859 4.0078125 z M 24.498047 6.0097656 C 24.770047 6.0097656 25.0455 6.0647813 25.3125 6.1757812 L 45.041016 13.46875 L 24.794922 20.935547 C 24.551922 21.039547 24.266188 21.039828 23.992188 20.923828 L 4.9765625 13.5 L 23.705078 6.1738281 L 23.728516 6.1640625 C 23.972516 6.0610625 24.233047 6.0097656 24.498047 6.0097656 z M 1.9980469 17.001953 C 0.94204687 17.001953 -2.9605947e-16 17.853906 0 19.003906 L 0 34.970703 C 0 36.129703 0.95195312 36.972656 2.0019531 36.972656 C 2.2979531 36.972656 2.6015312 36.906766 2.8945312 36.759766 L 20.894531 27.998047 C 22.425531 27.232047 22.349531 25.022281 20.769531 24.363281 L 2.7695312 17.15625 C 2.5135313 17.05125 2.2520469 17.001953 1.9980469 17.001953 z M 48.001953 17.001953 C 47.760953 17.001953 47.514484 17.045625 47.271484 17.140625 L 28.271484 24.505859 C 27.505484 24.806859 27 25.544188 27 26.367188 L 27 42.998047 C 27 44.146047 27.940047 45 28.998047 45 C 29.239047 45 29.485516 44.956328 29.728516 44.861328 L 48.728516 37.425781 C 49.495516 37.125781 50 36.387453 50 35.564453 L 50 19.003906 C 50 17.855906 49.059953 17.001953 48.001953 17.001953 z M 2.0058594 19.003906 L 2.0253906 19.013672 L 20.017578 26.201172 L 2 34.970703 L 2.0058594 19.003906 z M 48 19.003906 L 48 35.564453 L 29 42.998047 L 28.994141 26.371094 L 48 19.003906 z"
|
|
16
|
+
/></svg
|
|
17
|
+
>
|