windmill-components 1.35.42 → 1.35.43
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/ArgInput.svelte +19 -19
- package/components/ArgInput.svelte.d.ts +1 -1
- package/components/DisplayResult.svelte +73 -67
- package/components/Editor.svelte +177 -164
- package/components/Editor.svelte.d.ts +4 -2
- package/components/EditorBar.svelte +58 -45
- package/components/EditorBar.svelte.d.ts +2 -1
- package/components/FlowBuilder.svelte +113 -121
- package/components/FlowJobResult.svelte +4 -5
- package/components/FlowModulesViewer.svelte +89 -7
- package/components/FlowModulesViewer.svelte.d.ts +1 -0
- package/components/FlowPreviewContent.svelte +56 -15
- package/components/FlowPreviewContent.svelte.d.ts +1 -1
- package/components/FlowStatusViewer.svelte +42 -24
- package/components/FlowStatusViewer.svelte.d.ts +0 -1
- package/components/FlowViewer.svelte +7 -3
- package/components/HighlightCode.svelte +21 -0
- package/components/HighlightCode.svelte.d.ts +17 -0
- package/components/IconedPath.svelte +9 -7
- package/components/InputTransformForm.svelte +87 -106
- package/components/InputTransformForm.svelte.d.ts +0 -1
- package/components/ItemPicker.svelte +2 -2
- package/components/LogViewer.svelte +23 -0
- package/components/LogViewer.svelte.d.ts +19 -0
- package/components/ModulePreview.svelte +108 -0
- package/components/ModulePreview.svelte.d.ts +24 -0
- package/components/RunForm.svelte +29 -18
- package/components/RunForm.svelte.d.ts +6 -2
- package/components/SchemaEditor.svelte +3 -1
- package/components/SchemaForm.svelte +0 -2
- package/components/SchemaForm.svelte.d.ts +0 -1
- package/components/ScriptBuilder.svelte +77 -66
- package/components/ScriptBuilder.svelte.d.ts +2 -4
- package/components/ScriptEditor.svelte +69 -142
- package/components/ScriptEditor.svelte.d.ts +0 -5
- package/components/ScriptPicker.svelte +3 -3
- package/components/ScriptPicker.svelte.d.ts +2 -1
- package/components/SharedBadge.svelte +5 -13
- package/components/SimpleEditor.svelte +4 -0
- package/components/TestJobLoader.svelte +98 -0
- package/components/TestJobLoader.svelte.d.ts +26 -0
- package/components/Tooltip.svelte +2 -1
- package/components/common/actionRow/ActionRow.svelte +26 -0
- package/components/common/actionRow/ActionRow.svelte.d.ts +21 -0
- package/components/common/alert/Alert.svelte +53 -0
- package/components/common/alert/Alert.svelte.d.ts +20 -0
- package/components/common/alert/model.d.ts +1 -0
- package/components/common/alert/model.js +1 -0
- package/components/common/badge/Badge.svelte +82 -0
- package/components/common/badge/Badge.svelte.d.ts +28 -0
- package/components/common/badge/model.d.ts +8 -0
- package/components/common/badge/model.js +1 -0
- package/components/common/button/Button.svelte +107 -0
- package/components/common/button/Button.svelte.d.ts +37 -0
- package/components/common/button/model.d.ts +6 -0
- package/components/common/button/model.js +1 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte +55 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte.d.ts +23 -0
- package/components/common/drawer/Drawer.svelte +3 -0
- package/components/common/drawer/Drawer.svelte.d.ts +2 -0
- package/components/common/index.d.ts +14 -0
- package/components/common/index.js +14 -0
- package/components/common/tabs/TabContent.svelte +3 -2
- package/components/common/tabs/TabContent.svelte.d.ts +1 -0
- package/components/common/tabs/Tabs.svelte +8 -1
- package/components/common/tabs/Tabs.svelte.d.ts +2 -0
- package/components/common/toggleButton/ToggleButton.svelte +20 -0
- package/components/common/toggleButton/ToggleButton.svelte.d.ts +19 -0
- package/components/common/toggleButton/ToggleButtonGroup.svelte +33 -0
- package/components/common/toggleButton/ToggleButtonGroup.svelte.d.ts +24 -0
- package/components/flows/FlowEditor.svelte +30 -0
- package/components/{FlowEditor.svelte.d.ts → flows/FlowEditor.svelte.d.ts} +1 -8
- package/components/flows/common/FlowCard.svelte +9 -0
- package/components/flows/common/FlowCard.svelte.d.ts +21 -0
- package/components/flows/common/FlowCardHeader.svelte +39 -0
- package/components/flows/common/FlowCardHeader.svelte.d.ts +20 -0
- package/components/flows/content/CopyFirstStepSchema.svelte +13 -0
- package/components/flows/{CopyFirstStepSchema.svelte.d.ts → content/CopyFirstStepSchema.svelte.d.ts} +0 -0
- package/components/flows/{DynamicInputHelpBox.svelte → content/DynamicInputHelpBox.svelte} +0 -0
- package/components/flows/{DynamicInputHelpBox.svelte.d.ts → content/DynamicInputHelpBox.svelte.d.ts} +0 -0
- package/components/flows/content/FlowEditorPanel.svelte +26 -0
- package/components/flows/content/FlowEditorPanel.svelte.d.ts +14 -0
- package/components/flows/content/FlowFailureModule.svelte +17 -0
- package/components/flows/content/FlowFailureModule.svelte.d.ts +14 -0
- package/components/flows/content/FlowInput.svelte +22 -0
- package/components/flows/{FlowInput.svelte.d.ts → content/FlowInput.svelte.d.ts} +0 -0
- package/components/flows/{FlowInputs.svelte → content/FlowInputs.svelte} +24 -13
- package/components/flows/{FlowInputs.svelte.d.ts → content/FlowInputs.svelte.d.ts} +0 -0
- package/components/flows/content/FlowLoop.svelte +38 -0
- package/components/flows/content/FlowLoop.svelte.d.ts +14 -0
- package/components/flows/content/FlowModule.svelte +190 -0
- package/components/flows/content/FlowModule.svelte.d.ts +29 -0
- package/components/flows/content/FlowModuleAdvancedSettings.svelte +64 -0
- package/components/flows/content/FlowModuleAdvancedSettings.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleHeader.svelte +68 -0
- package/components/flows/{FlowModuleHeader.svelte.d.ts → content/FlowModuleHeader.svelte.d.ts} +2 -3
- package/components/flows/content/FlowModuleScript.svelte +21 -0
- package/components/flows/content/FlowModuleScript.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleWrapper.svelte +47 -0
- package/components/flows/content/FlowModuleWrapper.svelte.d.ts +14 -0
- package/components/flows/content/FlowRetries.svelte +80 -0
- package/components/flows/content/FlowRetries.svelte.d.ts +14 -0
- package/components/flows/content/FlowSchedules.svelte +18 -0
- package/components/flows/content/FlowSchedules.svelte.d.ts +14 -0
- package/components/flows/content/FlowSettings.svelte +51 -0
- package/components/flows/{FlowSettings.svelte.d.ts → content/FlowSettings.svelte.d.ts} +1 -6
- package/components/flows/content/RemoveStepConfirmationModal.svelte +32 -0
- package/components/flows/content/RemoveStepConfirmationModal.svelte.d.ts +19 -0
- package/components/flows/flowState.d.ts +8 -7
- package/components/flows/flowState.js +25 -46
- package/components/flows/flowStateUtils.d.ts +15 -13
- package/components/flows/flowStateUtils.js +80 -72
- package/components/flows/flowStore.js +7 -4
- package/components/flows/header/FlowEditorHeader.svelte +23 -0
- package/components/flows/header/FlowEditorHeader.svelte.d.ts +14 -0
- package/components/flows/header/FlowImportExportMenu.svelte +56 -0
- package/components/flows/header/FlowImportExportMenu.svelte.d.ts +14 -0
- package/components/flows/header/FlowPreviewButtons.svelte +49 -0
- package/components/flows/header/FlowPreviewButtons.svelte.d.ts +14 -0
- package/components/flows/header/FlowStatus.svelte +36 -0
- package/components/flows/header/FlowStatus.svelte.d.ts +14 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte +54 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte.d.ts +14 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte +58 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +27 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte +161 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +20 -0
- package/components/flows/pickers/PickHubScript.svelte +4 -3
- package/components/flows/pickers/PickHubScript.svelte.d.ts +2 -1
- package/components/flows/pickers/PickScript.svelte +4 -12
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
- package/components/flows/propPicker/PropPickerWrapper.svelte +42 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +31 -0
- package/components/flows/scheduleUtils.d.ts +0 -1
- package/components/flows/scheduleUtils.js +0 -1
- package/components/flows/types.d.ts +9 -0
- package/components/flows/types.js +1 -0
- package/components/flows/utils.d.ts +1 -1
- package/components/flows/utils.js +8 -11
- package/components/icons/HatIcon.svelte +19 -0
- package/components/icons/HatIcon.svelte.d.ts +16 -0
- package/components/landing/FlowGettingStarted.svelte +22 -68
- package/components/landing/FlowLandingBox.svelte +1 -1
- package/components/landing/RessourceGettingStarted.svelte +7 -37
- package/components/landing/ScriptBox.svelte +33 -60
- package/components/landing/ScriptGettingStarted.svelte +23 -69
- package/components/propertyPicker/ObjectViewer.svelte +16 -7
- package/components/propertyPicker/PropPicker.svelte +38 -12
- package/components/propertyPicker/WarningMessage.svelte +2 -15
- package/components/script_editor/LogPanel.svelte +108 -119
- package/components/script_editor/LogPanel.svelte.d.ts +2 -0
- package/components/sidebar/SidebarContent.svelte +2 -2
- package/gen/models/CompletedJob.d.ts +2 -1
- package/gen/models/CompletedJob.js +1 -0
- package/gen/models/FlowModule.d.ts +1 -0
- package/gen/models/FlowStatus.d.ts +3 -0
- package/gen/models/FlowStatusModule.d.ts +1 -1
- package/gen/models/FlowValue.d.ts +11 -0
- package/gen/models/Preview.d.ts +2 -1
- package/gen/models/Preview.js +1 -0
- package/gen/models/QueuedJob.d.ts +2 -1
- package/gen/models/QueuedJob.js +1 -0
- package/gen/models/RawScript.d.ts +2 -1
- package/gen/models/RawScript.js +1 -0
- package/gen/models/Script.d.ts +9 -2
- package/gen/models/Script.js +8 -0
- package/gen/services/JobService.d.ts +40 -0
- package/gen/services/JobService.js +70 -0
- package/gen/services/ScriptService.d.ts +14 -3
- package/gen/services/ScriptService.js +13 -0
- package/infer.d.ts +1 -1
- package/infer.js +6 -1
- package/package.json +65 -35
- package/script_helpers.d.ts +5 -2
- package/script_helpers.js +41 -13
- package/stores.d.ts +1 -1
- package/utils.d.ts +6 -4
- package/utils.js +27 -4
- package/components/FlowEditor.svelte +0 -55
- package/components/FlowPreview.svelte +0 -107
- package/components/FlowPreview.svelte.d.ts +0 -23
- package/components/ModuleStep.svelte +0 -131
- package/components/ModuleStep.svelte.d.ts +0 -25
- package/components/flows/CopyFirstStepSchema.svelte +0 -13
- package/components/flows/FlowBox.svelte +0 -16
- package/components/flows/FlowBox.svelte.d.ts +0 -23
- package/components/flows/FlowBoxHeader.svelte +0 -16
- package/components/flows/FlowBoxHeader.svelte.d.ts +0 -21
- package/components/flows/FlowInput.svelte +0 -22
- package/components/flows/FlowModuleHeader.svelte +0 -109
- package/components/flows/FlowSettings.svelte +0 -165
- package/components/flows/FlowTimeline.svelte +0 -169
- package/components/flows/FlowTimeline.svelte.d.ts +0 -21
- package/components/flows/stepOpenedStore.d.ts +0 -1
- package/components/flows/stepOpenedStore.js +0 -6
- package/components/propertyPicker/OverlayPropertyPicker.svelte +0 -69
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +0 -24
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import * as monaco from 'monaco-editor';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
lang?: string | undefined;
|
|
6
|
+
lang: 'typescript' | 'python' | 'go';
|
|
7
7
|
code?: string | undefined;
|
|
8
8
|
hash?: string | undefined;
|
|
9
9
|
cmdEnterAction?: (() => void) | undefined;
|
|
@@ -21,6 +21,7 @@ declare const __propDef: {
|
|
|
21
21
|
setCode?: ((ncode: string) => void) | undefined;
|
|
22
22
|
clearContent?: (() => Promise<void>) | undefined;
|
|
23
23
|
reloadWebsocket?: (() => Promise<void>) | undefined;
|
|
24
|
+
addAction?: ((id: string, label: string, callback: (editor: monaco.editor.IStandaloneCodeEditor) => void, keybindings?: number[]) => void) | undefined;
|
|
24
25
|
};
|
|
25
26
|
events: {
|
|
26
27
|
change: CustomEvent<any>;
|
|
@@ -41,5 +42,6 @@ export default class Editor extends SvelteComponentTyped<EditorProps, EditorEven
|
|
|
41
42
|
get setCode(): (ncode: string) => void;
|
|
42
43
|
get clearContent(): () => Promise<void>;
|
|
43
44
|
get reloadWebsocket(): () => Promise<void>;
|
|
45
|
+
get addAction(): (id: string, label: string, callback: (editor: monaco.editor.IStandaloneCodeEditor) => void, keybindings?: number[]) => void;
|
|
44
46
|
}
|
|
45
47
|
export {};
|
|
@@ -9,9 +9,11 @@ import ItemPicker from './ItemPicker.svelte';
|
|
|
9
9
|
import Modal from './Modal.svelte';
|
|
10
10
|
import ResourceEditor from './ResourceEditor.svelte';
|
|
11
11
|
import VariableEditor from './VariableEditor.svelte';
|
|
12
|
+
import Button from './common/button/Button.svelte';
|
|
12
13
|
export let lang;
|
|
13
14
|
export let editor;
|
|
14
15
|
export let websocketAlive;
|
|
16
|
+
export let iconOnly = false;
|
|
15
17
|
let variablePicker;
|
|
16
18
|
let resourcePicker;
|
|
17
19
|
let scriptPicker;
|
|
@@ -20,6 +22,15 @@ let resourceEditor;
|
|
|
20
22
|
let codeViewer;
|
|
21
23
|
let codeLang = 'deno';
|
|
22
24
|
let codeContent = '';
|
|
25
|
+
function addEditorActions() {
|
|
26
|
+
editor.addAction('insert-variable', 'Windmill: Insert variable', () => {
|
|
27
|
+
variablePicker.openModal();
|
|
28
|
+
});
|
|
29
|
+
editor.addAction('insert-resource', 'Windmill: Insert resource', () => {
|
|
30
|
+
resourcePicker.openModal();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
$: editor && addEditorActions();
|
|
23
34
|
async function loadVariables() {
|
|
24
35
|
let r = [];
|
|
25
36
|
const variables = (await VariableService.listVariable({ workspace: $workspaceStore ?? 'NO_W' })).map((x) => {
|
|
@@ -72,7 +83,7 @@ async function loadScripts() {
|
|
|
72
83
|
if (!path) {
|
|
73
84
|
if (lang == 'deno') {
|
|
74
85
|
editor.insertAtCursor(`Deno.env.get('${name}')`)
|
|
75
|
-
} else {
|
|
86
|
+
} else if (lang == 'python3') {
|
|
76
87
|
if (!editor.getCode().includes('import os')) {
|
|
77
88
|
editor.insertAtBeginning('import os\n')
|
|
78
89
|
}
|
|
@@ -87,7 +98,7 @@ async function loadScripts() {
|
|
|
87
98
|
)
|
|
88
99
|
}
|
|
89
100
|
editor.insertAtCursor(`(await wmill.getVariable('${path}'))`)
|
|
90
|
-
} else {
|
|
101
|
+
} else if (lang == 'python3') {
|
|
91
102
|
if (!editor.getCode().includes('import wmill')) {
|
|
92
103
|
editor.insertAtBeginning('import wmill\n')
|
|
93
104
|
}
|
|
@@ -126,7 +137,7 @@ async function loadScripts() {
|
|
|
126
137
|
)
|
|
127
138
|
}
|
|
128
139
|
editor.insertAtCursor(`(await wmill.getResource('${path}'))`)
|
|
129
|
-
} else {
|
|
140
|
+
} else if (lang == 'python3') {
|
|
130
141
|
if (!editor.getCode().includes('import wmill')) {
|
|
131
142
|
editor.insertAtBeginning('import wmill\n')
|
|
132
143
|
}
|
|
@@ -160,75 +171,77 @@ async function loadScripts() {
|
|
|
160
171
|
|
|
161
172
|
<div class="flex divide-x items-center">
|
|
162
173
|
<div>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
on:click={
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
<Button
|
|
175
|
+
color="light"
|
|
176
|
+
btnClasses="mr-1"
|
|
177
|
+
on:click={variablePicker.openModal}
|
|
178
|
+
size="xs"
|
|
179
|
+
spacingSize="md"
|
|
180
|
+
startIcon={{ icon: faFile }}
|
|
181
|
+
{iconOnly}
|
|
169
182
|
>
|
|
170
|
-
<Icon data={faFile} class="h-4 w-4 mr-2" />
|
|
171
183
|
Insert variable
|
|
172
|
-
</
|
|
184
|
+
</Button>
|
|
173
185
|
</div>
|
|
174
186
|
<div>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
187
|
+
<Button
|
|
188
|
+
btnClasses="mx-1"
|
|
189
|
+
size="xs"
|
|
190
|
+
spacingSize="md"
|
|
191
|
+
color="light"
|
|
192
|
+
on:click={resourcePicker.openModal}
|
|
193
|
+
{iconOnly}
|
|
194
|
+
startIcon={{ icon: faCube }}
|
|
181
195
|
>
|
|
182
|
-
<Icon data={faCube} class="h-4 w-4 mr-2" />
|
|
183
196
|
Insert resource
|
|
184
|
-
</
|
|
197
|
+
</Button>
|
|
185
198
|
</div>
|
|
186
199
|
|
|
187
200
|
<div>
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
201
|
+
<Button
|
|
202
|
+
btnClasses="mx-1"
|
|
203
|
+
size="xs"
|
|
204
|
+
spacingSize="md"
|
|
205
|
+
color="light"
|
|
206
|
+
on:click={scriptPicker.openModal}
|
|
207
|
+
{iconOnly}
|
|
208
|
+
startIcon={{ icon: faCode }}
|
|
194
209
|
>
|
|
195
|
-
<Icon data={faCode} class="h-4 w-4 mr-2" />
|
|
196
210
|
Search script
|
|
197
|
-
</
|
|
211
|
+
</Button>
|
|
198
212
|
</div>
|
|
199
213
|
|
|
200
214
|
<div>
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
215
|
+
<Button
|
|
216
|
+
btnClasses="mx-1"
|
|
217
|
+
size="xs"
|
|
218
|
+
spacingSize="md"
|
|
219
|
+
color="light"
|
|
220
|
+
on:click={editor.clearContent}
|
|
221
|
+
{iconOnly}
|
|
222
|
+
startIcon={{ icon: faRotateLeft }}
|
|
207
223
|
>
|
|
208
|
-
<Icon data={faRotateLeft} class="h-4 w-4 mr-2" />
|
|
209
224
|
Reset content
|
|
210
|
-
</
|
|
225
|
+
</Button>
|
|
211
226
|
</div>
|
|
212
227
|
<div>
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
228
|
+
<Button
|
|
229
|
+
btnClasses="ml-1"
|
|
230
|
+
size="xs"
|
|
231
|
+
spacingSize="md"
|
|
232
|
+
color="light"
|
|
233
|
+
on:click={editor.reloadWebsocket}
|
|
234
|
+
startIcon={{ icon: faRotate }}
|
|
219
235
|
>
|
|
220
|
-
<Icon data={faRotate} class="h-4 w-4 mr-2" />
|
|
221
|
-
|
|
222
236
|
Reload assistants
|
|
223
237
|
<span class="ml-1">
|
|
224
238
|
{#if lang == 'deno'}
|
|
225
239
|
(<span class={websocketAlive.deno ? 'text-green-600' : 'text-red-700'}>Deno</span>)
|
|
226
240
|
{:else if lang == 'python3'}
|
|
227
241
|
(<span class={websocketAlive.pyright ? 'text-green-600' : 'text-red-700'}>Pyright</span>
|
|
228
|
-
|
|
229
242
|
<span class={websocketAlive.black ? 'text-green-600' : 'text-red-700'}>Black</span>)
|
|
230
243
|
{/if}
|
|
231
244
|
</span>
|
|
232
|
-
</
|
|
245
|
+
</Button>
|
|
233
246
|
</div>
|
|
234
247
|
</div>
|
|
@@ -2,13 +2,14 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type Editor from './Editor.svelte';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
lang: 'python3' | 'deno';
|
|
5
|
+
lang: 'python3' | 'deno' | 'go';
|
|
6
6
|
editor: Editor;
|
|
7
7
|
websocketAlive: {
|
|
8
8
|
pyright: boolean;
|
|
9
9
|
black: boolean;
|
|
10
10
|
deno: boolean;
|
|
11
11
|
};
|
|
12
|
+
iconOnly?: boolean | undefined;
|
|
12
13
|
};
|
|
13
14
|
events: {
|
|
14
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -2,43 +2,43 @@
|
|
|
2
2
|
import { page } from '$app/stores';
|
|
3
3
|
import { FlowService, ScheduleService } from '../gen';
|
|
4
4
|
import { workspaceStore } from '../stores';
|
|
5
|
-
import { encodeState, formatCron, loadHubScripts,
|
|
6
|
-
import {
|
|
7
|
-
import { Breadcrumb, BreadcrumbItem
|
|
8
|
-
import {
|
|
5
|
+
import { encodeState, formatCron, loadHubScripts, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
|
+
import { faGlobe } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { Breadcrumb, BreadcrumbItem } from 'flowbite-svelte';
|
|
8
|
+
import { onMount, setContext } from 'svelte';
|
|
9
9
|
import Icon from 'svelte-awesome';
|
|
10
|
+
import { writable } from 'svelte/store';
|
|
11
|
+
import CenteredPage from './CenteredPage.svelte';
|
|
12
|
+
import Button from './common/button/Button.svelte';
|
|
10
13
|
import { OFFSET } from './CronInput.svelte';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import FlowPreviewContent from './FlowPreviewContent.svelte';
|
|
14
|
-
import { flowStateStore, flowStateToFlow } from './flows/flowState';
|
|
14
|
+
import FlowEditor from './flows/FlowEditor.svelte';
|
|
15
|
+
import { flowStateStore } from './flows/flowState';
|
|
15
16
|
import { flowStore } from './flows/flowStore';
|
|
17
|
+
import FlowImportExportMenu from './flows/header/FlowImportExportMenu.svelte';
|
|
18
|
+
import { loadFlowSchedule } from './flows/scheduleUtils';
|
|
16
19
|
import { cleanInputs } from './flows/utils';
|
|
17
20
|
import ScriptSchema from './ScriptSchema.svelte';
|
|
18
21
|
export let initialPath = '';
|
|
19
22
|
let pathError = '';
|
|
20
|
-
let previewOpen = false;
|
|
21
|
-
let scheduleArgs = {};
|
|
22
|
-
let previewArgs = {};
|
|
23
|
-
let scheduleEnabled = false;
|
|
24
|
-
let scheduleCron = '';
|
|
25
23
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
26
24
|
async function createSchedule(path) {
|
|
25
|
+
const { cron, args, enabled } = $scheduleStore;
|
|
27
26
|
await ScheduleService.createSchedule({
|
|
28
27
|
workspace: $workspaceStore,
|
|
29
28
|
requestBody: {
|
|
30
29
|
path: path,
|
|
31
|
-
schedule: formatCron(
|
|
30
|
+
schedule: formatCron(cron),
|
|
32
31
|
offset: OFFSET,
|
|
33
32
|
script_path: path,
|
|
34
33
|
is_flow: true,
|
|
35
|
-
args
|
|
36
|
-
enabled
|
|
34
|
+
args,
|
|
35
|
+
enabled
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
async function saveFlow() {
|
|
41
|
-
const flow = cleanInputs(
|
|
40
|
+
const flow = cleanInputs($flowStore);
|
|
41
|
+
const { cron, args, enabled } = $scheduleStore;
|
|
42
42
|
if (initialPath === '') {
|
|
43
43
|
await FlowService.createFlow({
|
|
44
44
|
workspace: $workspaceStore,
|
|
@@ -50,7 +50,7 @@ async function saveFlow() {
|
|
|
50
50
|
schema: flow.schema
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
if (
|
|
53
|
+
if (enabled) {
|
|
54
54
|
await createSchedule(flow.path);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -76,24 +76,24 @@ async function saveFlow() {
|
|
|
76
76
|
path: initialPath
|
|
77
77
|
});
|
|
78
78
|
if (schedule.path != flow.path ||
|
|
79
|
-
JSON.stringify(schedule.args) != JSON.stringify(
|
|
80
|
-
schedule.schedule !=
|
|
79
|
+
JSON.stringify(schedule.args) != JSON.stringify(args) ||
|
|
80
|
+
schedule.schedule != cron) {
|
|
81
81
|
await ScheduleService.updateSchedule({
|
|
82
82
|
workspace: $workspaceStore ?? '',
|
|
83
83
|
path: initialPath,
|
|
84
84
|
requestBody: {
|
|
85
|
-
schedule: formatCron(
|
|
85
|
+
schedule: formatCron(cron),
|
|
86
86
|
script_path: flow.path,
|
|
87
87
|
is_flow: true,
|
|
88
|
-
args
|
|
88
|
+
args
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
if (
|
|
92
|
+
if (enabled != schedule.enabled) {
|
|
93
93
|
await ScheduleService.setScheduleEnabled({
|
|
94
94
|
workspace: $workspaceStore ?? '',
|
|
95
95
|
path: flow.path,
|
|
96
|
-
requestBody: { enabled
|
|
96
|
+
requestBody: { enabled }
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -107,122 +107,114 @@ async function saveFlow() {
|
|
|
107
107
|
async function changeStep(step) {
|
|
108
108
|
goto(`?step=${step}`);
|
|
109
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
|
-
});
|
|
120
110
|
flowStore.subscribe((flow) => {
|
|
121
111
|
if (flow) {
|
|
122
112
|
setQueryWithoutLoad($page.url, 'state', encodeState(flow));
|
|
123
113
|
}
|
|
124
114
|
});
|
|
115
|
+
const selectedIdStore = writable('settings');
|
|
116
|
+
const scheduleStore = writable({ args: {}, cron: '', enabled: false });
|
|
117
|
+
const previewArgsStore = writable({});
|
|
118
|
+
function select(selectedId) {
|
|
119
|
+
selectedIdStore.set(selectedId);
|
|
120
|
+
}
|
|
121
|
+
setContext('FlowEditorContext', {
|
|
122
|
+
selectedId: selectedIdStore,
|
|
123
|
+
schedule: scheduleStore,
|
|
124
|
+
select,
|
|
125
|
+
path: initialPath,
|
|
126
|
+
previewArgs: previewArgsStore
|
|
127
|
+
});
|
|
128
|
+
$: {
|
|
129
|
+
loadFlowSchedule(initialPath, $workspaceStore)
|
|
130
|
+
.then((schedule) => {
|
|
131
|
+
scheduleStore.set(schedule);
|
|
132
|
+
})
|
|
133
|
+
.catch(() => {
|
|
134
|
+
scheduleStore.set({
|
|
135
|
+
cron: '0 */5 * * *',
|
|
136
|
+
args: {},
|
|
137
|
+
enabled: false
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
125
141
|
onMount(() => {
|
|
126
142
|
loadHubScripts();
|
|
127
143
|
});
|
|
128
|
-
onDestroy(() => {
|
|
129
|
-
//@ts-ignore
|
|
130
|
-
$flowStore = undefined;
|
|
131
|
-
//@ts-ignore
|
|
132
|
-
$flowStateStore = undefined;
|
|
133
|
-
});
|
|
134
144
|
</script>
|
|
135
145
|
|
|
136
|
-
<div class="flex flex-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
<
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
>
|
|
159
|
-
Next
|
|
160
|
-
</button>
|
|
161
|
-
<button
|
|
162
|
-
disabled={pathError != ''}
|
|
163
|
-
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
164
|
-
on:click={saveFlow}
|
|
165
|
-
>
|
|
166
|
-
Save
|
|
167
|
-
</button>
|
|
168
|
-
{:else}
|
|
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
|
-
>
|
|
176
|
-
{/if}
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
<div class="flex flex-row-reverse">
|
|
180
|
-
<span class="my-1 text-sm text-gray-500 italic">
|
|
181
|
-
{#if initialPath && initialPath != $flowStore?.path} {initialPath} → {/if}
|
|
182
|
-
{$flowStore?.path}
|
|
183
|
-
</span>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<!-- metadata -->
|
|
146
|
+
<div class="flex flex-col flex-1 h-full">
|
|
147
|
+
<!-- Nav between steps-->
|
|
148
|
+
<div class="justify-between flex flex-row w-full my-2 px-4">
|
|
149
|
+
<Breadcrumb>
|
|
150
|
+
<BreadcrumbItem>
|
|
151
|
+
<button on:click={() => changeStep(1)} class={step === 1 ? 'font-bold' : null}>
|
|
152
|
+
Flow Editor
|
|
153
|
+
</button>
|
|
154
|
+
</BreadcrumbItem>
|
|
155
|
+
<BreadcrumbItem>
|
|
156
|
+
<button on:click={() => changeStep(2)} class={step === 2 ? 'font-bold' : null}>
|
|
157
|
+
UI customisation
|
|
158
|
+
</button>
|
|
159
|
+
</BreadcrumbItem>
|
|
160
|
+
</Breadcrumb>
|
|
161
|
+
<div class="flex flex-row-reverse ml-2 space-x-reverse space-x-2">
|
|
162
|
+
{#if step == 1}
|
|
163
|
+
<Button disabled={pathError != ''} color="blue" size="sm" on:click={() => changeStep(2)}>
|
|
164
|
+
Next
|
|
165
|
+
</Button>
|
|
166
|
+
<Button disabled={pathError != ''} color="blue" size="sm" on:click={saveFlow}>Save</Button>
|
|
167
|
+
<FlowImportExportMenu />
|
|
187
168
|
|
|
188
|
-
{#if $flowStateStore}
|
|
189
|
-
{#if step === 1}
|
|
190
|
-
<FlowEditor
|
|
191
|
-
bind:pathError
|
|
192
|
-
bind:initialPath
|
|
193
|
-
bind:scheduleEnabled
|
|
194
|
-
bind:scheduleCron
|
|
195
|
-
bind:scheduleArgs
|
|
196
|
-
bind:previewArgs
|
|
197
|
-
/>
|
|
198
169
|
<Button
|
|
199
|
-
|
|
200
|
-
size="
|
|
201
|
-
|
|
202
|
-
on:click={() =>
|
|
203
|
-
|
|
170
|
+
color="light"
|
|
171
|
+
size="sm"
|
|
172
|
+
variant="border"
|
|
173
|
+
on:click={() => {
|
|
174
|
+
const url = new URL('https://hub.windmill.dev/flows/add')
|
|
175
|
+
const openFlow = {
|
|
176
|
+
value: $flowStore.value,
|
|
177
|
+
summary: $flowStore.summary,
|
|
178
|
+
description: $flowStore.description,
|
|
179
|
+
schema: $flowStore.schema
|
|
180
|
+
}
|
|
181
|
+
url.searchParams.append('flow', btoa(JSON.stringify(openFlow)))
|
|
182
|
+
window.open(url, '_blank')?.focus()
|
|
183
|
+
}}
|
|
204
184
|
>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<Icon data={faPlay} class="ml-2" />
|
|
185
|
+
<Icon data={faGlobe} scale={0.8} class="inline mr-2" />
|
|
186
|
+
Publish to Hub
|
|
209
187
|
</Button>
|
|
210
|
-
{:else
|
|
188
|
+
{:else}
|
|
189
|
+
<button class="default-button px-6 self-end" on:click={saveFlow}>Save</button>
|
|
190
|
+
<button
|
|
191
|
+
class="default-button-secondary px-6 max-h-8"
|
|
192
|
+
on:click={async () => {
|
|
193
|
+
changeStep(1)
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
Back
|
|
197
|
+
</button>
|
|
198
|
+
{/if}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<!-- metadata -->
|
|
203
|
+
|
|
204
|
+
{#if $flowStateStore}
|
|
205
|
+
{#if step === 1}
|
|
206
|
+
<FlowEditor />
|
|
207
|
+
{:else if step === 2}
|
|
208
|
+
<CenteredPage>
|
|
211
209
|
<ScriptSchema
|
|
212
210
|
synchronizedHeader={false}
|
|
213
211
|
bind:summary={$flowStore.summary}
|
|
214
212
|
bind:description={$flowStore.description}
|
|
215
213
|
bind:schema={$flowStore.schema}
|
|
216
214
|
/>
|
|
217
|
-
|
|
218
|
-
{:else}
|
|
219
|
-
<p>Loading</p>
|
|
215
|
+
</CenteredPage>
|
|
220
216
|
{/if}
|
|
221
|
-
|
|
217
|
+
{:else}
|
|
218
|
+
<CenteredPage>Loading...</CenteredPage>
|
|
219
|
+
{/if}
|
|
222
220
|
</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}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Tabs from './common/tabs/Tabs.svelte';
|
|
3
3
|
import Tab from './common/tabs/Tab.svelte';
|
|
4
4
|
import TabContent from './common/tabs/TabContent.svelte';
|
|
5
|
+
import LogViewer from './LogViewer.svelte';
|
|
5
6
|
export let job;
|
|
6
7
|
</script>
|
|
7
8
|
|
|
@@ -10,13 +11,11 @@ export let job;
|
|
|
10
11
|
<Tab value="results">Results</Tab>
|
|
11
12
|
<Tab value="logs">Logs</Tab>
|
|
12
13
|
<svelte:fragment slot="content">
|
|
13
|
-
<TabContent value="results" class="border p-2 h-36 overflow-
|
|
14
|
+
<TabContent value="results" class="border p-2 h-36 overflow-auto">
|
|
14
15
|
<DisplayResult result={job.result} />
|
|
15
16
|
</TabContent>
|
|
16
|
-
<TabContent value="logs" class="border
|
|
17
|
-
<
|
|
18
|
-
<pre class="w-full">{job.logs}</pre>
|
|
19
|
-
</div>
|
|
17
|
+
<TabContent value="logs" class="border h-36 overflow-auto">
|
|
18
|
+
<LogViewer content={job.logs ?? ''} isLoading={false} />
|
|
20
19
|
</TabContent>
|
|
21
20
|
</svelte:fragment>
|
|
22
21
|
</Tabs>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
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
2
|
import { slide } from 'svelte/transition';
|
|
6
3
|
import InputTransformsViewer from './InputTransformsViewer.svelte';
|
|
7
4
|
import IconedPath from './IconedPath.svelte';
|
|
5
|
+
import HighlightCode from './HighlightCode.svelte';
|
|
6
|
+
import { faBug } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import Icon from 'svelte-awesome';
|
|
8
8
|
export let modules;
|
|
9
|
+
export let failureModule;
|
|
9
10
|
let open = {};
|
|
10
11
|
</script>
|
|
11
12
|
|
|
@@ -17,14 +18,15 @@ let open = {};
|
|
|
17
18
|
{#each modules ?? [] as mod, i}
|
|
18
19
|
<li class="w-full">
|
|
19
20
|
<div class="relative pb-8 w-full">
|
|
20
|
-
{#if i < (modules ?? []).length - 1}
|
|
21
|
+
{#if i < (modules ?? []).length - 1 || failureModule}
|
|
21
22
|
<span class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200" aria-hidden="true" />
|
|
22
23
|
{/if}
|
|
23
24
|
<div class="relative flex space-x-3">
|
|
24
25
|
<div>
|
|
25
26
|
<span
|
|
26
27
|
class="h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center ring-8 ring-white text-white"
|
|
27
|
-
|
|
28
|
+
>
|
|
29
|
+
{i + 1}
|
|
28
30
|
</span>
|
|
29
31
|
</div>
|
|
30
32
|
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
|
|
@@ -75,8 +77,8 @@ let open = {};
|
|
|
75
77
|
{#if open[i]}
|
|
76
78
|
<div transition:slide class="border border-black p-2 bg-gray-50 w-full">
|
|
77
79
|
<InputTransformsViewer inputTransforms={mod?.input_transforms} />
|
|
78
|
-
<
|
|
79
|
-
language={mod?.value?.language
|
|
80
|
+
<HighlightCode
|
|
81
|
+
language={mod?.value?.language ?? 'deno'}
|
|
80
82
|
code={mod?.value?.content}
|
|
81
83
|
/>
|
|
82
84
|
</div>
|
|
@@ -94,4 +96,84 @@ let open = {};
|
|
|
94
96
|
</div>
|
|
95
97
|
</li>
|
|
96
98
|
{/each}
|
|
99
|
+
{#if failureModule}
|
|
100
|
+
<li class="w-full">
|
|
101
|
+
<div class="relative pb-8 w-full">
|
|
102
|
+
<div class="relative flex space-x-3">
|
|
103
|
+
<div>
|
|
104
|
+
<span
|
|
105
|
+
class="h-8 w-8 rounded-full bg-red-600 flex items-center justify-center ring-8 ring-white text-white"
|
|
106
|
+
>
|
|
107
|
+
<Icon data={faBug} />
|
|
108
|
+
</span>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
|
|
111
|
+
<div class="w-full">
|
|
112
|
+
<span class="text-black">{failureModule?.summary ?? ''}</span>
|
|
113
|
+
<p class="text-sm text-gray-500">
|
|
114
|
+
{#if failureModule?.value?.type == 'script'}
|
|
115
|
+
<a
|
|
116
|
+
target="_blank"
|
|
117
|
+
href={scriptPathToHref(failureModule?.value?.path ?? '')}
|
|
118
|
+
class="font-medium text-gray-900"
|
|
119
|
+
>
|
|
120
|
+
<IconedPath path={failureModule?.value?.path ?? ''} />
|
|
121
|
+
</a>
|
|
122
|
+
{#if failureModule?.value?.path?.startsWith('hub/')}
|
|
123
|
+
<div>
|
|
124
|
+
<button
|
|
125
|
+
on:click={async () => {
|
|
126
|
+
open[modules.length] = !open[modules.length]
|
|
127
|
+
}}
|
|
128
|
+
class="mb-2 underline text-black"
|
|
129
|
+
>
|
|
130
|
+
View code and inputs {open[modules.length] ? '(-)' : '(+)'}</button
|
|
131
|
+
>
|
|
132
|
+
{#if open[modules.length]}
|
|
133
|
+
<div class="border border-black p-2 bg-gray-50 divide-y">
|
|
134
|
+
<InputTransformsViewer
|
|
135
|
+
inputTransforms={failureModule?.input_transforms}
|
|
136
|
+
/>
|
|
137
|
+
<div class="w-full h-full mt-6">
|
|
138
|
+
<iframe
|
|
139
|
+
style="height: 400px;"
|
|
140
|
+
class="w-full h-full text-sm"
|
|
141
|
+
title="embedded script from hub"
|
|
142
|
+
frameborder="0"
|
|
143
|
+
src="https://hub.windmill.dev/embed/script/{failureModule?.value?.path?.substring(
|
|
144
|
+
4
|
|
145
|
+
)}"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
{/if}
|
|
150
|
+
</div>
|
|
151
|
+
{/if}
|
|
152
|
+
{:else if failureModule?.value?.type == 'rawscript'}
|
|
153
|
+
<button
|
|
154
|
+
on:click={() => (open[modules.length] = !open[modules.length])}
|
|
155
|
+
class="mb-2 underline text-black"
|
|
156
|
+
>
|
|
157
|
+
Error handler: Raw {failureModule?.value?.language} script {open[modules.length]
|
|
158
|
+
? '(-)'
|
|
159
|
+
: '(+)'}</button
|
|
160
|
+
>
|
|
161
|
+
|
|
162
|
+
{#if open[modules.length]}
|
|
163
|
+
<div transition:slide class="border border-black p-2 bg-gray-50 w-full">
|
|
164
|
+
<InputTransformsViewer inputTransforms={failureModule?.input_transforms} />
|
|
165
|
+
<HighlightCode
|
|
166
|
+
language={failureModule?.value?.language ?? 'deno'}
|
|
167
|
+
code={failureModule?.value?.content}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
{/if}
|
|
171
|
+
{/if}
|
|
172
|
+
</p>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</li>
|
|
178
|
+
{/if}
|
|
97
179
|
</ul>
|