windmill-components 1.28.7 → 1.35.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/common.d.ts +3 -0
- package/components/AppConnect.svelte +29 -13
- package/components/ArgInput.svelte +25 -14
- package/components/ArgInput.svelte.d.ts +4 -0
- package/components/CenteredPage.svelte +2 -2
- package/components/DisplayResult.svelte +3 -3
- package/components/Editor.svelte +70 -78
- package/components/Editor.svelte.d.ts +3 -0
- package/components/EditorBar.svelte +57 -38
- package/components/FlowBuilder.svelte +39 -33
- package/components/FlowEditor.svelte +17 -58
- package/components/FlowJobResult.svelte +16 -16
- package/components/FlowModulesViewer.svelte +97 -0
- package/components/FlowModulesViewer.svelte.d.ts +17 -0
- package/components/FlowPreview.svelte +46 -66
- package/components/FlowPreview.svelte.d.ts +2 -4
- package/components/FlowPreviewContent.svelte +59 -44
- package/components/FlowPreviewContent.svelte.d.ts +0 -1
- package/components/FlowStatusViewer.svelte +104 -204
- package/components/FlowStatusViewer.svelte.d.ts +7 -4
- package/components/FlowViewer.svelte +60 -156
- package/components/FlowViewer.svelte.d.ts +0 -1
- package/components/IconedPath.svelte +12 -0
- package/components/IconedPath.svelte.d.ts +16 -0
- package/components/IconedResourceType.svelte +24 -5
- package/components/IconedResourceType.svelte.d.ts +1 -0
- package/components/InputTransformForm.svelte +9 -8
- package/components/InputTransformForm.svelte.d.ts +1 -1
- package/components/InviteGlobalUser.svelte +1 -1
- package/components/ItemPicker.svelte +6 -1
- package/components/JobStatus.svelte +1 -1
- package/components/ModuleStep.svelte +74 -94
- package/components/ModuleStep.svelte.d.ts +7 -2
- package/components/Multiselect.svelte +1 -1
- package/components/Path.svelte +62 -40
- package/components/Path.svelte.d.ts +2 -0
- package/components/ProgressBar.svelte +31 -0
- package/components/ProgressBar.svelte.d.ts +17 -0
- package/components/ProgressBarPart.svelte +20 -0
- package/components/ProgressBarPart.svelte.d.ts +20 -0
- package/components/ResourceEditor.svelte +2 -1
- package/components/ResourcePicker.svelte +9 -0
- package/components/SchemaForm.svelte +9 -4
- package/components/SchemaForm.svelte.d.ts +1 -1
- package/components/SchemaModal.svelte +20 -3
- package/components/SchemaViewer.svelte +58 -68
- package/components/ScriptBuilder.svelte +145 -122
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/ScriptEditor.svelte +118 -339
- package/components/ScriptEditor.svelte.d.ts +0 -2
- package/components/ScriptSchema.svelte +45 -44
- package/components/SharedBadge.svelte +8 -3
- package/components/VariableEditor.svelte +1 -1
- package/components/common/drawer/Drawer.svelte +108 -0
- package/components/common/drawer/Drawer.svelte.d.ts +23 -0
- package/components/common/drawer/DrawerContent.svelte +19 -0
- package/components/common/drawer/DrawerContent.svelte.d.ts +20 -0
- package/components/common/menu/Menu.svelte +57 -0
- package/components/common/menu/Menu.svelte.d.ts +23 -0
- package/components/common/menu/MenuItem.svelte +9 -0
- package/components/common/menu/MenuItem.svelte.d.ts +27 -0
- package/components/common/tabs/Tab.svelte +17 -0
- package/components/common/tabs/Tab.svelte.d.ts +18 -0
- package/components/common/tabs/TabContent.svelte +12 -0
- package/components/common/tabs/TabContent.svelte.d.ts +19 -0
- package/components/common/tabs/Tabs.svelte +20 -0
- package/components/common/tabs/Tabs.svelte.d.ts +24 -0
- package/components/flows/CopyFirstStepSchema.svelte +4 -3
- package/components/flows/DynamicInputHelpBox.svelte +6 -4
- package/components/flows/DynamicInputHelpBox.svelte.d.ts +1 -1
- package/components/flows/FlowBox.svelte +15 -2
- package/components/flows/FlowBox.svelte.d.ts +14 -14
- package/components/flows/FlowBoxHeader.svelte +10 -3
- package/components/flows/FlowBoxHeader.svelte.d.ts +3 -0
- package/components/flows/FlowInput.svelte +14 -12
- package/components/flows/FlowInputs.svelte +55 -35
- package/components/flows/FlowInputs.svelte.d.ts +3 -1
- package/components/flows/FlowModuleHeader.svelte +69 -54
- package/components/flows/FlowModuleHeader.svelte.d.ts +6 -6
- package/components/flows/FlowSettings.svelte +72 -91
- package/components/flows/FlowSettings.svelte.d.ts +0 -1
- package/components/flows/FlowTimeline.svelte +169 -0
- package/components/flows/FlowTimeline.svelte.d.ts +21 -0
- package/components/flows/flowState.d.ts +14 -0
- package/components/flows/flowState.js +52 -0
- package/components/flows/flowStateUtils.d.ts +37 -0
- package/components/flows/flowStateUtils.js +220 -0
- package/components/flows/flowStore.d.ts +1 -16
- package/components/flows/flowStore.js +26 -203
- package/components/flows/pickers/FlowScriptPicker.svelte +5 -9
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +0 -1
- package/components/flows/pickers/PickHubScript.svelte +1 -1
- package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -1
- package/components/flows/pickers/PickScript.svelte +1 -1
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
- package/components/flows/scheduleUtils.d.ts +7 -0
- package/components/flows/scheduleUtils.js +21 -0
- package/components/flows/stepOpenedStore.d.ts +1 -0
- package/components/flows/stepOpenedStore.js +6 -0
- package/components/flows/utils.d.ts +6 -13
- package/components/flows/utils.js +47 -119
- package/components/icons/DiscordIcon.svelte +16 -0
- package/components/icons/DiscordIcon.svelte.d.ts +17 -0
- package/components/icons/GithubIcon.svelte +17 -0
- package/components/icons/GithubIcon.svelte.d.ts +17 -0
- package/components/icons/HttpIcon.svelte +21 -0
- package/components/icons/HttpIcon.svelte.d.ts +17 -0
- package/components/icons/MastodonIcon.svelte +16 -0
- package/components/icons/MastodonIcon.svelte.d.ts +17 -0
- package/components/icons/MatrixIcon.svelte +16 -0
- package/components/icons/MatrixIcon.svelte.d.ts +17 -0
- package/components/icons/S3Icon.svelte +16 -0
- package/components/icons/S3Icon.svelte.d.ts +17 -0
- package/components/icons/WindmillIcon.svelte +68 -0
- package/components/icons/WindmillIcon.svelte.d.ts +17 -0
- package/components/jobs/JobDetail.svelte +176 -0
- package/components/jobs/JobDetail.svelte.d.ts +17 -0
- package/components/landing/FlowGettingStarted.svelte +95 -0
- package/components/landing/FlowGettingStarted.svelte.d.ts +19 -0
- package/components/landing/FlowLandingBox.svelte +69 -0
- package/components/landing/FlowLandingBox.svelte.d.ts +17 -0
- package/components/landing/RessourceGettingStarted.svelte +51 -0
- package/components/landing/RessourceGettingStarted.svelte.d.ts +19 -0
- package/components/landing/ScriptBox.svelte +81 -0
- package/components/landing/ScriptBox.svelte.d.ts +17 -0
- package/components/landing/ScriptGettingStarted.svelte +93 -0
- package/components/landing/ScriptGettingStarted.svelte.d.ts +19 -0
- package/components/preview/FlowPreviewStatus.svelte +28 -0
- package/components/preview/FlowPreviewStatus.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +13 -13
- package/components/propertyPicker/utils.js +3 -2
- package/components/script_editor/LogPanel.svelte +172 -0
- package/components/script_editor/LogPanel.svelte.d.ts +22 -0
- package/components/sidebar/MenuLink.svelte +49 -0
- package/components/sidebar/MenuLink.svelte.d.ts +21 -0
- package/components/sidebar/SidebarContent.svelte +55 -0
- package/components/sidebar/SidebarContent.svelte.d.ts +16 -0
- package/components/sidebar/UserMenu.svelte +62 -0
- package/components/sidebar/UserMenu.svelte.d.ts +16 -0
- package/components/sidebar/WorkspaceMenu.svelte +66 -0
- package/components/sidebar/WorkspaceMenu.svelte.d.ts +16 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/core/request.js +1 -0
- package/gen/models/FlowModule.d.ts +5 -3
- package/gen/models/ForloopFlow.d.ts +2 -2
- package/gen/models/MainArgSignature.d.ts +14 -3
- package/gen/services/JobService.d.ts +10 -2
- package/gen/services/JobService.js +4 -2
- package/gen/services/ScriptService.d.ts +22 -6
- package/gen/services/ScriptService.js +32 -2
- package/infer.js +47 -24
- package/logout.js +1 -1
- package/package.json +58 -23
- package/script_helpers.d.ts +4 -1
- package/script_helpers.js +68 -17
- package/stores.d.ts +0 -2
- package/stores.js +0 -4
- package/utils.d.ts +5 -2
- package/utils.js +36 -5
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
<script>import { goto } from '$app/navigation';
|
|
2
2
|
import { page } from '$app/stores';
|
|
3
3
|
import { FlowService, ScheduleService } from '../gen';
|
|
4
|
-
import {
|
|
4
|
+
import { workspaceStore } from '../stores';
|
|
5
5
|
import { encodeState, formatCron, loadHubScripts, pathIsEmpty, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
6
|
import { faPlay } from '@fortawesome/free-solid-svg-icons';
|
|
7
7
|
import { Breadcrumb, BreadcrumbItem, Button } from 'flowbite-svelte';
|
|
8
8
|
import { onDestroy, onMount } from 'svelte';
|
|
9
9
|
import Icon from 'svelte-awesome';
|
|
10
10
|
import { OFFSET } from './CronInput.svelte';
|
|
11
|
+
import Drawer from './common/drawer/Drawer.svelte';
|
|
11
12
|
import FlowEditor from './FlowEditor.svelte';
|
|
12
13
|
import FlowPreviewContent from './FlowPreviewContent.svelte';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
14
|
+
import { flowStateStore, flowStateToFlow } from './flows/flowState';
|
|
15
|
+
import { flowStore } from './flows/flowStore';
|
|
16
|
+
import { cleanInputs } from './flows/utils';
|
|
15
17
|
import ScriptSchema from './ScriptSchema.svelte';
|
|
16
18
|
export let initialPath = '';
|
|
17
19
|
let pathError = '';
|
|
18
|
-
let scheduleArgs;
|
|
19
|
-
let previewArgs;
|
|
20
|
-
let scheduleEnabled;
|
|
21
|
-
let scheduleCron;
|
|
22
20
|
let previewOpen = false;
|
|
21
|
+
let scheduleArgs = {};
|
|
22
|
+
let previewArgs = {};
|
|
23
|
+
let scheduleEnabled = false;
|
|
24
|
+
let scheduleCron = '';
|
|
23
25
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
24
26
|
async function createSchedule(path) {
|
|
25
27
|
await ScheduleService.createSchedule({
|
|
@@ -36,7 +38,7 @@ async function createSchedule(path) {
|
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
async function saveFlow() {
|
|
39
|
-
const flow =
|
|
41
|
+
const flow = cleanInputs(flowStateToFlow($flowStateStore, $flowStore));
|
|
40
42
|
if (initialPath === '') {
|
|
41
43
|
await FlowService.createFlow({
|
|
42
44
|
workspace: $workspaceStore,
|
|
@@ -48,7 +50,7 @@ async function saveFlow() {
|
|
|
48
50
|
schema: flow.schema
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
|
-
if (
|
|
53
|
+
if (scheduleEnabled) {
|
|
52
54
|
await createSchedule(flow.path);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -103,28 +105,36 @@ async function saveFlow() {
|
|
|
103
105
|
goto(`/flows/get/${$flowStore.path}`);
|
|
104
106
|
}
|
|
105
107
|
async function changeStep(step) {
|
|
106
|
-
if (step === 2 && previewOpen) {
|
|
107
|
-
previewOpen = false;
|
|
108
|
-
}
|
|
109
108
|
goto(`?step=${step}`);
|
|
110
109
|
}
|
|
110
|
+
flowStateStore.subscribe((flowState) => {
|
|
111
|
+
if (flowState) {
|
|
112
|
+
flowStore.update((flow) => {
|
|
113
|
+
if (flow) {
|
|
114
|
+
return flowStateToFlow(flowState, flow);
|
|
115
|
+
}
|
|
116
|
+
return flow;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
111
120
|
flowStore.subscribe((flow) => {
|
|
112
121
|
if (flow) {
|
|
113
|
-
setQueryWithoutLoad($page.url, 'state', encodeState(
|
|
122
|
+
setQueryWithoutLoad($page.url, 'state', encodeState(flow));
|
|
114
123
|
}
|
|
115
124
|
});
|
|
116
125
|
onMount(() => {
|
|
117
126
|
loadHubScripts();
|
|
118
|
-
clearPreviewResults();
|
|
119
127
|
});
|
|
120
128
|
onDestroy(() => {
|
|
121
129
|
//@ts-ignore
|
|
122
130
|
$flowStore = undefined;
|
|
131
|
+
//@ts-ignore
|
|
132
|
+
$flowStateStore = undefined;
|
|
123
133
|
});
|
|
124
134
|
</script>
|
|
125
135
|
|
|
126
|
-
<div class="flex flex-row w-full h-full justify-between">
|
|
127
|
-
<div class={`flex flex-col mb-96 m-auto w-full
|
|
136
|
+
<div class="flex flex-row w-full h-full justify-between ">
|
|
137
|
+
<div class={`flex flex-col mb-96 m-auto w-full`}>
|
|
128
138
|
<!-- Nav between steps-->
|
|
129
139
|
<div class="justify-between flex flex-row w-full my-4">
|
|
130
140
|
<Breadcrumb>
|
|
@@ -157,6 +167,12 @@ onDestroy(() => {
|
|
|
157
167
|
</button>
|
|
158
168
|
{:else}
|
|
159
169
|
<button class="default-button px-6 self-end" on:click={saveFlow}>Save</button>
|
|
170
|
+
<button
|
|
171
|
+
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
172
|
+
on:click={async () => {
|
|
173
|
+
changeStep(1)
|
|
174
|
+
}}>Back</button
|
|
175
|
+
>
|
|
160
176
|
{/if}
|
|
161
177
|
</div>
|
|
162
178
|
</div>
|
|
@@ -169,7 +185,7 @@ onDestroy(() => {
|
|
|
169
185
|
|
|
170
186
|
<!-- metadata -->
|
|
171
187
|
|
|
172
|
-
{#if $
|
|
188
|
+
{#if $flowStateStore}
|
|
173
189
|
{#if step === 1}
|
|
174
190
|
<FlowEditor
|
|
175
191
|
bind:pathError
|
|
@@ -203,20 +219,10 @@ onDestroy(() => {
|
|
|
203
219
|
<p>Loading</p>
|
|
204
220
|
{/if}
|
|
205
221
|
</div>
|
|
206
|
-
|
|
207
|
-
<div class={`relative h-screen w-1/3 ${previewOpen ? '' : 'hidden'}`}>
|
|
208
|
-
<div class="absolute top-0 h-full">
|
|
209
|
-
{#if $flowStore && step === 1}
|
|
210
|
-
<div class="fixed border-l-2 right-0 h-screen w-1/2 sm:w-1/3">
|
|
211
|
-
<FlowPreviewContent
|
|
212
|
-
bind:args={previewArgs}
|
|
213
|
-
on:close={() => (previewOpen = !previewOpen)}
|
|
214
|
-
on:change={(e) => {
|
|
215
|
-
previewResults.set(jobsToResults(e.detail))
|
|
216
|
-
}}
|
|
217
|
-
/>
|
|
218
|
-
</div>
|
|
219
|
-
{/if}
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
222
|
</div>
|
|
223
|
+
|
|
224
|
+
{#if $flowStateStore && $flowStore}
|
|
225
|
+
<Drawer bind:open={previewOpen} size="800px">
|
|
226
|
+
<FlowPreviewContent bind:args={previewArgs} on:close={() => (previewOpen = !previewOpen)} />
|
|
227
|
+
</Drawer>
|
|
228
|
+
{/if}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
<script>import { ScheduleService } from '../gen';
|
|
2
2
|
import { workspaceStore } from '../stores';
|
|
3
|
-
import { pathIsEmpty } from '../utils';
|
|
4
|
-
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
-
import { Button } from 'flowbite-svelte';
|
|
6
|
-
import Icon from 'svelte-awesome';
|
|
7
|
-
import FlowInput from './flows/FlowInput.svelte';
|
|
8
3
|
import FlowSettings from './flows/FlowSettings.svelte';
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
4
|
+
import { flowStateStore } from './flows/flowState';
|
|
5
|
+
import { flowStore } from './flows/flowStore';
|
|
6
|
+
import FlowTimeline from './flows/FlowTimeline.svelte';
|
|
12
7
|
export let pathError = '';
|
|
13
8
|
export let initialPath = '';
|
|
14
9
|
export let scheduleArgs = {};
|
|
@@ -38,59 +33,23 @@ async function loadSchedule() {
|
|
|
38
33
|
$: if ($flowStore && $workspaceStore && initialPath != '') {
|
|
39
34
|
loadSchedule();
|
|
40
35
|
}
|
|
41
|
-
let open = 0;
|
|
42
36
|
</script>
|
|
43
37
|
|
|
44
|
-
{#if $
|
|
45
|
-
<div class="flex space-y-8 flex-col items-center
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{#if i == 0 && $mode == 'pull'}
|
|
59
|
-
<div class="flex justify-center bg-white shadow p-2">
|
|
60
|
-
<p>
|
|
61
|
-
Starting from here, the flow for loop over items from the 1st step's result right above.
|
|
62
|
-
<br />For-loops insertable at other points is not supported yet but coming soon
|
|
63
|
-
(See
|
|
64
|
-
<a href="https://github.com/windmill-labs/windmill/issues/350">#350</a>.)
|
|
65
|
-
</p>
|
|
66
|
-
<Tooltip>
|
|
67
|
-
This flow being in 'Pull' mode, the rest of the flow will for loop over the list of
|
|
68
|
-
items returned by the trigger script right above. Retrieve the item value using
|
|
69
|
-
`flow_input._value`
|
|
70
|
-
</Tooltip>
|
|
71
|
-
</div>
|
|
72
|
-
{/if}
|
|
73
|
-
{/each}
|
|
74
|
-
<Button
|
|
75
|
-
disabled={pathIsEmpty($flowStore.path)}
|
|
76
|
-
class="blue-button"
|
|
77
|
-
on:click={() => {
|
|
78
|
-
addModule()
|
|
79
|
-
open = $flowStore?.value.modules.length - 1
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<Icon class="text-white mr-2" data={faPlus} />
|
|
83
|
-
Add step {pathIsEmpty($flowStore?.path) ? '(pick a name first!)' : ''}
|
|
84
|
-
</Button>
|
|
38
|
+
{#if $flowStateStore}
|
|
39
|
+
<div class="flex space-y-8 flex-col items-center">
|
|
40
|
+
<FlowTimeline bind:args={previewArgs} bind:flowModuleSchemas={$flowStateStore}>
|
|
41
|
+
<div slot="settings">
|
|
42
|
+
<FlowSettings
|
|
43
|
+
bind:pathError
|
|
44
|
+
bind:initialPath
|
|
45
|
+
bind:scheduleArgs
|
|
46
|
+
{previewArgs}
|
|
47
|
+
bind:scheduleCron
|
|
48
|
+
bind:scheduleEnabled
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
</FlowTimeline>
|
|
85
52
|
</div>
|
|
86
53
|
{:else}
|
|
87
54
|
<h3>Loading flow</h3>
|
|
88
55
|
{/if}
|
|
89
|
-
|
|
90
|
-
<style>
|
|
91
|
-
.line {
|
|
92
|
-
background-image: linear-gradient(#e5e7eb, #e5e7eb);
|
|
93
|
-
background-size: 2px 100%;
|
|
94
|
-
background-repeat: no-repeat;
|
|
95
|
-
background-position: center center;
|
|
96
|
-
}</style>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import
|
|
1
|
+
<script>import DisplayResult from './DisplayResult.svelte';
|
|
2
|
+
import Tabs from './common/tabs/Tabs.svelte';
|
|
3
|
+
import Tab from './common/tabs/Tab.svelte';
|
|
4
|
+
import TabContent from './common/tabs/TabContent.svelte';
|
|
3
5
|
export let job;
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
8
|
{#if job}
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<ChevronButton text="logs" viewOptions={true}>
|
|
17
|
-
<div class="text-xs p-4 bg-gray-50 overflow-auto max-h-80 border mt-1">
|
|
9
|
+
<Tabs selected="results">
|
|
10
|
+
<Tab value="results">Results</Tab>
|
|
11
|
+
<Tab value="logs">Logs</Tab>
|
|
12
|
+
<svelte:fragment slot="content">
|
|
13
|
+
<TabContent value="results" class="border p-2 h-36 overflow-y-scroll">
|
|
14
|
+
<DisplayResult result={job.result} />
|
|
15
|
+
</TabContent>
|
|
16
|
+
<TabContent value="logs" class="border p-2 h-36 overflow-y-scroll">
|
|
17
|
+
<div class="text-xs p-4 bg-gray-50 overflow-auto max-h-80 border">
|
|
18
18
|
<pre class="w-full">{job.logs}</pre>
|
|
19
19
|
</div>
|
|
20
|
-
</
|
|
21
|
-
</
|
|
22
|
-
</
|
|
20
|
+
</TabContent>
|
|
21
|
+
</svelte:fragment>
|
|
22
|
+
</Tabs>
|
|
23
23
|
{/if}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script>import { scriptPathToHref } from '../utils';
|
|
2
|
+
import Highlight from 'svelte-highlight';
|
|
3
|
+
import python from 'svelte-highlight/languages/python';
|
|
4
|
+
import typescript from 'svelte-highlight/languages/typescript';
|
|
5
|
+
import { slide } from 'svelte/transition';
|
|
6
|
+
import InputTransformsViewer from './InputTransformsViewer.svelte';
|
|
7
|
+
import IconedPath from './IconedPath.svelte';
|
|
8
|
+
export let modules;
|
|
9
|
+
let open = {};
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<p class="font-black text-lg my-6 w-full">
|
|
13
|
+
<span>{modules?.length} Step{modules?.length > 1 ? 's' : ''} </span>
|
|
14
|
+
<span class="mt-4" />
|
|
15
|
+
</p>
|
|
16
|
+
<ul class="-mb-8 w-full">
|
|
17
|
+
{#each modules ?? [] as mod, i}
|
|
18
|
+
<li class="w-full">
|
|
19
|
+
<div class="relative pb-8 w-full">
|
|
20
|
+
{#if i < (modules ?? []).length - 1}
|
|
21
|
+
<span class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200" aria-hidden="true" />
|
|
22
|
+
{/if}
|
|
23
|
+
<div class="relative flex space-x-3">
|
|
24
|
+
<div>
|
|
25
|
+
<span
|
|
26
|
+
class="h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center ring-8 ring-white text-white"
|
|
27
|
+
>{i + 1}
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
|
|
31
|
+
<div class="w-full">
|
|
32
|
+
<span class="text-black">{mod?.summary ?? ''}</span>
|
|
33
|
+
<p class="text-sm text-gray-500">
|
|
34
|
+
{#if mod?.value?.type == 'script'}
|
|
35
|
+
<a
|
|
36
|
+
target="_blank"
|
|
37
|
+
href={scriptPathToHref(mod?.value?.path ?? '')}
|
|
38
|
+
class="font-medium text-gray-900"
|
|
39
|
+
>
|
|
40
|
+
<IconedPath path={mod?.value?.path ?? ''} />
|
|
41
|
+
</a>
|
|
42
|
+
{#if mod?.value?.path?.startsWith('hub/')}
|
|
43
|
+
<div>
|
|
44
|
+
<button
|
|
45
|
+
on:click={async () => {
|
|
46
|
+
open[i] = !open[i]
|
|
47
|
+
}}
|
|
48
|
+
class="mb-2 underline text-black"
|
|
49
|
+
>
|
|
50
|
+
View code and inputs {open[i] ? '(-)' : '(+)'}</button
|
|
51
|
+
>
|
|
52
|
+
{#if open[i]}
|
|
53
|
+
<div class="border border-black p-2 bg-gray-50 divide-y">
|
|
54
|
+
<InputTransformsViewer inputTransforms={mod?.input_transforms} />
|
|
55
|
+
<div class="w-full h-full mt-6">
|
|
56
|
+
<iframe
|
|
57
|
+
style="height: 400px;"
|
|
58
|
+
class="w-full h-full text-sm"
|
|
59
|
+
title="embedded script from hub"
|
|
60
|
+
frameborder="0"
|
|
61
|
+
src="https://hub.windmill.dev/embed/script/{mod?.value?.path?.substring(
|
|
62
|
+
4
|
|
63
|
+
)}"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
70
|
+
{:else if mod?.value?.type == 'rawscript'}
|
|
71
|
+
<button on:click={() => (open[i] = !open[i])} class="mb-2 underline text-black">
|
|
72
|
+
Raw {mod?.value?.language} script {open[i] ? '(-)' : '(+)'}</button
|
|
73
|
+
>
|
|
74
|
+
|
|
75
|
+
{#if open[i]}
|
|
76
|
+
<div transition:slide class="border border-black p-2 bg-gray-50 w-full">
|
|
77
|
+
<InputTransformsViewer inputTransforms={mod?.input_transforms} />
|
|
78
|
+
<Highlight
|
|
79
|
+
language={mod?.value?.language == 'deno' ? typescript : python}
|
|
80
|
+
code={mod?.value?.content}
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
{/if}
|
|
84
|
+
{:else if mod?.value?.type == 'flow'}
|
|
85
|
+
Flow at path {mod?.value?.path}
|
|
86
|
+
{:else if mod?.value?.type == 'forloopflow'}
|
|
87
|
+
For loop over all the elements of the list returned as a result of step {i}:
|
|
88
|
+
<svelte:self modules={mod.value.modules} />
|
|
89
|
+
{/if}
|
|
90
|
+
</p>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</li>
|
|
96
|
+
{/each}
|
|
97
|
+
</ul>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { FlowModule } from '../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
modules: FlowModule[];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type FlowModulesViewerProps = typeof __propDef.props;
|
|
13
|
+
export declare type FlowModulesViewerEvents = typeof __propDef.events;
|
|
14
|
+
export declare type FlowModulesViewerSlots = typeof __propDef.slots;
|
|
15
|
+
export default class FlowModulesViewer extends SvelteComponentTyped<FlowModulesViewerProps, FlowModulesViewerEvents, FlowModulesViewerSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { workspaceStore } from '../stores';
|
|
3
|
-
import { sendUserToast, truncateRev } from '../utils';
|
|
1
|
+
<script>import { sendUserToast, truncateRev } from '../utils';
|
|
4
2
|
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
-
import { createEventDispatcher, onDestroy } from 'svelte';
|
|
6
3
|
import Icon from 'svelte-awesome';
|
|
7
|
-
import
|
|
4
|
+
import { flowStateStore, flowStateToFlow } from './flows/flowState';
|
|
5
|
+
import { mapJobResultsToFlowState } from './flows/flowStateUtils';
|
|
8
6
|
import { runFlowPreview } from './flows/utils';
|
|
9
7
|
import FlowStatusViewer from './FlowStatusViewer.svelte';
|
|
10
8
|
import RunForm from './RunForm.svelte';
|
|
11
|
-
import
|
|
12
|
-
|
|
9
|
+
import Tab from './common/tabs/Tab.svelte';
|
|
10
|
+
import TabContent from './common/tabs/TabContent.svelte';
|
|
11
|
+
import Tabs from './common/tabs/Tabs.svelte';
|
|
13
12
|
export let i;
|
|
14
13
|
export let flow;
|
|
15
|
-
export let
|
|
14
|
+
export let schema;
|
|
16
15
|
export let args = {};
|
|
17
16
|
let stepArgs = {};
|
|
18
17
|
let tab = 'upto';
|
|
19
18
|
let viewPreview = false;
|
|
20
|
-
let intervalId;
|
|
21
19
|
let uptoText = i >= flow.value.modules.length - 1 ? 'Preview whole flow' : 'Preview up to this step';
|
|
22
|
-
let job;
|
|
23
|
-
let jobs = [];
|
|
24
20
|
let jobId;
|
|
25
|
-
$: dispatch('change', jobs);
|
|
26
21
|
export async function runPreview(args) {
|
|
27
22
|
viewPreview = true;
|
|
28
|
-
|
|
23
|
+
flow = flowStateToFlow($flowStateStore, flow);
|
|
29
24
|
let newFlow = tab == 'upto' ? truncateFlow(flow) : setInputTransformFromArgs(extractStep(flow), args);
|
|
30
25
|
jobId = await runFlowPreview(args, newFlow);
|
|
31
|
-
jobs = [];
|
|
32
|
-
intervalId = setInterval(loadJob, 1000);
|
|
33
26
|
sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
|
|
34
27
|
}
|
|
35
28
|
function truncateFlow(flow) {
|
|
@@ -40,35 +33,20 @@ function truncateFlow(flow) {
|
|
|
40
33
|
function extractStep(flow) {
|
|
41
34
|
const localFlow = JSON.parse(JSON.stringify(flow));
|
|
42
35
|
localFlow.value.modules = flow.value.modules.slice(i, i + 1);
|
|
43
|
-
localFlow.schema =
|
|
36
|
+
localFlow.schema = schema;
|
|
44
37
|
return localFlow;
|
|
45
38
|
}
|
|
46
39
|
function setInputTransformFromArgs(flow, args) {
|
|
47
|
-
let
|
|
40
|
+
let input_transforms = {};
|
|
48
41
|
Object.entries(args).forEach(([key, value]) => {
|
|
49
|
-
|
|
42
|
+
input_transforms[key] = {
|
|
50
43
|
type: 'static',
|
|
51
44
|
value: value
|
|
52
45
|
};
|
|
53
46
|
});
|
|
54
|
-
flow.value.modules[0].
|
|
47
|
+
flow.value.modules[0].input_transforms = input_transforms;
|
|
55
48
|
return flow;
|
|
56
49
|
}
|
|
57
|
-
async function loadJob() {
|
|
58
|
-
try {
|
|
59
|
-
job = await JobService.getJob({ workspace: $workspaceStore, id: jobId });
|
|
60
|
-
if (job?.type == 'CompletedJob') {
|
|
61
|
-
//only CompletedJob has success property
|
|
62
|
-
clearInterval(intervalId);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
sendUserToast(err, true);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
onDestroy(() => {
|
|
70
|
-
intervalId && clearInterval(intervalId);
|
|
71
|
-
});
|
|
72
50
|
</script>
|
|
73
51
|
|
|
74
52
|
<button
|
|
@@ -87,41 +65,43 @@ onDestroy(() => {
|
|
|
87
65
|
|
|
88
66
|
{#if viewPreview}
|
|
89
67
|
{#if i != flow.value.modules.length}
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
68
|
+
<div class="mt-2">
|
|
69
|
+
<Tabs bind:selected={tab}>
|
|
70
|
+
<Tab value="upto">{uptoText}</Tab>
|
|
71
|
+
<Tab value="justthis">Preview just this step</Tab>
|
|
72
|
+
<svelte:fragment slot="content">
|
|
73
|
+
<TabContent value="upto">
|
|
74
|
+
<RunForm
|
|
75
|
+
runnable={truncateFlow(flow)}
|
|
76
|
+
runAction={(_, args) => runPreview(args)}
|
|
77
|
+
schedulable={false}
|
|
78
|
+
buttonText={uptoText}
|
|
79
|
+
detailed={false}
|
|
80
|
+
bind:args
|
|
81
|
+
/>
|
|
82
|
+
</TabContent>
|
|
83
|
+
<TabContent value="justthis">
|
|
84
|
+
<RunForm
|
|
85
|
+
runnable={extractStep(flow)}
|
|
86
|
+
runAction={(_, args) => runPreview(args)}
|
|
87
|
+
schedulable={false}
|
|
88
|
+
buttonText="Preview just this step"
|
|
89
|
+
detailed={false}
|
|
90
|
+
args={stepArgs}
|
|
91
|
+
/>
|
|
92
|
+
</TabContent>
|
|
93
|
+
</svelte:fragment>
|
|
94
|
+
</Tabs>
|
|
95
|
+
</div>
|
|
117
96
|
{/if}
|
|
118
97
|
|
|
119
|
-
{#if
|
|
98
|
+
{#if jobId}
|
|
120
99
|
<div class="w-full flex justify-center">
|
|
121
|
-
<FlowStatusViewer
|
|
100
|
+
<FlowStatusViewer
|
|
101
|
+
{jobId}
|
|
102
|
+
on:jobsLoaded={(e) => mapJobResultsToFlowState(e.detail, tab, i)}
|
|
103
|
+
root={true}
|
|
104
|
+
/>
|
|
122
105
|
</div>
|
|
123
|
-
{#if `result` in job}
|
|
124
|
-
<FlowJobResult {job} />
|
|
125
|
-
{/if}
|
|
126
106
|
{/if}
|
|
127
107
|
{/if}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Schema } from '../common';
|
|
3
|
-
import {
|
|
3
|
+
import type { Flow } from '../gen';
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
i: number;
|
|
7
7
|
flow: Flow;
|
|
8
|
-
|
|
8
|
+
schema: Schema;
|
|
9
9
|
args?: Record<string, any> | undefined;
|
|
10
10
|
runPreview?: ((args: any) => Promise<void>) | undefined;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
13
|
-
change: CustomEvent<any>;
|
|
14
|
-
} & {
|
|
15
13
|
[evt: string]: CustomEvent<any>;
|
|
16
14
|
};
|
|
17
15
|
slots: {};
|