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
|
@@ -1,93 +1,149 @@
|
|
|
1
1
|
<script>import { goto } from '$app/navigation';
|
|
2
2
|
import { page } from '$app/stores';
|
|
3
|
-
import { FlowService,
|
|
4
|
-
import { clearPreviewResults,
|
|
5
|
-
import { loadHubScripts, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { FlowService, ScheduleService } from '../gen';
|
|
4
|
+
import { clearPreviewResults, previewResults, workspaceStore } from '../stores';
|
|
5
|
+
import { encodeState, formatCron, loadHubScripts, pathIsEmpty, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
|
+
import { faPlay } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { Breadcrumb, BreadcrumbItem, Button } from 'flowbite-svelte';
|
|
8
|
+
import { onDestroy, onMount } from 'svelte';
|
|
8
9
|
import Icon from 'svelte-awesome';
|
|
10
|
+
import { OFFSET } from './CronInput.svelte';
|
|
9
11
|
import FlowEditor from './FlowEditor.svelte';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
+
import FlowPreviewContent from './FlowPreviewContent.svelte';
|
|
13
|
+
import { flowStore, mode } from './flows/flowStore';
|
|
14
|
+
import { flowToMode, jobsToResults } from './flows/utils';
|
|
12
15
|
import ScriptSchema from './ScriptSchema.svelte';
|
|
13
16
|
export let initialPath = '';
|
|
14
17
|
let pathError = '';
|
|
15
|
-
let
|
|
18
|
+
let scheduleArgs;
|
|
19
|
+
let scheduleEnabled;
|
|
20
|
+
let scheduleCron;
|
|
21
|
+
let previewOpen = false;
|
|
16
22
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
23
|
+
async function createSchedule(path) {
|
|
24
|
+
await ScheduleService.createSchedule({
|
|
25
|
+
workspace: $workspaceStore,
|
|
26
|
+
requestBody: {
|
|
27
|
+
path: path,
|
|
28
|
+
schedule: formatCron(scheduleCron),
|
|
29
|
+
offset: OFFSET,
|
|
30
|
+
script_path: path,
|
|
31
|
+
is_flow: true,
|
|
32
|
+
args: scheduleArgs,
|
|
33
|
+
enabled: scheduleEnabled
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
17
37
|
async function saveFlow() {
|
|
18
|
-
const
|
|
38
|
+
const flow = flowToMode($flowStore, $mode);
|
|
19
39
|
if (initialPath === '') {
|
|
20
40
|
await FlowService.createFlow({
|
|
21
41
|
workspace: $workspaceStore,
|
|
22
42
|
requestBody: {
|
|
23
|
-
path:
|
|
24
|
-
summary:
|
|
25
|
-
description:
|
|
26
|
-
value:
|
|
27
|
-
schema:
|
|
43
|
+
path: flow.path,
|
|
44
|
+
summary: flow.summary,
|
|
45
|
+
description: flow.description ?? '',
|
|
46
|
+
value: flow.value,
|
|
47
|
+
schema: flow.schema
|
|
28
48
|
}
|
|
29
49
|
});
|
|
50
|
+
if ($mode == 'pull') {
|
|
51
|
+
await createSchedule(flow.path);
|
|
52
|
+
}
|
|
30
53
|
}
|
|
31
54
|
else {
|
|
32
55
|
await FlowService.updateFlow({
|
|
33
56
|
workspace: $workspaceStore,
|
|
34
|
-
path:
|
|
57
|
+
path: initialPath,
|
|
35
58
|
requestBody: {
|
|
36
|
-
path:
|
|
37
|
-
summary:
|
|
38
|
-
description:
|
|
39
|
-
value:
|
|
40
|
-
schema:
|
|
59
|
+
path: flow.path,
|
|
60
|
+
summary: flow.summary,
|
|
61
|
+
description: flow.description ?? '',
|
|
62
|
+
value: flow.value,
|
|
63
|
+
schema: flow.schema
|
|
41
64
|
}
|
|
42
65
|
});
|
|
66
|
+
const scheduleExists = await ScheduleService.existsSchedule({
|
|
67
|
+
workspace: $workspaceStore ?? '',
|
|
68
|
+
path: initialPath
|
|
69
|
+
});
|
|
70
|
+
if (scheduleExists) {
|
|
71
|
+
const schedule = await ScheduleService.getSchedule({
|
|
72
|
+
workspace: $workspaceStore ?? '',
|
|
73
|
+
path: initialPath
|
|
74
|
+
});
|
|
75
|
+
if (schedule.path != flow.path ||
|
|
76
|
+
JSON.stringify(schedule.args) != JSON.stringify(scheduleArgs) ||
|
|
77
|
+
schedule.schedule != scheduleCron) {
|
|
78
|
+
await ScheduleService.updateSchedule({
|
|
79
|
+
workspace: $workspaceStore ?? '',
|
|
80
|
+
path: initialPath,
|
|
81
|
+
requestBody: {
|
|
82
|
+
schedule: formatCron(scheduleCron),
|
|
83
|
+
script_path: flow.path,
|
|
84
|
+
is_flow: true,
|
|
85
|
+
args: scheduleArgs
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (scheduleEnabled != schedule.enabled) {
|
|
90
|
+
await ScheduleService.setScheduleEnabled({
|
|
91
|
+
workspace: $workspaceStore ?? '',
|
|
92
|
+
path: flow.path,
|
|
93
|
+
requestBody: { enabled: scheduleEnabled }
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
await createSchedule(flow.path);
|
|
99
|
+
}
|
|
43
100
|
}
|
|
44
101
|
sendUserToast(`Success! flow saved at ${$flowStore.path}`);
|
|
45
102
|
goto(`/flows/get/${$flowStore.path}`);
|
|
46
103
|
}
|
|
47
104
|
async function changeStep(step) {
|
|
105
|
+
if (step === 2 && previewOpen) {
|
|
106
|
+
previewOpen = false;
|
|
107
|
+
}
|
|
48
108
|
goto(`?step=${step}`);
|
|
49
109
|
}
|
|
50
110
|
flowStore.subscribe((flow) => {
|
|
51
|
-
|
|
111
|
+
if (flow) {
|
|
112
|
+
setQueryWithoutLoad($page.url, 'state', encodeState(flowToMode(flow, $mode)));
|
|
113
|
+
}
|
|
52
114
|
});
|
|
53
115
|
onMount(() => {
|
|
54
116
|
loadHubScripts();
|
|
55
117
|
clearPreviewResults();
|
|
56
118
|
});
|
|
119
|
+
onDestroy(() => {
|
|
120
|
+
//@ts-ignore
|
|
121
|
+
$flowStore = undefined;
|
|
122
|
+
});
|
|
57
123
|
</script>
|
|
58
124
|
|
|
59
|
-
<div class="flex flex-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<div class="justify-between flex flex-row
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
class="{step === 2
|
|
76
|
-
? 'default-button-disabled text-gray-700'
|
|
77
|
-
: 'default-button-secondary'} min-w-max ml-2"
|
|
78
|
-
on:click={() => {
|
|
79
|
-
changeStep(2)
|
|
80
|
-
}}>Step 2: UI customisation</button
|
|
81
|
-
>
|
|
82
|
-
</div>
|
|
125
|
+
<div class="flex flex-row w-full h-full justify-between">
|
|
126
|
+
<div class={`flex flex-col mb-96 m-auto w-1/2`}>
|
|
127
|
+
<!-- Nav between steps-->
|
|
128
|
+
<div class="justify-between flex flex-row w-full my-4">
|
|
129
|
+
<Breadcrumb>
|
|
130
|
+
<BreadcrumbItem>
|
|
131
|
+
<button on:click={() => changeStep(1)} class={step === 1 ? 'font-bold' : null}>
|
|
132
|
+
Flow Editor
|
|
133
|
+
</button>
|
|
134
|
+
</BreadcrumbItem>
|
|
135
|
+
<BreadcrumbItem>
|
|
136
|
+
<button on:click={() => changeStep(2)} class={step === 2 ? 'font-bold' : null}>
|
|
137
|
+
UI customisation
|
|
138
|
+
</button>
|
|
139
|
+
</BreadcrumbItem>
|
|
140
|
+
</Breadcrumb>
|
|
83
141
|
<div class="flex flex-row-reverse ml-2">
|
|
84
142
|
{#if step == 1}
|
|
85
143
|
<button
|
|
86
144
|
disabled={pathError != ''}
|
|
87
145
|
class="default-button px-6 max-h-8"
|
|
88
|
-
on:click={() =>
|
|
89
|
-
changeStep(step + 1)
|
|
90
|
-
}}
|
|
146
|
+
on:click={() => changeStep(2)}
|
|
91
147
|
>
|
|
92
148
|
Next
|
|
93
149
|
</button>
|
|
@@ -105,31 +161,60 @@ onMount(() => {
|
|
|
105
161
|
</div>
|
|
106
162
|
<div class="flex flex-row-reverse">
|
|
107
163
|
<span class="my-1 text-sm text-gray-500 italic">
|
|
108
|
-
{#if initialPath && initialPath != $flowStore
|
|
109
|
-
{$flowStore
|
|
164
|
+
{#if initialPath && initialPath != $flowStore?.path} {initialPath} → {/if}
|
|
165
|
+
{$flowStore?.path}
|
|
110
166
|
</span>
|
|
111
167
|
</div>
|
|
112
|
-
</div>
|
|
113
168
|
|
|
114
|
-
|
|
169
|
+
<!-- metadata -->
|
|
115
170
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
171
|
+
{#if $flowStore}
|
|
172
|
+
{#if step === 1}
|
|
173
|
+
<FlowEditor
|
|
174
|
+
bind:pathError
|
|
175
|
+
bind:initialPath
|
|
176
|
+
bind:scheduleEnabled
|
|
177
|
+
bind:scheduleCron
|
|
178
|
+
bind:scheduleArgs
|
|
179
|
+
/>
|
|
180
|
+
<Button
|
|
181
|
+
disabled={pathIsEmpty($flowStore.path)}
|
|
182
|
+
size="lg"
|
|
183
|
+
pill
|
|
184
|
+
on:click={() => (previewOpen = !previewOpen)}
|
|
185
|
+
class={`blue-button fixed bottom-10 right-10 ${previewOpen ? 'hidden' : ''}`}
|
|
186
|
+
>
|
|
187
|
+
Preview flow
|
|
188
|
+
{pathIsEmpty($flowStore.path) ? '(pick a name first!)' : ''}
|
|
127
189
|
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
190
|
+
<Icon data={faPlay} class="ml-2" />
|
|
191
|
+
</Button>
|
|
192
|
+
{:else if step === 2}
|
|
193
|
+
<ScriptSchema
|
|
194
|
+
synchronizedHeader={false}
|
|
195
|
+
bind:summary={$flowStore.summary}
|
|
196
|
+
bind:description={$flowStore.description}
|
|
197
|
+
bind:schema={$flowStore.schema}
|
|
198
|
+
/>
|
|
199
|
+
{/if}
|
|
200
|
+
{:else}
|
|
201
|
+
<p>Loading</p>
|
|
202
|
+
{/if}
|
|
203
|
+
</div>
|
|
132
204
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
205
|
+
<div class={`relative h-screen w-1/3 ${previewOpen ? '' : 'hidden'}`}>
|
|
206
|
+
<div class="absolute top-0 h-full">
|
|
207
|
+
{#if $flowStore && step === 1}
|
|
208
|
+
<div class="fixed border-l-2 right-0 h-screen w-1/3">
|
|
209
|
+
<FlowPreviewContent
|
|
210
|
+
bind:args={scheduleArgs}
|
|
211
|
+
on:close={() => (previewOpen = !previewOpen)}
|
|
212
|
+
on:change={(e) => {
|
|
213
|
+
previewResults.set(jobsToResults(e.detail))
|
|
214
|
+
}}
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
{/if}
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
@@ -1,214 +1,93 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import {
|
|
1
|
+
<script>import { ScheduleService } from '../gen';
|
|
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';
|
|
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, sendUserToast } from '../utils';
|
|
13
|
-
import Dropdown from './Dropdown.svelte';
|
|
14
|
-
import Editor from './Editor.svelte';
|
|
15
|
-
import Modal from './Modal.svelte';
|
|
16
|
-
import FlowViewer from './FlowViewer.svelte';
|
|
17
|
-
import { flowToMode } from './flows/utils';
|
|
11
|
+
import Tooltip from './Tooltip.svelte';
|
|
18
12
|
export let pathError = '';
|
|
19
13
|
export let initialPath = '';
|
|
20
|
-
let
|
|
21
|
-
let
|
|
22
|
-
let
|
|
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
|
+
}
|
|
23
39
|
let open = 0;
|
|
24
40
|
let args = {};
|
|
25
|
-
export let mode = $flowStore?.value.modules[1]?.value.type == FlowModuleValue.type.FORLOOPFLOW ? 'pull' : 'push';
|
|
26
|
-
$: numberOfSteps = $flowStore?.value.modules.length - 1;
|
|
27
41
|
</script>
|
|
28
42
|
|
|
29
|
-
|
|
30
|
-
<div
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
<p>
|
|
59
|
+
Starting from here, the flow for loop over items from the 1rst step's result right above
|
|
60
|
+
<br />We do not support any other kind of for-loop at the moment but we will very
|
|
61
|
+
soon (See <a href="https://github.com/windmill-labs/windmill/issues/350">#350</a>)
|
|
62
|
+
</p>
|
|
63
|
+
<Tooltip>
|
|
64
|
+
This flow being in 'Pull' mode, the rest of the flow will for loop over the list of
|
|
65
|
+
items returned by the trigger script right above. Retrieve the item value using
|
|
66
|
+
`flow_input._value`
|
|
67
|
+
</Tooltip>
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
70
|
+
{/each}
|
|
71
|
+
<Button
|
|
72
|
+
disabled={pathIsEmpty($flowStore.path)}
|
|
73
|
+
class="blue-button"
|
|
37
74
|
on:click={() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
open = -1
|
|
41
|
-
sendUserToast('Flow imported from JSON')
|
|
42
|
-
jsonSetter.closeModal()
|
|
75
|
+
addModule()
|
|
76
|
+
open = $flowStore?.value.modules.length - 1
|
|
43
77
|
}}
|
|
44
78
|
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
<Modal bind:this={jsonViewer}>
|
|
51
|
-
<div slot="title">See JSON</div>
|
|
52
|
-
<div slot="content" class="h-full">
|
|
53
|
-
<FlowViewer flow={flowToMode($flowStore, mode)} tab="json" />
|
|
79
|
+
<Icon class="text-white mr-2" data={faPlus} />
|
|
80
|
+
Add step {pathIsEmpty($flowStore?.path) ? '(pick a name first!)' : ''}
|
|
81
|
+
</Button>
|
|
54
82
|
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<ul class="relative -mt-10">
|
|
59
|
-
<span class="absolute top-0 left-1/2 h-full w-1 bg-gray-400" aria-hidden="true" />
|
|
60
|
-
<div class="relative">
|
|
61
|
-
<li class="flex flex-row flex-shrink max-w-full mx-auto mt-20">
|
|
62
|
-
<div
|
|
63
|
-
class="bg-white border border-gray xl-rounded shadow-lg w-full max-w-4xl mx-4 md:mx-auto p-4"
|
|
64
|
-
>
|
|
65
|
-
<div class="flex flex-row-reverse mr-4">
|
|
66
|
-
<Dropdown
|
|
67
|
-
dropdownItems={[
|
|
68
|
-
{
|
|
69
|
-
displayName: 'Import from JSON',
|
|
70
|
-
icon: faFileImport,
|
|
71
|
-
action: () => {
|
|
72
|
-
jsonSetter.openModal()
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
displayName: 'Export to JSON',
|
|
77
|
-
icon: faFileExport,
|
|
78
|
-
action: () => {
|
|
79
|
-
jsonViewer.openModal()
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
displayName: 'Publish to Hub',
|
|
84
|
-
icon: faGlobe,
|
|
85
|
-
action: () => {
|
|
86
|
-
const url = new URL('https://hub.windmill.dev/flows/add')
|
|
87
|
-
url.searchParams.append(
|
|
88
|
-
'flow',
|
|
89
|
-
btoa(JSON.stringify(flowToMode($flowStore, mode).value))
|
|
90
|
-
)
|
|
91
|
-
url.searchParams.append('schema', btoa(JSON.stringify($flowStore.schema)))
|
|
92
|
-
url.searchParams.append('description', $flowStore.description ?? '')
|
|
93
|
-
url.searchParams.append('summary', $flowStore.summary)
|
|
94
|
-
window.open(url, '_blank')?.focus()
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]}
|
|
98
|
-
relative={false}
|
|
99
|
-
/>
|
|
100
|
-
</div>
|
|
101
|
-
<div class="mb-8 p-4">
|
|
102
|
-
<Path
|
|
103
|
-
bind:error={pathError}
|
|
104
|
-
bind:path={$flowStore.path}
|
|
105
|
-
{initialPath}
|
|
106
|
-
namePlaceholder="my_flow"
|
|
107
|
-
kind="flow"
|
|
108
|
-
>
|
|
109
|
-
<div slot="ownerToolkit">
|
|
110
|
-
Flow permissions depend on their path. Select the group <span class="font-mono"
|
|
111
|
-
>all</span
|
|
112
|
-
>
|
|
113
|
-
to share your flow, and <span class="font-mono">user</span> to keep it private.
|
|
114
|
-
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
115
|
-
</div>
|
|
116
|
-
</Path>
|
|
117
|
-
|
|
118
|
-
<label class="block mt-4">
|
|
119
|
-
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
120
|
-
<textarea
|
|
121
|
-
bind:value={$flowStore.summary}
|
|
122
|
-
class="
|
|
123
|
-
mt-1
|
|
124
|
-
block
|
|
125
|
-
w-full
|
|
126
|
-
rounded-md
|
|
127
|
-
border-gray-300
|
|
128
|
-
shadow-sm
|
|
129
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
130
|
-
"
|
|
131
|
-
placeholder="A very short summary of the flow displayed when the flow is listed"
|
|
132
|
-
rows="1"
|
|
133
|
-
/>
|
|
134
|
-
</label>
|
|
135
|
-
</div>
|
|
136
|
-
<RadioButtonV2
|
|
137
|
-
options={[
|
|
138
|
-
[
|
|
139
|
-
{
|
|
140
|
-
title: 'Push',
|
|
141
|
-
desc: 'Trigger this flow through the generated UI, a manual schedule or by calling the associated webhook'
|
|
142
|
-
},
|
|
143
|
-
'push'
|
|
144
|
-
],
|
|
145
|
-
[
|
|
146
|
-
{
|
|
147
|
-
title: 'Pull',
|
|
148
|
-
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.'
|
|
149
|
-
},
|
|
150
|
-
'pull'
|
|
151
|
-
]
|
|
152
|
-
]}
|
|
153
|
-
bind:value={mode}
|
|
154
|
-
/>
|
|
155
|
-
</div>
|
|
156
|
-
</li>
|
|
157
|
-
<li class="flex flex-row flex-shrink max-w-full mx-auto mt-20">
|
|
158
|
-
<div class="bg-white border border-gray xl-rounded shadow-lg w-full mx-4 xl:mx-20">
|
|
159
|
-
<div
|
|
160
|
-
class="flex items-center justify-between flex-wra px-4 py-5 border-b border-gray-200 sm:px-6"
|
|
161
|
-
>
|
|
162
|
-
<h3 class="text-lg leading-6 font-medium text-gray-900">Flow Input</h3>
|
|
163
|
-
<CopyFirstStepSchema />
|
|
164
|
-
</div>
|
|
165
|
-
<div class="p-4">
|
|
166
|
-
<SchemaEditor schema={$flowStore.schema} />
|
|
167
|
-
<div class="my-4" />
|
|
168
|
-
<FlowPreview {mode} flow={$flowStore} i={numberOfSteps} bind:args />
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</li>
|
|
172
|
-
{#each $flowStore?.value.modules as mod, i}
|
|
173
|
-
<li class="relative mt-16">
|
|
174
|
-
<div class="relative flex justify-center">
|
|
175
|
-
<button
|
|
176
|
-
class="default-button h-10 w-10 shadow-blue-600/40 border-blue-600 shadow"
|
|
177
|
-
on:click={() => {
|
|
178
|
-
addModule(i)
|
|
179
|
-
open = i
|
|
180
|
-
}}
|
|
181
|
-
>
|
|
182
|
-
<Icon class="text-white mb-1" data={faPlus} />
|
|
183
|
-
</button>
|
|
184
|
-
</div>
|
|
185
|
-
</li>
|
|
186
|
-
<ModuleStep bind:open bind:mod bind:args {i} {mode} />
|
|
187
|
-
{/each}
|
|
188
|
-
<li class="relative m-20 ">
|
|
189
|
-
<div class="relative flex justify-center">
|
|
190
|
-
<button
|
|
191
|
-
disabled={pathIsEmpty($flowStore.path)}
|
|
192
|
-
class="default-button h-10 w-10 shadow"
|
|
193
|
-
on:click={() => {
|
|
194
|
-
addModule()
|
|
195
|
-
open = $flowStore?.value.modules.length - 1
|
|
196
|
-
}}
|
|
197
|
-
>
|
|
198
|
-
<Icon class="text-white mb-1" data={faPlus} />
|
|
199
|
-
Add step {pathIsEmpty($flowStore.path) ? '(pick a name first!)' : ''}
|
|
200
|
-
</button>
|
|
201
|
-
</div>
|
|
202
|
-
</li>
|
|
203
|
-
</div>
|
|
204
|
-
</ul>
|
|
205
|
-
</div>
|
|
206
|
-
<div class="py-10 bg-white" />
|
|
83
|
+
{:else}
|
|
84
|
+
<h3>Loading flow</h3>
|
|
85
|
+
{/if}
|
|
207
86
|
|
|
208
87
|
<style>
|
|
209
|
-
.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}</style>
|
|
88
|
+
.line {
|
|
89
|
+
background-image: linear-gradient(#e5e7eb, #e5e7eb);
|
|
90
|
+
background-size: 2px 100%;
|
|
91
|
+
background-repeat: no-repeat;
|
|
92
|
+
background-position: center center;
|
|
93
|
+
}</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>
|