windmill-components 1.21.0 → 1.28.1
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 -66
- 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 +23 -7
- package/components/Editor.svelte +144 -61
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +215 -0
- package/components/EditorBar.svelte.d.ts +23 -0
- package/components/FlowBuilder.svelte +151 -79
- package/components/FlowEditor.svelte +77 -130
- 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 +100 -26
- package/components/FlowViewer.svelte.d.ts +8 -3
- package/components/IconedResourceType.svelte +30 -5
- package/components/InputTransformForm.svelte +209 -0
- package/components/InputTransformForm.svelte.d.ts +26 -0
- package/components/InviteGlobalUser.svelte +2 -2
- package/components/InviteUser.svelte +2 -2
- package/components/JobStatus.svelte +32 -25
- package/components/Modal.svelte +47 -43
- package/components/ModuleStep.svelte +100 -54
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +3 -3
- 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 +5 -6
- 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 +5 -7
- package/components/ScriptBuilder.svelte +41 -44
- package/components/ScriptEditor.svelte +76 -248
- package/components/ScriptPicker.svelte +13 -26
- 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 +56 -82
- package/components/Tooltip.svelte.d.ts +1 -5
- 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 +44 -41
- 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 -11
- package/components/flows/utils.js +103 -63
- 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 +1 -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 +12 -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/OpenFlow.d.ts +7 -0
- package/gen/models/OpenFlow.js +4 -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 +30 -16
- package/gen/services/FlowService.js +25 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -8
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +87 -15
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +7 -6
- package/sql.d.ts +89 -0
- package/sql.js +817 -0
- package/stores.d.ts +1 -1
- package/stores.js +0 -6
- package/utils.d.ts +26 -6
- package/utils.js +94 -7
- package/components/RadioButtonV2.svelte +0 -38
- package/components/RadioButtonV2.svelte.d.ts +0 -20
|
@@ -1,142 +1,89 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { ScheduleService } from '../gen';
|
|
2
|
+
import { workspaceStore } from '../stores';
|
|
3
|
+
import { pathIsEmpty } from '../utils';
|
|
2
4
|
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { Button } from 'flowbite-svelte';
|
|
3
6
|
import Icon from 'svelte-awesome';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { addModule, flowStore } from './flows/flowStore';
|
|
7
|
+
import FlowInput from './flows/FlowInput.svelte';
|
|
8
|
+
import FlowSettings from './flows/FlowSettings.svelte';
|
|
9
|
+
import { addModule, flowStore, mode } from './flows/flowStore';
|
|
7
10
|
import ModuleStep from './ModuleStep.svelte';
|
|
8
|
-
import
|
|
9
|
-
import RadioButtonV2 from './RadioButtonV2.svelte';
|
|
10
|
-
import SchemaEditor from './SchemaEditor.svelte';
|
|
11
|
-
import Required from './Required.svelte';
|
|
12
|
-
import { pathIsEmpty } from '../utils';
|
|
11
|
+
import Tooltip from './Tooltip.svelte';
|
|
13
12
|
export let pathError = '';
|
|
14
13
|
export let initialPath = '';
|
|
14
|
+
export let scheduleArgs = {};
|
|
15
|
+
export let scheduleEnabled = false;
|
|
16
|
+
export let scheduleCron = '0 */5 * * *';
|
|
17
|
+
let scheduleLoaded = false;
|
|
18
|
+
async function loadSchedule() {
|
|
19
|
+
if (!scheduleLoaded) {
|
|
20
|
+
scheduleLoaded = true;
|
|
21
|
+
const existsSchedule = await ScheduleService.existsSchedule({
|
|
22
|
+
workspace: $workspaceStore ?? '',
|
|
23
|
+
path: initialPath
|
|
24
|
+
});
|
|
25
|
+
if (existsSchedule) {
|
|
26
|
+
const schedule = await ScheduleService.getSchedule({
|
|
27
|
+
workspace: $workspaceStore ?? '',
|
|
28
|
+
path: initialPath
|
|
29
|
+
});
|
|
30
|
+
scheduleEnabled = schedule.enabled;
|
|
31
|
+
scheduleCron = schedule.schedule;
|
|
32
|
+
scheduleArgs = schedule.args ?? {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
$: if ($flowStore && $workspaceStore && initialPath != '') {
|
|
37
|
+
loadSchedule();
|
|
38
|
+
}
|
|
15
39
|
let open = 0;
|
|
16
40
|
let args = {};
|
|
17
|
-
export let mode = $flowStore?.value.modules[1]?.value.type == FlowModuleValue.type.FORLOOPFLOW ? 'pull' : 'push';
|
|
18
|
-
$: numberOfSteps = $flowStore?.value.modules.length - 1;
|
|
19
41
|
</script>
|
|
20
42
|
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
43
|
-
</div>
|
|
44
|
-
</Path>
|
|
45
|
-
|
|
46
|
-
<label class="block mt-4">
|
|
47
|
-
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
48
|
-
<textarea
|
|
49
|
-
bind:value={$flowStore.summary}
|
|
50
|
-
class="
|
|
51
|
-
mt-1
|
|
52
|
-
block
|
|
53
|
-
w-full
|
|
54
|
-
rounded-md
|
|
55
|
-
border-gray-300
|
|
56
|
-
shadow-sm
|
|
57
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
58
|
-
"
|
|
59
|
-
placeholder="A very short summary of the flow displayed when the flow is listed"
|
|
60
|
-
rows="1"
|
|
61
|
-
/>
|
|
62
|
-
</label>
|
|
63
|
-
</div>
|
|
64
|
-
<RadioButtonV2
|
|
65
|
-
options={[
|
|
66
|
-
[
|
|
67
|
-
{
|
|
68
|
-
title: 'Push',
|
|
69
|
-
desc: 'Trigger this flow through the generated UI, a manual schedule or by calling the associated webhook'
|
|
70
|
-
},
|
|
71
|
-
'push'
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
{
|
|
75
|
-
title: 'Pull',
|
|
76
|
-
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.'
|
|
77
|
-
},
|
|
78
|
-
'pull'
|
|
79
|
-
]
|
|
80
|
-
]}
|
|
81
|
-
bind:value={mode}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
</li>
|
|
85
|
-
<li class="flex flex-row flex-shrink max-w-full mx-auto mt-20">
|
|
86
|
-
<div class="bg-white border border-gray xl-rounded shadow-lg w-full mx-4 xl:mx-20">
|
|
87
|
-
<div
|
|
88
|
-
class="flex items-center justify-between flex-wra px-4 py-5 border-b border-gray-200 sm:px-6"
|
|
89
|
-
>
|
|
90
|
-
<h3 class="text-lg leading-6 font-medium text-gray-900">Flow Input</h3>
|
|
91
|
-
<CopyFirstStepSchema />
|
|
92
|
-
</div>
|
|
93
|
-
<div class="p-4">
|
|
94
|
-
<SchemaEditor schema={$flowStore.schema} />
|
|
95
|
-
<div class="my-4" />
|
|
96
|
-
<FlowPreview {mode} flow={$flowStore} i={numberOfSteps} bind:args />
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</li>
|
|
100
|
-
{#each $flowStore?.value.modules as mod, i}
|
|
101
|
-
<li class="relative mt-16">
|
|
102
|
-
<div class="relative flex justify-center">
|
|
103
|
-
<button
|
|
104
|
-
class="default-button h-10 w-10 shadow-blue-600/40 border-blue-600 shadow"
|
|
105
|
-
on:click={() => {
|
|
106
|
-
addModule(i)
|
|
107
|
-
open = i
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
<Icon class="text-white mb-1" data={faPlus} />
|
|
111
|
-
</button>
|
|
112
|
-
</div>
|
|
113
|
-
</li>
|
|
114
|
-
<ModuleStep bind:open bind:mod bind:args {i} {mode} />
|
|
115
|
-
{/each}
|
|
116
|
-
<li class="relative m-20 ">
|
|
117
|
-
<div class="relative flex justify-center">
|
|
118
|
-
<button
|
|
119
|
-
disabled={pathIsEmpty($flowStore.path)}
|
|
120
|
-
class="default-button h-10 w-10 shadow"
|
|
121
|
-
on:click={() => {
|
|
122
|
-
addModule()
|
|
123
|
-
open = $flowStore?.value.modules.length - 1
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<Icon class="text-white mb-1" data={faPlus} />
|
|
127
|
-
Add step {pathIsEmpty($flowStore.path) ? '(pick a name first!)' : ''}
|
|
128
|
-
</button>
|
|
43
|
+
{#if $flowStore}
|
|
44
|
+
<div class="flex space-y-8 flex-col items-center line">
|
|
45
|
+
<FlowSettings
|
|
46
|
+
bind:pathError
|
|
47
|
+
bind:initialPath
|
|
48
|
+
bind:scheduleArgs
|
|
49
|
+
bind:scheduleCron
|
|
50
|
+
bind:scheduleEnabled
|
|
51
|
+
bind:open
|
|
52
|
+
/>
|
|
53
|
+
<FlowInput />
|
|
54
|
+
{#each $flowStore?.value.modules as mod, i}
|
|
55
|
+
<ModuleStep bind:open bind:mod bind:args {i} mode={$mode} />
|
|
56
|
+
{#if i == 0 && $mode == 'pull'}
|
|
57
|
+
<div class="flex justify-center bg-white shadow p-2">
|
|
58
|
+
Starting from here, the flow for loop over items from step 1's result above
|
|
59
|
+
<Tooltip>
|
|
60
|
+
This flow being in 'Pull' mode, the rest of the flow will for loop over the list of
|
|
61
|
+
items returned by the trigger script right above. Retrieve the item value using
|
|
62
|
+
`flow_input._value`
|
|
63
|
+
</Tooltip>
|
|
129
64
|
</div>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
65
|
+
{/if}
|
|
66
|
+
{/each}
|
|
67
|
+
<Button
|
|
68
|
+
disabled={pathIsEmpty($flowStore.path)}
|
|
69
|
+
class="blue-button"
|
|
70
|
+
on:click={() => {
|
|
71
|
+
addModule()
|
|
72
|
+
open = $flowStore?.value.modules.length - 1
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<Icon class="text-white mr-2" data={faPlus} />
|
|
76
|
+
Add step {pathIsEmpty($flowStore?.path) ? '(pick a name first!)' : ''}
|
|
77
|
+
</Button>
|
|
78
|
+
</div>
|
|
79
|
+
{:else}
|
|
80
|
+
<h3>Loading flow</h3>
|
|
81
|
+
{/if}
|
|
135
82
|
|
|
136
83
|
<style>
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}</style>
|
|
84
|
+
.line {
|
|
85
|
+
background-image: linear-gradient(#e5e7eb, #e5e7eb);
|
|
86
|
+
background-size: 2px 100%;
|
|
87
|
+
background-repeat: no-repeat;
|
|
88
|
+
background-position: center center;
|
|
89
|
+
}</style>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type FlowMode } from './flows/flowStore';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
pathError?: string | undefined;
|
|
6
5
|
initialPath?: string | undefined;
|
|
7
|
-
|
|
6
|
+
scheduleArgs?: Record<string, any> | undefined;
|
|
7
|
+
scheduleEnabled?: boolean | undefined;
|
|
8
|
+
scheduleCron?: string | undefined;
|
|
8
9
|
};
|
|
9
10
|
events: {
|
|
10
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -14,7 +14,7 @@ export let job;
|
|
|
14
14
|
</div>
|
|
15
15
|
<div>
|
|
16
16
|
<ChevronButton text="logs" viewOptions={true}>
|
|
17
|
-
<div class="text-xs p-4 bg-gray-50 overflow-auto max-h-
|
|
17
|
+
<div class="text-xs p-4 bg-gray-50 overflow-auto max-h-80 border mt-1">
|
|
18
18
|
<pre class="w-full">{job.logs}</pre>
|
|
19
19
|
</div>
|
|
20
20
|
</ChevronButton>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { Job, JobService } from '../gen';
|
|
2
2
|
import { workspaceStore } from '../stores';
|
|
3
3
|
import { sendUserToast, truncateRev } from '../utils';
|
|
4
4
|
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
5
5
|
import { createEventDispatcher, onDestroy } from 'svelte';
|
|
6
6
|
import Icon from 'svelte-awesome';
|
|
7
7
|
import FlowJobResult from './FlowJobResult.svelte';
|
|
8
|
-
import { flowToMode } from './flows/utils';
|
|
8
|
+
import { flowToMode, runFlowPreview } from './flows/utils';
|
|
9
9
|
import FlowStatusViewer from './FlowStatusViewer.svelte';
|
|
10
10
|
import RunForm from './RunForm.svelte';
|
|
11
11
|
import Tabs from './Tabs.svelte';
|
|
@@ -19,23 +19,17 @@ let stepArgs = {};
|
|
|
19
19
|
let tab = 'upto';
|
|
20
20
|
let viewPreview = false;
|
|
21
21
|
let intervalId;
|
|
22
|
-
let uptoText = i
|
|
22
|
+
let uptoText = i >= flow.value.modules.length - 1 ? 'Preview whole flow' : 'Preview up to this step';
|
|
23
23
|
let job;
|
|
24
24
|
let jobs = [];
|
|
25
25
|
let jobId;
|
|
26
|
+
$: dispatch('change', jobs);
|
|
26
27
|
export async function runPreview(args) {
|
|
27
28
|
viewPreview = true;
|
|
28
29
|
intervalId && clearInterval(intervalId);
|
|
29
30
|
let newFlow = flowToMode(flow, mode);
|
|
30
31
|
newFlow = tab == 'upto' ? truncateFlow(newFlow) : extractStep(newFlow);
|
|
31
|
-
jobId = await
|
|
32
|
-
workspace: $workspaceStore ?? '',
|
|
33
|
-
requestBody: {
|
|
34
|
-
args,
|
|
35
|
-
value: newFlow.value,
|
|
36
|
-
path: newFlow.path
|
|
37
|
-
}
|
|
38
|
-
});
|
|
32
|
+
jobId = await runFlowPreview(args, newFlow);
|
|
39
33
|
jobs = [];
|
|
40
34
|
intervalId = setInterval(loadJob, 1000);
|
|
41
35
|
sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
|
|
@@ -51,7 +45,7 @@ function extractStep(flow) {
|
|
|
51
45
|
localFlow.schema = schemas[i];
|
|
52
46
|
stepArgs = {};
|
|
53
47
|
Object.entries(flow.value.modules[i].input_transform).forEach((x) => {
|
|
54
|
-
if (x[1].type ==
|
|
48
|
+
if (x[1].type == 'static') {
|
|
55
49
|
stepArgs[x[0]] = x[1].value;
|
|
56
50
|
}
|
|
57
51
|
});
|
|
@@ -64,7 +58,6 @@ async function loadJob() {
|
|
|
64
58
|
//only CompletedJob has success property
|
|
65
59
|
clearInterval(intervalId);
|
|
66
60
|
}
|
|
67
|
-
dispatch('change', job);
|
|
68
61
|
}
|
|
69
62
|
catch (err) {
|
|
70
63
|
sendUserToast(err, true);
|
|
@@ -75,21 +68,22 @@ onDestroy(() => {
|
|
|
75
68
|
});
|
|
76
69
|
</script>
|
|
77
70
|
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
>
|
|
71
|
+
<button
|
|
72
|
+
class="w-full rounded border-1 border border-gray-200"
|
|
73
|
+
on:click={() => {
|
|
74
|
+
viewPreview = !viewPreview
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<h2 class="flex justify-center text-gray-600">
|
|
85
78
|
<div>
|
|
86
|
-
Preview
|
|
79
|
+
Preview
|
|
80
|
+
<Icon class="ml-1" data={viewPreview ? faChevronUp : faChevronDown} scale={1} />
|
|
87
81
|
</div>
|
|
88
|
-
</
|
|
89
|
-
</
|
|
82
|
+
</h2>
|
|
83
|
+
</button>
|
|
90
84
|
|
|
91
85
|
{#if viewPreview}
|
|
92
|
-
{#if i != flow.value.modules.length
|
|
86
|
+
{#if i != flow.value.modules.length}
|
|
93
87
|
<Tabs
|
|
94
88
|
tabs={[
|
|
95
89
|
['upto', uptoText],
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>import { Job, JobService } from '../gen';
|
|
2
|
+
import { workspaceStore } from '../stores';
|
|
3
|
+
import { sendUserToast, truncateRev } from '../utils';
|
|
4
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { Button } from 'flowbite-svelte';
|
|
6
|
+
import { createEventDispatcher, onDestroy } from 'svelte';
|
|
7
|
+
import Icon from 'svelte-awesome';
|
|
8
|
+
import FlowJobResult from './FlowJobResult.svelte';
|
|
9
|
+
import { flowStore } from './flows/flowStore';
|
|
10
|
+
import { runFlowPreview } from './flows/utils';
|
|
11
|
+
import FlowStatusViewer from './FlowStatusViewer.svelte';
|
|
12
|
+
import SchemaForm from './SchemaForm.svelte';
|
|
13
|
+
const dispatch = createEventDispatcher();
|
|
14
|
+
export let args = {};
|
|
15
|
+
let intervalId;
|
|
16
|
+
let job;
|
|
17
|
+
let jobs = [];
|
|
18
|
+
let jobId;
|
|
19
|
+
let isValid = false;
|
|
20
|
+
$: dispatch('change', jobs);
|
|
21
|
+
export async function runPreview(args) {
|
|
22
|
+
intervalId && clearInterval(intervalId);
|
|
23
|
+
jobId = await runFlowPreview(args, $flowStore);
|
|
24
|
+
jobs = [];
|
|
25
|
+
intervalId = setInterval(loadJob, 1000);
|
|
26
|
+
sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
|
|
27
|
+
}
|
|
28
|
+
async function loadJob() {
|
|
29
|
+
try {
|
|
30
|
+
job = await JobService.getJob({ workspace: $workspaceStore, id: jobId });
|
|
31
|
+
if (job?.type == 'CompletedJob') {
|
|
32
|
+
clearInterval(intervalId);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
sendUserToast(err, true);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
onDestroy(() => {
|
|
40
|
+
intervalId && clearInterval(intervalId);
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div class="flex flex-col space-y-4 h-screen bg-white ">
|
|
45
|
+
<div class="flex flex-col space-y-4 p-6 border-b-2">
|
|
46
|
+
<div class="flex justify-between">
|
|
47
|
+
<h3 class="text-lg leading-6 font-bold text-gray-900">Flow Preview</h3>
|
|
48
|
+
|
|
49
|
+
<Button color="alternative" on:click={() => dispatch('close')}>
|
|
50
|
+
<Icon data={faClose} />
|
|
51
|
+
</Button>
|
|
52
|
+
</div>
|
|
53
|
+
<SchemaForm schema={$flowStore.schema} bind:isValid bind:args />
|
|
54
|
+
<Button disabled={!isValid} class="blue-button" on:click={() => runPreview(args)} size="md">
|
|
55
|
+
Preview
|
|
56
|
+
</Button>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="h-full overflow-y-auto mb-16">
|
|
59
|
+
{#if job}
|
|
60
|
+
<div class="w-full">
|
|
61
|
+
<FlowStatusViewer {job} bind:jobs />
|
|
62
|
+
</div>
|
|
63
|
+
{#if `result` in job}
|
|
64
|
+
<FlowJobResult {job} />
|
|
65
|
+
{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
args?: Record<string, any> | undefined;
|
|
5
|
+
runPreview?: ((args: Record<string, any>) => Promise<void>) | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
close: CustomEvent<any>;
|
|
9
|
+
change: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export declare type FlowPreviewContentProps = typeof __propDef.props;
|
|
16
|
+
export declare type FlowPreviewContentEvents = typeof __propDef.events;
|
|
17
|
+
export declare type FlowPreviewContentSlots = typeof __propDef.slots;
|
|
18
|
+
export default class FlowPreviewContent extends SvelteComponentTyped<FlowPreviewContentProps, FlowPreviewContentEvents, FlowPreviewContentSlots> {
|
|
19
|
+
get runPreview(): (args: Record<string, any>) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,32 +1,59 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import {
|
|
1
|
+
<script>import { scriptPathToHref, truncateRev } from '../utils';
|
|
2
|
+
import { faHourglassHalf, faSpinner, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import Icon from 'svelte-awesome';
|
|
4
4
|
import { check } from 'svelte-awesome/icons';
|
|
5
|
-
import { CompletedJob,
|
|
5
|
+
import { CompletedJob, FlowStatusModule, Job, JobService, QueuedJob } from '../gen';
|
|
6
6
|
import { workspaceStore } from '../stores';
|
|
7
|
-
import JobStatus from './JobStatus.svelte';
|
|
8
7
|
import FlowJobResult from './FlowJobResult.svelte';
|
|
8
|
+
import JobStatus from './JobStatus.svelte';
|
|
9
9
|
export let job;
|
|
10
10
|
export let jobs = [];
|
|
11
|
+
export let fullyRetrieved = -1;
|
|
12
|
+
let lastJobid;
|
|
11
13
|
let forloop_selected = '';
|
|
12
|
-
|
|
14
|
+
let pres = {};
|
|
15
|
+
async function loadResults() {
|
|
16
|
+
if (!('success' in job)) {
|
|
17
|
+
const mods = job?.flow_status?.modules;
|
|
18
|
+
if (mods) {
|
|
19
|
+
let i = mods?.findIndex((x) => x.type == FlowStatusModule.type.IN_PROGRESS);
|
|
20
|
+
if (i != -1) {
|
|
21
|
+
let last = mods[i];
|
|
22
|
+
jobs[i] = await JobService.getJob({
|
|
23
|
+
workspace: $workspaceStore ?? '',
|
|
24
|
+
id: last.job ?? ''
|
|
25
|
+
});
|
|
26
|
+
jobs = jobs;
|
|
27
|
+
pres[i]?.scroll({ top: pres[i]?.scrollHeight, behavior: 'smooth' });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (job.id != lastJobid) {
|
|
32
|
+
lastJobid = job.id;
|
|
33
|
+
jobs = [];
|
|
34
|
+
fullyRetrieved = -1;
|
|
35
|
+
}
|
|
13
36
|
job?.flow_status?.modules?.forEach(async (x, i) => {
|
|
14
|
-
if ((i
|
|
37
|
+
if ((i > fullyRetrieved && x.type == FlowStatusModule.type.SUCCESS) ||
|
|
15
38
|
x.type == FlowStatusModule.type.FAILURE) {
|
|
16
39
|
if (x.forloop_jobs) {
|
|
17
40
|
const forloop_jobs = [];
|
|
18
41
|
for (let j of x.forloop_jobs) {
|
|
19
42
|
forloop_jobs.push(await JobService.getCompletedJob({ workspace: $workspaceStore, id: j }));
|
|
20
43
|
}
|
|
21
|
-
jobs
|
|
44
|
+
jobs[i] = forloop_jobs;
|
|
22
45
|
}
|
|
23
46
|
else {
|
|
24
|
-
jobs
|
|
47
|
+
jobs[i] = await JobService.getCompletedJob({ workspace: $workspaceStore, id: x.job });
|
|
25
48
|
}
|
|
26
49
|
jobs = jobs;
|
|
50
|
+
fullyRetrieved = i;
|
|
27
51
|
}
|
|
28
52
|
});
|
|
29
53
|
}
|
|
54
|
+
function toJob(x) {
|
|
55
|
+
return x;
|
|
56
|
+
}
|
|
30
57
|
function toCompletedJob(x) {
|
|
31
58
|
return x;
|
|
32
59
|
}
|
|
@@ -36,32 +63,31 @@ function toCompletedJobs(x) {
|
|
|
36
63
|
$: $workspaceStore && job && loadResults();
|
|
37
64
|
</script>
|
|
38
65
|
|
|
39
|
-
<div class="flow-root
|
|
40
|
-
<div class="flex
|
|
66
|
+
<div class="flow-root w-full p-6">
|
|
67
|
+
<div class="flex ">
|
|
41
68
|
{#if job}
|
|
42
69
|
<div class="flex-col">
|
|
43
|
-
<a href="/run/{job?.id}" class="font-medium text-blue-600"
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<div>
|
|
47
|
-
<JobStatus {job} />
|
|
48
|
-
</div>
|
|
70
|
+
<a href="/run/{job?.id}" class="font-medium text-blue-600">
|
|
71
|
+
{truncateRev(job?.id ?? '', 10)}
|
|
72
|
+
</a>
|
|
49
73
|
</div>
|
|
50
74
|
{/if}
|
|
51
75
|
</div>
|
|
76
|
+
<JobStatus {job} />
|
|
52
77
|
|
|
53
78
|
<p class="text-gray-500 mb-6 w-full text-center">
|
|
54
79
|
Step
|
|
55
|
-
<span class="font-medium text-gray-900"
|
|
56
|
-
|
|
57
|
-
>
|
|
80
|
+
<span class="font-medium text-gray-900">
|
|
81
|
+
{Math.min((job?.flow_status?.step ?? 0) + 1, job?.raw_flow?.modules.length ?? 0)}
|
|
82
|
+
</span>
|
|
58
83
|
out of <span class="font-medium text-gray-900">{job?.raw_flow?.modules.length}</span>
|
|
59
84
|
<span class="mt-4" />
|
|
60
85
|
</p>
|
|
61
|
-
|
|
86
|
+
|
|
87
|
+
<ul class="w-full">
|
|
62
88
|
{#each job?.raw_flow?.modules ?? [] as mod, i}
|
|
63
89
|
<li class="w-full">
|
|
64
|
-
<div class="relative
|
|
90
|
+
<div class="relative w-full">
|
|
65
91
|
{#if i < (job?.raw_flow?.modules ?? []).length - 1}
|
|
66
92
|
<span
|
|
67
93
|
class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"
|
|
@@ -109,7 +135,7 @@ $: $workspaceStore && job && loadResults();
|
|
|
109
135
|
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
|
|
110
136
|
<div class="w-full">
|
|
111
137
|
<p class="text-sm text-gray-500">
|
|
112
|
-
{#if mod.value.type ==
|
|
138
|
+
{#if mod.value.type == 'script'}
|
|
113
139
|
Script at path <a
|
|
114
140
|
target="_blank"
|
|
115
141
|
href={scriptPathToHref(mod.value.path ?? '')}
|
|
@@ -120,28 +146,34 @@ $: $workspaceStore && job && loadResults();
|
|
|
120
146
|
</div>
|
|
121
147
|
<div class="text-right text-sm whitespace-nowrap text-gray-500">
|
|
122
148
|
{job.flow_status?.modules[i].type}
|
|
123
|
-
|
|
124
|
-
{#
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
149
|
+
<div class=" max-h-40 overflow-y-auto">
|
|
150
|
+
{#if job.flow_status?.modules[i].forloop_jobs}
|
|
151
|
+
{#each job.flow_status?.modules[i].forloop_jobs ?? [] as job}
|
|
152
|
+
<div class="flex flex-col">
|
|
153
|
+
<a href="/run/{job}" class="font-medium text-blue-600">
|
|
154
|
+
{truncateRev(job ?? '', 10)}
|
|
155
|
+
</a>
|
|
156
|
+
</div>
|
|
157
|
+
{/each}
|
|
158
|
+
{:else if job.flow_status?.modules[i].job}
|
|
159
|
+
<a
|
|
160
|
+
href="/run/{job.flow_status?.modules[i].job}"
|
|
161
|
+
class="font-medium text-blue-600"
|
|
162
|
+
>
|
|
163
|
+
{truncateRev(job.flow_status?.modules[i].job ?? '', 10)}
|
|
164
|
+
</a>
|
|
165
|
+
{/if}
|
|
166
|
+
</div>
|
|
136
167
|
</div>
|
|
137
168
|
</div>
|
|
138
169
|
</div>
|
|
139
170
|
{#if jobs[i]}
|
|
140
171
|
{#if Array.isArray(jobs[i])}
|
|
141
|
-
<div class="flex flex-col space-y-2">
|
|
172
|
+
<div class="flex flex-col mt-2 space-y-2 max-h-60 overflow-y-auto shadow-inner">
|
|
142
173
|
{#each toCompletedJobs(jobs[i]) as job, i}
|
|
143
174
|
<button
|
|
144
175
|
class="underline text-blue-600 hover:text-blue-700"
|
|
176
|
+
class:text-red-600={!job.success}
|
|
145
177
|
on:click={() => {
|
|
146
178
|
if (forloop_selected == job.id) {
|
|
147
179
|
forloop_selected = ''
|
|
@@ -156,8 +188,24 @@ $: $workspaceStore && job && loadResults();
|
|
|
156
188
|
{/if}
|
|
157
189
|
{/each}
|
|
158
190
|
</div>
|
|
159
|
-
{:else}
|
|
191
|
+
{:else if toJob(jobs[i]).type == 'CompletedJob'}
|
|
160
192
|
<FlowJobResult job={toCompletedJob(jobs[i])} />
|
|
193
|
+
{:else if jobs[i]}
|
|
194
|
+
{#if toJob(jobs[i])?.raw_flow}
|
|
195
|
+
<div class="border-2">
|
|
196
|
+
<h2>Forloop current iteration</h2>
|
|
197
|
+
<svelte:self job={jobs[i]} />
|
|
198
|
+
</div>
|
|
199
|
+
{:else}
|
|
200
|
+
<div class="max-w-2xl mt-2 h-full">
|
|
201
|
+
<pre
|
|
202
|
+
bind:this={pres[i]}
|
|
203
|
+
class="break-all p-4 relative h-full mx-2 bg-gray-50 text-xs max-h-40 overflow-y-auto border">{toJob(
|
|
204
|
+
jobs[i]
|
|
205
|
+
).logs ?? ''}
|
|
206
|
+
</pre>
|
|
207
|
+
</div>
|
|
208
|
+
{/if}
|
|
161
209
|
{/if}
|
|
162
210
|
{/if}
|
|
163
211
|
</div>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { CompletedJob, QueuedJob } from '../gen';
|
|
2
|
+
import { CompletedJob, Job, QueuedJob } from '../gen';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
job: QueuedJob | CompletedJob;
|
|
6
|
-
jobs?: (
|
|
6
|
+
jobs?: (Job | Job[] | undefined)[] | undefined;
|
|
7
|
+
fullyRetrieved?: number | undefined;
|
|
7
8
|
};
|
|
8
9
|
events: {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|