windmill-components 1.13.25 → 1.22.0
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.js +1 -5
- package/components/AppConnect.svelte +281 -0
- package/components/AppConnect.svelte.d.ts +22 -0
- package/components/ArgInfo.svelte +11 -16
- package/components/ArgInput.svelte +73 -70
- package/components/ArgInput.svelte.d.ts +6 -1
- package/components/AutosizedTextarea.svelte +6 -8
- package/components/Badge.svelte +4 -10
- package/components/Button.svelte +22 -18
- package/components/ButtonAndDropdown.svelte +6 -12
- package/components/CenteredModal.svelte +30 -0
- package/components/CenteredModal.svelte.d.ts +19 -0
- package/components/ChevronButton.svelte +4 -9
- package/components/DisplayResult.svelte +58 -57
- package/components/Dropdown.svelte +8 -13
- package/components/Editor.svelte +108 -149
- package/components/Editor.svelte.d.ts +3 -1
- package/components/FieldHeader.svelte +7 -12
- package/components/FlowBuilder.svelte +72 -121
- package/components/FlowBuilder.svelte.d.ts +0 -2
- package/components/FlowEditor.svelte +185 -73
- package/components/FlowEditor.svelte.d.ts +4 -4
- package/components/FlowJobResult.svelte +23 -0
- package/components/FlowJobResult.svelte.d.ts +17 -0
- package/components/FlowPreview.svelte +36 -51
- package/components/FlowPreview.svelte.d.ts +7 -1
- package/components/FlowStatusViewer.svelte +66 -40
- package/components/FlowStatusViewer.svelte.d.ts +1 -1
- package/components/FlowViewer.svelte +100 -0
- package/components/FlowViewer.svelte.d.ts +24 -0
- package/components/GroupModal.svelte +13 -20
- package/components/IconedResourceType.svelte +15 -18
- package/components/InviteGlobalUser.svelte +8 -15
- package/components/InviteUser.svelte +9 -16
- package/components/ItemPicker.svelte +11 -14
- package/components/JobStatus.svelte +6 -11
- package/components/Modal.svelte +14 -17
- package/components/ModuleStep.svelte +125 -64
- package/components/ModuleStep.svelte.d.ts +4 -8
- package/components/ObjectResourceInput.svelte +15 -20
- package/components/ObjectTypeNarrowing.svelte +7 -12
- package/components/PageHeader.svelte +4 -9
- package/components/Password.svelte +6 -8
- package/components/Path.svelte +78 -38
- package/components/Path.svelte.d.ts +2 -0
- package/components/RadioButton.svelte +7 -8
- package/components/RadioButtonV2.svelte +33 -0
- package/components/RadioButtonV2.svelte.d.ts +20 -0
- package/components/Required.svelte +2 -4
- package/components/ResourceEditor.svelte +44 -48
- package/components/ResourcePicker.svelte +6 -7
- package/components/ResourcePicker.svelte.d.ts +2 -2
- package/components/ResourceTypePicker.svelte +8 -13
- package/components/RunForm.svelte +15 -20
- package/components/SchemaEditor.svelte +31 -61
- package/components/SchemaForm.svelte +126 -134
- package/components/SchemaForm.svelte.d.ts +6 -4
- package/components/SchemaModal.svelte +25 -40
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/SchemaViewer.svelte +6 -12
- package/components/ScriptBuilder.svelte +76 -101
- package/components/ScriptEditor.svelte +55 -60
- package/components/ScriptPicker.svelte +28 -34
- package/components/ScriptPicker.svelte.d.ts +1 -0
- package/components/ScriptSchema.svelte +13 -17
- package/components/ShareModal.svelte +23 -29
- package/components/SharedBadge.svelte +11 -16
- package/components/StringTypeNarrowing.svelte +8 -11
- package/components/Switch.svelte.d.ts +2 -2
- package/components/TableCustom.svelte +5 -8
- package/components/TableSimple.svelte +9 -8
- package/components/Tabs.svelte +6 -8
- package/components/Toggle.svelte +34 -0
- package/components/Toggle.svelte.d.ts +28 -0
- package/components/Tooltip.svelte +56 -89
- package/components/Tooltip.svelte.d.ts +1 -5
- package/components/VariableEditor.svelte +30 -29
- package/components/flows/CopyFirstStepSchema.svelte +10 -0
- package/components/flows/CopyFirstStepSchema.svelte.d.ts +14 -0
- package/components/flows/DynamicInputHelpBox.svelte +72 -0
- package/components/flows/DynamicInputHelpBox.svelte.d.ts +14 -0
- package/components/flows/FlowInputs.svelte +27 -0
- package/components/flows/FlowInputs.svelte.d.ts +19 -0
- package/components/flows/FlowModuleHeader.svelte +91 -0
- package/components/flows/FlowModuleHeader.svelte.d.ts +22 -0
- package/components/flows/flowStore.d.ts +17 -0
- package/components/flows/flowStore.js +161 -0
- package/components/flows/pickers/FlowScriptPicker.svelte +11 -0
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +22 -0
- package/components/flows/pickers/PickHubScript.svelte +30 -0
- package/components/flows/pickers/PickHubScript.svelte.d.ts +18 -0
- package/components/flows/pickers/PickScript.svelte +38 -0
- package/components/flows/pickers/PickScript.svelte.d.ts +18 -0
- package/components/flows/utils.d.ts +21 -0
- package/components/flows/utils.js +164 -0
- package/components/icons/DbIcon.svelte +2 -5
- package/components/icons/Mail.svelte +2 -5
- package/components/icons/Mysql.svelte +2 -5
- package/components/icons/PostgresIcon.svelte +2 -5
- package/components/icons/Slack.svelte +2 -5
- package/components/propertyPicker/ObjectViewer.svelte +113 -0
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +21 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte +69 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +21 -0
- package/components/propertyPicker/PropPicker.svelte +24 -0
- package/components/propertyPicker/PropPicker.svelte.d.ts +18 -0
- package/components/propertyPicker/WarningMessage.svelte +43 -0
- package/components/propertyPicker/WarningMessage.svelte.d.ts +16 -0
- package/components/propertyPicker/utils.d.ts +2 -0
- package/components/propertyPicker/utils.js +40 -0
- package/gen/core/ApiError.d.ts +3 -1
- package/gen/core/ApiError.js +4 -6
- package/gen/core/ApiRequestOptions.js +1 -2
- package/gen/core/ApiResult.js +1 -2
- package/gen/core/CancelablePromise.js +2 -7
- package/gen/core/OpenAPI.js +2 -5
- package/gen/core/request.js +8 -13
- package/gen/index.d.ts +3 -0
- package/gen/index.js +28 -58
- package/gen/models/AuditLog.js +2 -5
- package/gen/models/CompletedJob.d.ts +3 -1
- package/gen/models/CompletedJob.js +3 -5
- package/gen/models/ContextualVariable.js +1 -2
- package/gen/models/CreateResource.d.ts +1 -0
- package/gen/models/CreateResource.js +1 -2
- package/gen/models/CreateVariable.d.ts +2 -0
- package/gen/models/CreateVariable.js +1 -2
- package/gen/models/CreateWorkspace.js +1 -2
- package/gen/models/EditResource.js +1 -2
- package/gen/models/EditResourceType.js +1 -2
- package/gen/models/EditSchedule.js +1 -2
- package/gen/models/EditVariable.js +1 -2
- package/gen/models/EditWorkspaceUser.js +1 -2
- package/gen/models/Flow.js +1 -2
- package/gen/models/FlowModule.d.ts +2 -0
- package/gen/models/FlowModule.js +1 -2
- package/gen/models/FlowModuleValue.d.ts +14 -2
- package/gen/models/FlowModuleValue.js +9 -5
- package/gen/models/FlowPreview.js +1 -2
- package/gen/models/FlowStatus.js +1 -2
- package/gen/models/FlowStatusModule.d.ts +6 -0
- package/gen/models/FlowStatusModule.js +2 -5
- package/gen/models/FlowValue.js +1 -2
- package/gen/models/GlobalUserInfo.js +2 -5
- package/gen/models/Group.js +1 -2
- package/gen/models/InputTransform.js +2 -5
- package/gen/models/Job.js +2 -5
- package/gen/models/ListableVariable.d.ts +2 -0
- package/gen/models/ListableVariable.js +1 -2
- package/gen/models/Login.js +1 -2
- package/gen/models/MainArgSignature.js +1 -2
- package/gen/models/NewSchedule.js +1 -2
- package/gen/models/NewToken.js +1 -2
- package/gen/models/NewUser.js +1 -2
- package/gen/models/Preview.js +2 -5
- package/gen/models/QueuedJob.d.ts +2 -1
- package/gen/models/QueuedJob.js +3 -5
- package/gen/models/Resource.d.ts +1 -0
- package/gen/models/Resource.js +1 -2
- package/gen/models/ResourceType.js +1 -2
- package/gen/models/Schedule.js +1 -2
- package/gen/models/Script.d.ts +1 -0
- package/gen/models/Script.js +2 -5
- package/gen/models/ScriptArgs.js +1 -2
- package/gen/models/SlackToken.d.ts +8 -0
- package/gen/models/SlackToken.js +4 -0
- package/gen/models/TokenResponse.d.ts +6 -0
- package/gen/models/TokenResponse.js +4 -0
- package/gen/models/TruncatedToken.js +1 -2
- package/gen/models/User.js +1 -2
- package/gen/models/UserWorkspaceList.js +1 -2
- package/gen/models/WorkerPing.js +1 -2
- package/gen/models/Workspace.js +1 -2
- package/gen/models/WorkspaceInvite.js +1 -2
- package/gen/services/AdminService.d.ts +6 -2
- package/gen/services/AdminService.js +6 -10
- package/gen/services/AuditService.d.ts +24 -8
- package/gen/services/AuditService.js +5 -9
- package/gen/services/FlowService.d.ts +37 -10
- package/gen/services/FlowService.js +23 -12
- package/gen/services/GranularAclService.d.ts +6 -2
- package/gen/services/GranularAclService.js +6 -10
- package/gen/services/GroupService.d.ts +18 -6
- package/gen/services/GroupService.js +11 -15
- package/gen/services/JobService.d.ts +167 -46
- package/gen/services/JobService.js +42 -22
- package/gen/services/OauthService.d.ts +104 -0
- package/gen/services/OauthService.js +133 -0
- package/gen/services/ResourceService.d.ts +39 -7
- package/gen/services/ResourceService.js +44 -18
- package/gen/services/ScheduleService.d.ts +36 -6
- package/gen/services/ScheduleService.js +39 -13
- package/gen/services/ScriptService.d.ts +66 -19
- package/gen/services/ScriptService.js +32 -20
- package/gen/services/SettingsService.js +5 -9
- package/gen/services/UserService.d.ts +49 -11
- package/gen/services/UserService.js +42 -29
- package/gen/services/VariableService.d.ts +19 -4
- package/gen/services/VariableService.js +24 -13
- package/gen/services/WorkerService.d.ts +6 -2
- package/gen/services/WorkerService.js +4 -8
- package/gen/services/WorkspaceService.d.ts +29 -24
- package/gen/services/WorkspaceService.js +23 -42
- package/infer.js +5 -9
- package/logout.js +20 -18
- package/package.json +51 -24
- package/script_helpers.d.ts +4 -0
- package/script_helpers.js +70 -0
- package/scripts.d.ts +2 -1
- package/scripts.js +11 -15
- package/stores.d.ts +6 -0
- package/stores.js +30 -22
- package/user.js +10 -15
- package/utils.d.ts +15 -1
- package/utils.js +191 -52
|
@@ -1,57 +1,68 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const FlowEditor_svelte_1 = __importDefault(require("./FlowEditor.svelte"));
|
|
17
|
-
exports.initialPath = '';
|
|
1
|
+
<script>import { goto } from '$app/navigation';
|
|
2
|
+
import { page } from '$app/stores';
|
|
3
|
+
import { FlowService, ScriptService } from '../gen';
|
|
4
|
+
import { clearPreviewResults, hubScripts, workspaceStore } from '../stores';
|
|
5
|
+
import { sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
|
+
import { faFileExport, faFileImport } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { onMount } from 'svelte';
|
|
8
|
+
import Icon from 'svelte-awesome';
|
|
9
|
+
import FlowEditor from './FlowEditor.svelte';
|
|
10
|
+
import { flowStore } from './flows/flowStore';
|
|
11
|
+
import { flowToMode } from './flows/utils';
|
|
12
|
+
import ScriptSchema from './ScriptSchema.svelte';
|
|
13
|
+
export let initialPath = '';
|
|
14
|
+
let pathError = '';
|
|
15
|
+
let mode;
|
|
18
16
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
17
|
+
async function loadSearchData() {
|
|
18
|
+
const scripts = await ScriptService.listHubScripts();
|
|
19
|
+
$hubScripts = scripts.map((x) => ({
|
|
20
|
+
path: `hub/${x.id}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
|
|
21
|
+
summary: `${x.summary} (${x.app})`,
|
|
22
|
+
approved: x.approved,
|
|
23
|
+
is_trigger: x.is_trigger
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
19
26
|
async function saveFlow() {
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
const newFlow = flowToMode($flowStore, mode);
|
|
28
|
+
if (initialPath === '') {
|
|
29
|
+
await FlowService.createFlow({
|
|
22
30
|
workspace: $workspaceStore,
|
|
23
31
|
requestBody: {
|
|
24
|
-
path:
|
|
25
|
-
summary:
|
|
26
|
-
description:
|
|
27
|
-
value:
|
|
28
|
-
schema:
|
|
32
|
+
path: newFlow.path,
|
|
33
|
+
summary: newFlow.summary,
|
|
34
|
+
description: newFlow.description ?? '',
|
|
35
|
+
value: newFlow.value,
|
|
36
|
+
schema: newFlow.schema
|
|
29
37
|
}
|
|
30
38
|
});
|
|
31
39
|
}
|
|
32
40
|
else {
|
|
33
|
-
await
|
|
41
|
+
await FlowService.updateFlow({
|
|
34
42
|
workspace: $workspaceStore,
|
|
35
|
-
path:
|
|
43
|
+
path: newFlow.path,
|
|
36
44
|
requestBody: {
|
|
37
|
-
path:
|
|
38
|
-
summary:
|
|
39
|
-
description:
|
|
40
|
-
value:
|
|
41
|
-
schema:
|
|
45
|
+
path: newFlow.path,
|
|
46
|
+
summary: newFlow.summary,
|
|
47
|
+
description: newFlow.description ?? '',
|
|
48
|
+
value: newFlow.value,
|
|
49
|
+
schema: newFlow.schema
|
|
42
50
|
}
|
|
43
51
|
});
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
sendUserToast(`Success! flow saved at ${$flowStore.path}`);
|
|
54
|
+
goto(`/flows/get/${$flowStore.path}`);
|
|
47
55
|
}
|
|
48
56
|
async function changeStep(step) {
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
$: {
|
|
52
|
-
$page.url.searchParams.set('state', btoa(JSON.stringify(exports.flow)));
|
|
53
|
-
history.replaceState({}, '', $page.url);
|
|
57
|
+
goto(`?step=${step}`);
|
|
54
58
|
}
|
|
59
|
+
flowStore.subscribe((flow) => {
|
|
60
|
+
setQueryWithoutLoad($page.url, 'state', btoa(JSON.stringify(flowToMode(flow, mode))));
|
|
61
|
+
});
|
|
62
|
+
onMount(() => {
|
|
63
|
+
loadSearchData();
|
|
64
|
+
clearPreviewResults();
|
|
65
|
+
});
|
|
55
66
|
</script>
|
|
56
67
|
|
|
57
68
|
<div class="flex flex-col h-screen max-w-screen-lg xl:-ml-20 xl:pl-4 w-full -mt-4 pt-4 md:mx-10 ">
|
|
@@ -60,45 +71,42 @@ $: {
|
|
|
60
71
|
<div class="justify-between flex flex-row drop-shadow-sm w-full">
|
|
61
72
|
<div class="wizard-nav flex flex-row w-full">
|
|
62
73
|
<button
|
|
74
|
+
disabled={pathError != ''}
|
|
63
75
|
class="{step === 1
|
|
64
76
|
? 'default-button-disabled text-gray-700'
|
|
65
77
|
: 'default-button-secondary'} min-w-max ml-2"
|
|
66
78
|
on:click={() => {
|
|
67
79
|
changeStep(1)
|
|
68
|
-
}}>Step 1:
|
|
80
|
+
}}>Step 1: Flow</button
|
|
69
81
|
>
|
|
70
82
|
<button
|
|
83
|
+
disabled={pathError != ''}
|
|
71
84
|
class="{step === 2
|
|
72
85
|
? 'default-button-disabled text-gray-700'
|
|
73
86
|
: 'default-button-secondary'} min-w-max ml-2"
|
|
74
87
|
on:click={() => {
|
|
75
88
|
changeStep(2)
|
|
76
|
-
}}>Step 2:
|
|
77
|
-
>
|
|
78
|
-
<button
|
|
79
|
-
class="{step === 3
|
|
80
|
-
? 'default-button-disabled text-gray-700'
|
|
81
|
-
: 'default-button-secondary'} min-w-max ml-2"
|
|
82
|
-
on:click={() => {
|
|
83
|
-
changeStep(3)
|
|
84
|
-
}}>Step 3: UI customisation</button
|
|
89
|
+
}}>Step 2: UI customisation</button
|
|
85
90
|
>
|
|
86
91
|
</div>
|
|
87
92
|
<div class="flex flex-row-reverse ml-2">
|
|
88
|
-
{#if step
|
|
93
|
+
{#if step == 1}
|
|
89
94
|
<button
|
|
90
|
-
disabled={
|
|
91
|
-
(flow.path == undefined || flow.path == '' || flow.path.split('/')[2] == '')}
|
|
95
|
+
disabled={pathError != ''}
|
|
92
96
|
class="default-button px-6 max-h-8"
|
|
93
97
|
on:click={() => {
|
|
94
98
|
changeStep(step + 1)
|
|
95
|
-
}}
|
|
99
|
+
}}
|
|
96
100
|
>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
Next
|
|
102
|
+
</button>
|
|
103
|
+
<button
|
|
104
|
+
disabled={pathError != ''}
|
|
105
|
+
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
106
|
+
on:click={saveFlow}
|
|
107
|
+
>
|
|
108
|
+
Save
|
|
109
|
+
</button>
|
|
102
110
|
{:else}
|
|
103
111
|
<button class="default-button px-6 self-end" on:click={saveFlow}>Save</button>
|
|
104
112
|
{/if}
|
|
@@ -106,79 +114,22 @@ $: {
|
|
|
106
114
|
</div>
|
|
107
115
|
<div class="flex flex-row-reverse">
|
|
108
116
|
<span class="my-1 text-sm text-gray-500 italic">
|
|
109
|
-
{#if initialPath && initialPath !=
|
|
110
|
-
{
|
|
117
|
+
{#if initialPath && initialPath != $flowStore.path} {initialPath} → {/if}
|
|
118
|
+
{$flowStore.path}
|
|
111
119
|
</span>
|
|
112
120
|
</div>
|
|
113
121
|
</div>
|
|
114
122
|
|
|
115
123
|
<!-- metadata -->
|
|
116
|
-
{#if step === 1}
|
|
117
|
-
<div class="grid grid-cols-1 gap-6 max-w-7xl">
|
|
118
|
-
<Path bind:path={flow.path} {initialPath} namePlaceholder="example/my/flow">
|
|
119
|
-
<div slot="ownerToolkit" class="text-gray-700 text-2xs">
|
|
120
|
-
Flow permissions depend on their path. Select the group <span class="font-mono">all</span>
|
|
121
|
-
to share your flow, and <span class="font-mono">user</span> to keep it private.
|
|
122
|
-
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
123
|
-
</div>
|
|
124
|
-
</Path>
|
|
125
|
-
<h3 class="text-gray-700 pb-1 border-b">Metadata</h3>
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<textarea
|
|
130
|
-
bind:value={flow.summary}
|
|
131
|
-
class="
|
|
132
|
-
mt-1
|
|
133
|
-
block
|
|
134
|
-
w-full
|
|
135
|
-
rounded-md
|
|
136
|
-
border-gray-300
|
|
137
|
-
shadow-sm
|
|
138
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
139
|
-
"
|
|
140
|
-
placeholder="A very short summary of the flow displayed when the flow is listed"
|
|
141
|
-
rows="1"
|
|
142
|
-
/>
|
|
143
|
-
</label>
|
|
144
|
-
<label class="block ">
|
|
145
|
-
<span class="text-gray-700"
|
|
146
|
-
>Description<Required required={false} detail="accept markdown formatting" />
|
|
147
|
-
<textarea
|
|
148
|
-
bind:value={flow.description}
|
|
149
|
-
class="
|
|
150
|
-
mt-1
|
|
151
|
-
block
|
|
152
|
-
w-full
|
|
153
|
-
rounded-md
|
|
154
|
-
border-gray-300
|
|
155
|
-
shadow-sm
|
|
156
|
-
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
157
|
-
"
|
|
158
|
-
placeholder="A description to help users understand what this flow does and how to use it."
|
|
159
|
-
rows="3"
|
|
160
|
-
/>
|
|
161
|
-
</span></label
|
|
162
|
-
>
|
|
163
|
-
|
|
164
|
-
<div>
|
|
165
|
-
<h3 class="text-gray-700 ">Description rendered</h3>
|
|
166
|
-
<div
|
|
167
|
-
class="prose mt-5 text-xs shadow-inner shadow-blue p-4 overflow-auto"
|
|
168
|
-
style="max-height: 200px;"
|
|
169
|
-
>
|
|
170
|
-
<SvelteMarkdown source={flow.description ?? ''} />
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
125
|
+
{#if step === 1}
|
|
126
|
+
<FlowEditor bind:mode bind:pathError bind:initialPath />
|
|
174
127
|
{:else if step === 2}
|
|
175
|
-
<FlowEditor bind:flow />
|
|
176
|
-
{:else if step === 3}
|
|
177
128
|
<ScriptSchema
|
|
178
129
|
synchronizedHeader={false}
|
|
179
|
-
bind:summary={
|
|
180
|
-
bind:description={
|
|
181
|
-
bind:schema={
|
|
130
|
+
bind:summary={$flowStore.summary}
|
|
131
|
+
bind:description={$flowStore.description}
|
|
132
|
+
bind:schema={$flowStore.schema}
|
|
182
133
|
/>
|
|
183
134
|
{/if}
|
|
184
135
|
</div>
|
|
@@ -1,102 +1,214 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script>import { FlowModuleValue } from '../gen';
|
|
2
|
+
import { faFileExport, faFileImport, faGlobe, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import Icon from 'svelte-awesome';
|
|
4
|
+
import FlowPreview from './FlowPreview.svelte';
|
|
5
|
+
import CopyFirstStepSchema from './flows/CopyFirstStepSchema.svelte';
|
|
6
|
+
import { addModule, flowStore } from './flows/flowStore';
|
|
7
|
+
import ModuleStep from './ModuleStep.svelte';
|
|
8
|
+
import Path from './Path.svelte';
|
|
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';
|
|
18
|
+
export let pathError = '';
|
|
19
|
+
export let initialPath = '';
|
|
20
|
+
let jsonSetter;
|
|
21
|
+
let jsonViewer;
|
|
22
|
+
let jsonValue = '';
|
|
23
|
+
let open = 0;
|
|
16
24
|
let args = {};
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
async function loadSchemas() {
|
|
20
|
-
await Promise.all(exports.flow.value.modules.map(async (x, i) => {
|
|
21
|
-
if (x.value.path) {
|
|
22
|
-
const schema = await (0, scripts_1.loadSchema)(x.value.path ?? '');
|
|
23
|
-
if (JSON.stringify(Object.keys(schema?.properties ?? {}).sort()) !=
|
|
24
|
-
JSON.stringify(Object.keys(x.input_transform).sort())) {
|
|
25
|
-
let it = {};
|
|
26
|
-
Object.keys(schema?.properties ?? {}).map((x) => (it[x] = {
|
|
27
|
-
type: 'static',
|
|
28
|
-
value: ''
|
|
29
|
-
}));
|
|
30
|
-
schemaForms[i]?.setArgs(it);
|
|
31
|
-
}
|
|
32
|
-
schemas[i] = schema ?? (0, utils_1.emptySchema)();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
schemaForms[i]?.setArgs({});
|
|
36
|
-
schemas[i] = (0, utils_1.emptySchema)();
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
schemas = schemas;
|
|
40
|
-
if (exports.flow.value.modules.length == 0) {
|
|
41
|
-
addModule();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.loadSchemas = loadSchemas;
|
|
45
|
-
function addModule() {
|
|
46
|
-
schemaForms.push(undefined);
|
|
47
|
-
let newModule = {
|
|
48
|
-
value: { type: gen_1.FlowModuleValue.type.SCRIPT, path: '' },
|
|
49
|
-
input_transform: {}
|
|
50
|
-
};
|
|
51
|
-
exports.flow.value.modules = exports.flow.value.modules.concat(newModule);
|
|
52
|
-
schemas.push((0, utils_1.emptySchema)());
|
|
53
|
-
}
|
|
54
|
-
$: $workspaceStore && loadSchemas();
|
|
25
|
+
export let mode = $flowStore?.value.modules[1]?.value.type == FlowModuleValue.type.FORLOOPFLOW ? 'pull' : 'push';
|
|
26
|
+
$: numberOfSteps = $flowStore?.value.modules.length - 1;
|
|
55
27
|
</script>
|
|
56
28
|
|
|
57
|
-
|
|
29
|
+
<Modal bind:this={jsonSetter}>
|
|
30
|
+
<div slot="title">Import JSON</div>
|
|
31
|
+
<div slot="content" class="h-full">
|
|
32
|
+
<Editor bind:code={jsonValue} lang={'json'} class="h-full" />
|
|
33
|
+
</div>
|
|
34
|
+
<div slot="submission">
|
|
35
|
+
<button
|
|
36
|
+
class="default-button px-4 py-2 font-semibold"
|
|
37
|
+
on:click={() => {
|
|
38
|
+
Object.assign($flowStore, JSON.parse(jsonValue))
|
|
39
|
+
$flowStore = $flowStore
|
|
40
|
+
open = -1
|
|
41
|
+
sendUserToast('Flow imported from JSON')
|
|
42
|
+
jsonSetter.closeModal()
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
Import
|
|
46
|
+
</button>
|
|
47
|
+
</div></Modal
|
|
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" />
|
|
54
|
+
</div>
|
|
55
|
+
</Modal>
|
|
56
|
+
|
|
58
57
|
<div class="flow-root bg-gray-50 rounded-xl border border-gray-200">
|
|
59
58
|
<ul class="relative -mt-10">
|
|
60
59
|
<span class="absolute top-0 left-1/2 h-full w-1 bg-gray-400" aria-hidden="true" />
|
|
61
60
|
<div class="relative">
|
|
62
|
-
<li class="flex flex-row flex-shrink max-w-full
|
|
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">
|
|
63
158
|
<div class="bg-white border border-gray xl-rounded shadow-lg w-full mx-4 xl:mx-20">
|
|
64
159
|
<div
|
|
65
160
|
class="flex items-center justify-between flex-wra px-4 py-5 border-b border-gray-200 sm:px-6"
|
|
66
161
|
>
|
|
67
162
|
<h3 class="text-lg leading-6 font-medium text-gray-900">Flow Input</h3>
|
|
68
|
-
<
|
|
69
|
-
class="text-xs default-button-secondary max-h-6 place-self-end"
|
|
70
|
-
disabled={flow.value.modules.length == 0 ||
|
|
71
|
-
flow.value.modules[0].value.path == undefined}
|
|
72
|
-
on:click={async () => {
|
|
73
|
-
flow.schema = await loadSchema(flow.value.modules[0].value.path ?? '')
|
|
74
|
-
}}
|
|
75
|
-
>Copy from step 1's schema
|
|
76
|
-
</button>
|
|
163
|
+
<CopyFirstStepSchema />
|
|
77
164
|
</div>
|
|
78
165
|
<div class="p-4">
|
|
79
|
-
<SchemaEditor
|
|
166
|
+
<SchemaEditor schema={$flowStore.schema} />
|
|
80
167
|
<div class="my-4" />
|
|
81
|
-
<FlowPreview {flow} i={
|
|
168
|
+
<FlowPreview {mode} flow={$flowStore} i={numberOfSteps} bind:args />
|
|
82
169
|
</div>
|
|
83
170
|
</div>
|
|
84
171
|
</li>
|
|
85
|
-
{#each
|
|
86
|
-
<
|
|
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} />
|
|
87
187
|
{/each}
|
|
88
188
|
<li class="relative m-20 ">
|
|
89
|
-
<div class="absolute inset-0 flex items-center" aria-hidden="true">
|
|
90
|
-
<div class="w-full border-t border-gray-300" />
|
|
91
|
-
</div>
|
|
92
189
|
<div class="relative flex justify-center">
|
|
93
190
|
<button
|
|
94
|
-
|
|
95
|
-
|
|
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
|
+
}}
|
|
96
197
|
>
|
|
198
|
+
<Icon class="text-white mb-1" data={faPlus} />
|
|
199
|
+
Add step {pathIsEmpty($flowStore.path) ? '(pick a name first!)' : ''}
|
|
200
|
+
</button>
|
|
97
201
|
</div>
|
|
98
202
|
</li>
|
|
99
203
|
</div>
|
|
100
204
|
</ul>
|
|
101
205
|
</div>
|
|
102
206
|
<div class="py-10 bg-white" />
|
|
207
|
+
|
|
208
|
+
<style>
|
|
209
|
+
.shadow:not([disabled]) {
|
|
210
|
+
--tw-border-opacity: 1;
|
|
211
|
+
border-color: rgb(37 99 235 / var(--tw-border-opacity));
|
|
212
|
+
--tw-shadow-color: rgb(37 99 235 / 0.4);
|
|
213
|
+
--tw-shadow: var(--tw-shadow-colored)
|
|
214
|
+
}</style>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type
|
|
2
|
+
import { type FlowMode } from './flows/flowStore';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
pathError?: string | undefined;
|
|
6
|
+
initialPath?: string | undefined;
|
|
7
|
+
mode?: FlowMode | undefined;
|
|
7
8
|
};
|
|
8
9
|
events: {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -14,6 +15,5 @@ export declare type FlowEditorProps = typeof __propDef.props;
|
|
|
14
15
|
export declare type FlowEditorEvents = typeof __propDef.events;
|
|
15
16
|
export declare type FlowEditorSlots = typeof __propDef.slots;
|
|
16
17
|
export default class FlowEditor extends SvelteComponentTyped<FlowEditorProps, FlowEditorEvents, FlowEditorSlots> {
|
|
17
|
-
get loadSchemas(): () => Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>import ChevronButton from './ChevronButton.svelte';
|
|
2
|
+
import DisplayResult from './DisplayResult.svelte';
|
|
3
|
+
export let job;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if job}
|
|
7
|
+
<div class="flex flex-col ml-10">
|
|
8
|
+
<div>
|
|
9
|
+
<ChevronButton text="result" viewOptions={true}>
|
|
10
|
+
<div class="text-xs">
|
|
11
|
+
<DisplayResult result={job.result} />
|
|
12
|
+
</div>
|
|
13
|
+
</ChevronButton>
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<ChevronButton text="logs" viewOptions={true}>
|
|
17
|
+
<div class="text-xs p-4 bg-gray-50 overflow-auto max-h-lg">
|
|
18
|
+
<pre class="w-full">{job.logs}</pre>
|
|
19
|
+
</div>
|
|
20
|
+
</ChevronButton>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { CompletedJob } from '../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
job: CompletedJob | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type FlowJobResultProps = typeof __propDef.props;
|
|
13
|
+
export declare type FlowJobResultEvents = typeof __propDef.events;
|
|
14
|
+
export declare type FlowJobResultSlots = typeof __propDef.slots;
|
|
15
|
+
export default class FlowJobResult extends SvelteComponentTyped<FlowJobResultProps, FlowJobResultEvents, FlowJobResultSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|