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
package/script_helpers.js
CHANGED
|
@@ -46,16 +46,27 @@ export async function main(
|
|
|
46
46
|
return { foo: a };
|
|
47
47
|
}
|
|
48
48
|
`;
|
|
49
|
+
export const GO_INIT_CODE = `import (
|
|
50
|
+
"fmt"
|
|
51
|
+
"rsc.io/quote"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
func main(x string) (interface{}, error) {
|
|
55
|
+
fmt.Println("Hello, World")
|
|
56
|
+
fmt.Println(quote.Opt())
|
|
57
|
+
return x, nil
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
49
60
|
export const DENO_INIT_CODE_CLEAR = `// import * as wmill from "https://deno.land/x/windmill@v${__pkg__.version}/mod.ts"
|
|
50
61
|
|
|
51
|
-
export async function main() {
|
|
52
|
-
return
|
|
62
|
+
export async function main(x: string) {
|
|
63
|
+
return x
|
|
53
64
|
}
|
|
54
65
|
`;
|
|
55
66
|
export const PYTHON_INIT_CODE_CLEAR = `#import wmill
|
|
56
67
|
|
|
57
|
-
def main():
|
|
58
|
-
return
|
|
68
|
+
def main(x: str):
|
|
69
|
+
return x
|
|
59
70
|
`;
|
|
60
71
|
export const POSTGRES_INIT_CODE = `import {
|
|
61
72
|
pgSql,
|
|
@@ -93,27 +104,44 @@ export async function main() {
|
|
|
93
104
|
// 'flow_input._value'
|
|
94
105
|
}
|
|
95
106
|
`;
|
|
96
|
-
|
|
107
|
+
const ALL_INITIAL_CODE = [PYTHON_INIT_CODE, DENO_INIT_CODE, POSTGRES_INIT_CODE, DENO_INIT_CODE_TRIGGER, DENO_INIT_CODE_CLEAR, PYTHON_INIT_CODE_CLEAR];
|
|
108
|
+
export function isInitialCode(content) {
|
|
109
|
+
for (const code of ALL_INITIAL_CODE) {
|
|
110
|
+
if (content === code) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
export function initialCode(language, kind, subkind) {
|
|
97
117
|
if (language === 'deno') {
|
|
98
|
-
if (
|
|
118
|
+
if (kind === 'trigger') {
|
|
99
119
|
return DENO_INIT_CODE_TRIGGER;
|
|
100
120
|
}
|
|
101
|
-
else if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
else if (kind === 'script') {
|
|
122
|
+
if (subkind === 'flow') {
|
|
123
|
+
return DENO_INIT_CODE_CLEAR;
|
|
124
|
+
}
|
|
125
|
+
else if (subkind === 'pgsql') {
|
|
126
|
+
return POSTGRES_INIT_CODE;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
return DENO_INIT_CODE;
|
|
130
|
+
}
|
|
106
131
|
}
|
|
107
132
|
else {
|
|
108
133
|
return DENO_INIT_CODE;
|
|
109
134
|
}
|
|
110
135
|
}
|
|
111
|
-
else {
|
|
112
|
-
if (
|
|
136
|
+
else if (language === 'python3') {
|
|
137
|
+
if (subkind === 'flow') {
|
|
113
138
|
return PYTHON_INIT_CODE_CLEAR;
|
|
114
139
|
}
|
|
115
140
|
else {
|
|
116
141
|
return PYTHON_INIT_CODE;
|
|
117
142
|
}
|
|
118
143
|
}
|
|
144
|
+
else {
|
|
145
|
+
return GO_INIT_CODE;
|
|
146
|
+
}
|
|
119
147
|
}
|
package/stores.d.ts
CHANGED
package/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Flow, type FlowModule, type User } from './gen';
|
|
1
|
+
import { Script, type Flow, type FlowModule, type User } from './gen';
|
|
2
2
|
import type { Schema } from './common';
|
|
3
3
|
import { type UserExt } from './stores';
|
|
4
4
|
export declare function validateUsername(username: string): string;
|
|
@@ -73,7 +73,7 @@ export declare function setInputCat(type: string | undefined, format: string | u
|
|
|
73
73
|
export declare function scriptPathToHref(path: string): string;
|
|
74
74
|
export declare function getScriptByPath(path: string): Promise<{
|
|
75
75
|
content: string;
|
|
76
|
-
language: 'deno' | 'python3';
|
|
76
|
+
language: 'deno' | 'python3' | 'go';
|
|
77
77
|
}>;
|
|
78
78
|
export declare function loadHubScripts(): Promise<void>;
|
|
79
79
|
export declare function loadHubFlows(): Promise<{
|
|
@@ -86,5 +86,7 @@ export declare function loadHubFlows(): Promise<{
|
|
|
86
86
|
}[]>;
|
|
87
87
|
export declare function formatCron(inp: string): string;
|
|
88
88
|
export declare function flowToHubUrl(flow: Flow): URL;
|
|
89
|
-
export declare function scriptToHubUrl(content: string, summary: string, description: string,
|
|
90
|
-
export declare function classNames(...classes: string
|
|
89
|
+
export declare function scriptToHubUrl(content: string, summary: string, description: string, kind: Script.kind): URL;
|
|
90
|
+
export declare function classNames(...classes: Array<string | undefined>): string;
|
|
91
|
+
export declare function scriptLangToEditorLang(lang: Script.language): 'typescript' | 'python' | 'go';
|
|
92
|
+
export declare function copyToClipboard(value: string, sendToast?: boolean): Promise<boolean>;
|
package/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
|
-
import { FlowService, ScriptService } from './gen';
|
|
3
|
+
import { FlowService, Script, ScriptService } from './gen';
|
|
4
4
|
import { toast } from '@zerodevx/svelte-toast';
|
|
5
5
|
import { get } from 'svelte/store';
|
|
6
6
|
import { hubScripts, workspaceStore } from './stores';
|
|
@@ -428,7 +428,7 @@ export async function loadHubScripts() {
|
|
|
428
428
|
path: `hub/${x.id}/${x.app}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
|
|
429
429
|
summary: `${x.summary} (${x.app}) ${x.views} uses`,
|
|
430
430
|
approved: x.approved,
|
|
431
|
-
|
|
431
|
+
kind: x.kind,
|
|
432
432
|
app: x.app,
|
|
433
433
|
views: x.views,
|
|
434
434
|
votes: x.votes,
|
|
@@ -464,14 +464,37 @@ export function flowToHubUrl(flow) {
|
|
|
464
464
|
url.searchParams.append('flow', encodeState(openFlow));
|
|
465
465
|
return url;
|
|
466
466
|
}
|
|
467
|
-
export function scriptToHubUrl(content, summary, description,
|
|
467
|
+
export function scriptToHubUrl(content, summary, description, kind) {
|
|
468
468
|
const url = new URL('https://hub.windmill.dev/scripts/add');
|
|
469
469
|
url.searchParams.append('content', content);
|
|
470
470
|
url.searchParams.append('summary', summary);
|
|
471
471
|
url.searchParams.append('description', description);
|
|
472
|
-
url.searchParams.append('
|
|
472
|
+
url.searchParams.append('kind', kind);
|
|
473
473
|
return url;
|
|
474
474
|
}
|
|
475
475
|
export function classNames(...classes) {
|
|
476
476
|
return classes.filter(Boolean).join(' ');
|
|
477
477
|
}
|
|
478
|
+
export function scriptLangToEditorLang(lang) {
|
|
479
|
+
if (lang == 'deno') {
|
|
480
|
+
return 'typescript';
|
|
481
|
+
}
|
|
482
|
+
else if (lang == 'python3') {
|
|
483
|
+
return 'python';
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
return lang;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
export async function copyToClipboard(value, sendToast = true) {
|
|
490
|
+
let success = false;
|
|
491
|
+
if (navigator?.clipboard) {
|
|
492
|
+
success = await navigator.clipboard
|
|
493
|
+
.writeText(value)
|
|
494
|
+
.then(() => true)
|
|
495
|
+
.catch(() => false);
|
|
496
|
+
}
|
|
497
|
+
sendToast &&
|
|
498
|
+
sendUserToast(success ? 'Copied to clipboard!' : "Couldn't copy to clipboard", !success);
|
|
499
|
+
return success;
|
|
500
|
+
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<script>import { ScheduleService } from '../gen';
|
|
2
|
-
import { workspaceStore } from '../stores';
|
|
3
|
-
import FlowSettings from './flows/FlowSettings.svelte';
|
|
4
|
-
import { flowStateStore } from './flows/flowState';
|
|
5
|
-
import { flowStore } from './flows/flowStore';
|
|
6
|
-
import FlowTimeline from './flows/FlowTimeline.svelte';
|
|
7
|
-
export let pathError = '';
|
|
8
|
-
export let initialPath = '';
|
|
9
|
-
export let scheduleArgs = {};
|
|
10
|
-
export let scheduleEnabled = false;
|
|
11
|
-
export let scheduleCron = '0 */5 * * *';
|
|
12
|
-
export let previewArgs = {};
|
|
13
|
-
let scheduleLoaded = false;
|
|
14
|
-
async function loadSchedule() {
|
|
15
|
-
if (!scheduleLoaded) {
|
|
16
|
-
scheduleLoaded = true;
|
|
17
|
-
const existsSchedule = await ScheduleService.existsSchedule({
|
|
18
|
-
workspace: $workspaceStore ?? '',
|
|
19
|
-
path: initialPath
|
|
20
|
-
});
|
|
21
|
-
if (existsSchedule) {
|
|
22
|
-
const schedule = await ScheduleService.getSchedule({
|
|
23
|
-
workspace: $workspaceStore ?? '',
|
|
24
|
-
path: initialPath
|
|
25
|
-
});
|
|
26
|
-
scheduleEnabled = schedule.enabled;
|
|
27
|
-
scheduleCron = schedule.schedule;
|
|
28
|
-
scheduleArgs = schedule.args ?? {};
|
|
29
|
-
previewArgs = JSON.parse(JSON.stringify(scheduleArgs));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
$: if ($flowStore && $workspaceStore && initialPath != '') {
|
|
34
|
-
loadSchedule();
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
{#if $flowStateStore}
|
|
39
|
-
<div class="flex space-y-8 flex-col items-center">
|
|
40
|
-
<FlowTimeline bind:args={previewArgs} bind:flowModuleSchemas={$flowStateStore}>
|
|
41
|
-
<div slot="settings">
|
|
42
|
-
<FlowSettings
|
|
43
|
-
bind:pathError
|
|
44
|
-
bind:initialPath
|
|
45
|
-
bind:scheduleArgs
|
|
46
|
-
{previewArgs}
|
|
47
|
-
bind:scheduleCron
|
|
48
|
-
bind:scheduleEnabled
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</FlowTimeline>
|
|
52
|
-
</div>
|
|
53
|
-
{:else}
|
|
54
|
-
<h3>Loading flow</h3>
|
|
55
|
-
{/if}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
<script>import { sendUserToast, truncateRev } from '../utils';
|
|
2
|
-
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import Icon from 'svelte-awesome';
|
|
4
|
-
import { flowStateStore, flowStateToFlow } from './flows/flowState';
|
|
5
|
-
import { mapJobResultsToFlowState } from './flows/flowStateUtils';
|
|
6
|
-
import { runFlowPreview } from './flows/utils';
|
|
7
|
-
import FlowStatusViewer from './FlowStatusViewer.svelte';
|
|
8
|
-
import RunForm from './RunForm.svelte';
|
|
9
|
-
import Tab from './common/tabs/Tab.svelte';
|
|
10
|
-
import TabContent from './common/tabs/TabContent.svelte';
|
|
11
|
-
import Tabs from './common/tabs/Tabs.svelte';
|
|
12
|
-
export let i;
|
|
13
|
-
export let flow;
|
|
14
|
-
export let schema;
|
|
15
|
-
export let args = {};
|
|
16
|
-
let stepArgs = {};
|
|
17
|
-
let tab = 'upto';
|
|
18
|
-
let viewPreview = false;
|
|
19
|
-
let uptoText = i >= flow.value.modules.length - 1 ? 'Preview whole flow' : 'Preview up to this step';
|
|
20
|
-
let jobId;
|
|
21
|
-
export async function runPreview(args) {
|
|
22
|
-
viewPreview = true;
|
|
23
|
-
flow = flowStateToFlow($flowStateStore, flow);
|
|
24
|
-
let newFlow = tab == 'upto' ? truncateFlow(flow) : setInputTransformFromArgs(extractStep(flow), args);
|
|
25
|
-
jobId = await runFlowPreview(args, newFlow);
|
|
26
|
-
sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
|
|
27
|
-
}
|
|
28
|
-
function truncateFlow(flow) {
|
|
29
|
-
const localFlow = JSON.parse(JSON.stringify(flow));
|
|
30
|
-
localFlow.value.modules = flow.value.modules.slice(0, i + 1);
|
|
31
|
-
return localFlow;
|
|
32
|
-
}
|
|
33
|
-
function extractStep(flow) {
|
|
34
|
-
const localFlow = JSON.parse(JSON.stringify(flow));
|
|
35
|
-
localFlow.value.modules = flow.value.modules.slice(i, i + 1);
|
|
36
|
-
localFlow.schema = schema;
|
|
37
|
-
return localFlow;
|
|
38
|
-
}
|
|
39
|
-
function setInputTransformFromArgs(flow, args) {
|
|
40
|
-
let input_transforms = {};
|
|
41
|
-
Object.entries(args).forEach(([key, value]) => {
|
|
42
|
-
input_transforms[key] = {
|
|
43
|
-
type: 'static',
|
|
44
|
-
value: value
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
flow.value.modules[0].input_transforms = input_transforms;
|
|
48
|
-
return flow;
|
|
49
|
-
}
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<button
|
|
53
|
-
class="w-full rounded border-1 border border-gray-200"
|
|
54
|
-
on:click={() => {
|
|
55
|
-
viewPreview = !viewPreview
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
<h2 class="flex justify-center text-gray-600">
|
|
59
|
-
<div>
|
|
60
|
-
Preview
|
|
61
|
-
<Icon class="ml-1" data={viewPreview ? faChevronUp : faChevronDown} scale={1} />
|
|
62
|
-
</div>
|
|
63
|
-
</h2>
|
|
64
|
-
</button>
|
|
65
|
-
|
|
66
|
-
{#if viewPreview}
|
|
67
|
-
{#if i != flow.value.modules.length}
|
|
68
|
-
<div class="mt-2">
|
|
69
|
-
<Tabs bind:selected={tab}>
|
|
70
|
-
<Tab value="upto">{uptoText}</Tab>
|
|
71
|
-
<Tab value="justthis">Preview just this step</Tab>
|
|
72
|
-
<svelte:fragment slot="content">
|
|
73
|
-
<TabContent value="upto">
|
|
74
|
-
<RunForm
|
|
75
|
-
runnable={truncateFlow(flow)}
|
|
76
|
-
runAction={(_, args) => runPreview(args)}
|
|
77
|
-
schedulable={false}
|
|
78
|
-
buttonText={uptoText}
|
|
79
|
-
detailed={false}
|
|
80
|
-
bind:args
|
|
81
|
-
/>
|
|
82
|
-
</TabContent>
|
|
83
|
-
<TabContent value="justthis">
|
|
84
|
-
<RunForm
|
|
85
|
-
runnable={extractStep(flow)}
|
|
86
|
-
runAction={(_, args) => runPreview(args)}
|
|
87
|
-
schedulable={false}
|
|
88
|
-
buttonText="Preview just this step"
|
|
89
|
-
detailed={false}
|
|
90
|
-
args={stepArgs}
|
|
91
|
-
/>
|
|
92
|
-
</TabContent>
|
|
93
|
-
</svelte:fragment>
|
|
94
|
-
</Tabs>
|
|
95
|
-
</div>
|
|
96
|
-
{/if}
|
|
97
|
-
|
|
98
|
-
{#if jobId}
|
|
99
|
-
<div class="w-full flex justify-center">
|
|
100
|
-
<FlowStatusViewer
|
|
101
|
-
{jobId}
|
|
102
|
-
on:jobsLoaded={(e) => mapJobResultsToFlowState(e.detail, tab, i)}
|
|
103
|
-
root={true}
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
{/if}
|
|
107
|
-
{/if}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Schema } from '../common';
|
|
3
|
-
import type { Flow } from '../gen';
|
|
4
|
-
declare const __propDef: {
|
|
5
|
-
props: {
|
|
6
|
-
i: number;
|
|
7
|
-
flow: Flow;
|
|
8
|
-
schema: Schema;
|
|
9
|
-
args?: Record<string, any> | undefined;
|
|
10
|
-
runPreview?: ((args: any) => Promise<void>) | undefined;
|
|
11
|
-
};
|
|
12
|
-
events: {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {};
|
|
16
|
-
};
|
|
17
|
-
export declare type FlowPreviewProps = typeof __propDef.props;
|
|
18
|
-
export declare type FlowPreviewEvents = typeof __propDef.events;
|
|
19
|
-
export declare type FlowPreviewSlots = typeof __propDef.slots;
|
|
20
|
-
export default class FlowPreview extends SvelteComponentTyped<FlowPreviewProps, FlowPreviewEvents, FlowPreviewSlots> {
|
|
21
|
-
get runPreview(): (args: any) => Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<script>import { RawScript } from '../gen';
|
|
2
|
-
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import Icon from 'svelte-awesome';
|
|
4
|
-
import Editor from './Editor.svelte';
|
|
5
|
-
import EditorBar from './EditorBar.svelte';
|
|
6
|
-
import FlowPreview from './FlowPreview.svelte';
|
|
7
|
-
import FlowBox from './flows/FlowBox.svelte';
|
|
8
|
-
import FlowInputs from './flows/FlowInputs.svelte';
|
|
9
|
-
import FlowModuleHeader from './flows/FlowModuleHeader.svelte';
|
|
10
|
-
import { flowStore } from './flows/flowStore';
|
|
11
|
-
import { createInlineScriptModule, createLoop, fork, loadFlowModuleSchema, pickScript, createScriptFromInlineScript, isEmptyFlowModule, getStepPropPicker } from './flows/flowStateUtils';
|
|
12
|
-
import SchemaForm from './SchemaForm.svelte';
|
|
13
|
-
import { flowStateStore } from './flows/flowState';
|
|
14
|
-
import { stepOpened } from './flows/stepOpenedStore';
|
|
15
|
-
export let indexes;
|
|
16
|
-
export let mod;
|
|
17
|
-
export let args = {};
|
|
18
|
-
export let schema;
|
|
19
|
-
export let childFlowModules = undefined;
|
|
20
|
-
let editor;
|
|
21
|
-
let websocketAlive = { pyright: false, black: false, deno: false };
|
|
22
|
-
let bigEditor = false;
|
|
23
|
-
const i = indexes[0];
|
|
24
|
-
$: shouldPick = isEmptyFlowModule(mod);
|
|
25
|
-
$: stepPropPicker = getStepPropPicker(indexes, $flowStore.schema, $flowStateStore, args);
|
|
26
|
-
async function apply(fn, arg) {
|
|
27
|
-
const flowModuleSchema = await fn(arg);
|
|
28
|
-
mod = flowModuleSchema.flowModule;
|
|
29
|
-
schema = flowModuleSchema.schema;
|
|
30
|
-
if (flowModuleSchema.childFlowModules) {
|
|
31
|
-
childFlowModules = flowModuleSchema.childFlowModules;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async function reload(flowModule) {
|
|
35
|
-
apply(loadFlowModuleSchema, flowModule);
|
|
36
|
-
}
|
|
37
|
-
async function applyCreateLoop() {
|
|
38
|
-
await apply(createLoop, null);
|
|
39
|
-
stepOpened.update(() => `${indexes[0]}-0`);
|
|
40
|
-
}
|
|
41
|
-
$: opened = $stepOpened === String(indexes.join('-'));
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<FlowBox
|
|
45
|
-
headerClickable={true}
|
|
46
|
-
on:clickheader={() => ($stepOpened = !opened ? String(indexes.join('-')) : undefined)}
|
|
47
|
-
>
|
|
48
|
-
<svelte:fragment slot="header">
|
|
49
|
-
<FlowModuleHeader
|
|
50
|
-
bind:mod
|
|
51
|
-
bind:indexes
|
|
52
|
-
on:delete
|
|
53
|
-
on:fork={() => apply(fork, mod)}
|
|
54
|
-
on:createScriptFromInlineScript={() => {
|
|
55
|
-
apply(createScriptFromInlineScript, {
|
|
56
|
-
flowModule: mod,
|
|
57
|
-
suffix: indexes.join('-'),
|
|
58
|
-
schema
|
|
59
|
-
})
|
|
60
|
-
}}
|
|
61
|
-
/>
|
|
62
|
-
</svelte:fragment>
|
|
63
|
-
|
|
64
|
-
<div slot="content">
|
|
65
|
-
{#if opened}
|
|
66
|
-
<div class="p-6 border-t border-gray-300">
|
|
67
|
-
{#if shouldPick}
|
|
68
|
-
<FlowInputs
|
|
69
|
-
shouldDisableTriggerScripts={i != 0}
|
|
70
|
-
shouldDisableLoopCreation={indexes.length > 1 || i == 0}
|
|
71
|
-
on:pick={(e) => apply(pickScript, e.detail.path)}
|
|
72
|
-
on:new={(e) =>
|
|
73
|
-
apply(createInlineScriptModule, {
|
|
74
|
-
language: e.detail.language,
|
|
75
|
-
type: e.detail.type
|
|
76
|
-
})}
|
|
77
|
-
on:loop={() => applyCreateLoop()}
|
|
78
|
-
/>
|
|
79
|
-
{/if}
|
|
80
|
-
{#if mod.value.type === 'rawscript'}
|
|
81
|
-
<div class="mb-2 overflow-hidden">
|
|
82
|
-
<EditorBar {editor} {websocketAlive} lang={mod.value.language ?? 'deno'} />
|
|
83
|
-
</div>
|
|
84
|
-
<div on:mouseleave={() => reload(mod)}>
|
|
85
|
-
<Editor
|
|
86
|
-
bind:websocketAlive
|
|
87
|
-
bind:this={editor}
|
|
88
|
-
class="{bigEditor ? 'h-2/3' : 'h-80'} border p-2 rounded"
|
|
89
|
-
bind:code={mod.value.content}
|
|
90
|
-
deno={mod.value.language === RawScript.language.DENO}
|
|
91
|
-
automaticLayout={true}
|
|
92
|
-
formatAction={() => reload(mod)}
|
|
93
|
-
/>
|
|
94
|
-
<button
|
|
95
|
-
class="w-full text-center"
|
|
96
|
-
on:click={() => {
|
|
97
|
-
bigEditor = !bigEditor
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
<Icon data={bigEditor ? faChevronUp : faChevronDown} scale={1.0} />
|
|
101
|
-
</button>
|
|
102
|
-
</div>
|
|
103
|
-
<div class="mt-2 mb-8">
|
|
104
|
-
<p class="text-gray-500 italic">
|
|
105
|
-
Move the focus outside of the text editor to recompute the input schema or press
|
|
106
|
-
Ctrl/Cmd+S
|
|
107
|
-
</p>
|
|
108
|
-
</div>
|
|
109
|
-
{/if}
|
|
110
|
-
{#if !shouldPick}
|
|
111
|
-
<p class="text-lg font-bold text-gray-900 mb-2">Step inputs</p>
|
|
112
|
-
<SchemaForm
|
|
113
|
-
{schema}
|
|
114
|
-
inputTransform={true}
|
|
115
|
-
importPath={String(indexes.join('-'))}
|
|
116
|
-
bind:pickableProperties={stepPropPicker.pickableProperties}
|
|
117
|
-
bind:args={mod.input_transforms}
|
|
118
|
-
bind:extraLib={stepPropPicker.extraLib}
|
|
119
|
-
/>
|
|
120
|
-
{/if}
|
|
121
|
-
|
|
122
|
-
{#if !shouldPick}
|
|
123
|
-
<div class="border-b border-gray-200" />
|
|
124
|
-
<div class="pt-2">
|
|
125
|
-
<FlowPreview bind:args flow={$flowStore} {i} {schema} />
|
|
126
|
-
</div>
|
|
127
|
-
{/if}
|
|
128
|
-
</div>
|
|
129
|
-
{/if}
|
|
130
|
-
</div>
|
|
131
|
-
</FlowBox>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type FlowModule } from '../gen';
|
|
3
|
-
import type { Schema } from '../common';
|
|
4
|
-
import { type FlowModuleSchema } from './flows/flowState';
|
|
5
|
-
declare const __propDef: {
|
|
6
|
-
props: {
|
|
7
|
-
indexes: number[];
|
|
8
|
-
mod: FlowModule;
|
|
9
|
-
args?: Record<string, any> | undefined;
|
|
10
|
-
schema: Schema;
|
|
11
|
-
childFlowModules?: FlowModuleSchema[] | undefined;
|
|
12
|
-
};
|
|
13
|
-
events: {
|
|
14
|
-
delete: CustomEvent<any>;
|
|
15
|
-
} & {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
};
|
|
18
|
-
slots: {};
|
|
19
|
-
};
|
|
20
|
-
export declare type ModuleStepProps = typeof __propDef.props;
|
|
21
|
-
export declare type ModuleStepEvents = typeof __propDef.events;
|
|
22
|
-
export declare type ModuleStepSlots = typeof __propDef.slots;
|
|
23
|
-
export default class ModuleStep extends SvelteComponentTyped<ModuleStepProps, ModuleStepEvents, ModuleStepSlots> {
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<script>import { Button } from 'flowbite-svelte';
|
|
2
|
-
import { isCopyFirstStepSchemaDisabled } from './flowState';
|
|
3
|
-
import { copyFirstStepSchema } from './flowStore';
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<Button
|
|
7
|
-
color="light"
|
|
8
|
-
size="xs"
|
|
9
|
-
disabled={$isCopyFirstStepSchemaDisabled}
|
|
10
|
-
on:click={copyFirstStepSchema}
|
|
11
|
-
>
|
|
12
|
-
Copy from first step schema
|
|
13
|
-
</Button>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
-
import FlowBoxHeader from './FlowBoxHeader.svelte';
|
|
3
|
-
export let title = undefined;
|
|
4
|
-
export let headerClickable = false;
|
|
5
|
-
const dispatch = createEventDispatcher();
|
|
6
|
-
let slots = $$props.$$slots;
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div class="bg-white border border-gray-300 rounded-md shadow-md">
|
|
10
|
-
<FlowBoxHeader clickable={headerClickable} on:click={() => dispatch('clickheader')} {title}>
|
|
11
|
-
<slot name="header" />
|
|
12
|
-
</FlowBoxHeader>
|
|
13
|
-
{#if slots.content}
|
|
14
|
-
<slot name="content" />
|
|
15
|
-
{/if}
|
|
16
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
title?: string | undefined;
|
|
6
|
-
headerClickable?: boolean | undefined;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
clickheader: CustomEvent<any>;
|
|
10
|
-
} & {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {
|
|
14
|
-
header: {};
|
|
15
|
-
content: {};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare type FlowBoxProps = typeof __propDef.props;
|
|
19
|
-
export declare type FlowBoxEvents = typeof __propDef.events;
|
|
20
|
-
export declare type FlowBoxSlots = typeof __propDef.slots;
|
|
21
|
-
export default class FlowBox extends SvelteComponentTyped<FlowBoxProps, FlowBoxEvents, FlowBoxSlots> {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
-
export let title = undefined;
|
|
3
|
-
export let clickable = false;
|
|
4
|
-
const dispatch = createEventDispatcher();
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div
|
|
8
|
-
on:click={() => dispatch('click')}
|
|
9
|
-
class="flex items-center justify-between flex-wrap px-6 py-2"
|
|
10
|
-
class:cursor-pointer={clickable}
|
|
11
|
-
>
|
|
12
|
-
{#if title}
|
|
13
|
-
<h3 class="text-sm font-bold text-gray-900">{title}</h3>
|
|
14
|
-
{/if}
|
|
15
|
-
<slot />
|
|
16
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
title?: string | undefined;
|
|
5
|
-
clickable?: boolean | undefined;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
click: CustomEvent<any>;
|
|
9
|
-
} & {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {
|
|
13
|
-
default: {};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare type FlowBoxHeaderProps = typeof __propDef.props;
|
|
17
|
-
export declare type FlowBoxHeaderEvents = typeof __propDef.events;
|
|
18
|
-
export declare type FlowBoxHeaderSlots = typeof __propDef.slots;
|
|
19
|
-
export default class FlowBoxHeader extends SvelteComponentTyped<FlowBoxHeaderProps, FlowBoxHeaderEvents, FlowBoxHeaderSlots> {
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script>import { emptySchema } from '../../utils';
|
|
2
|
-
import SchemaEditor from '../SchemaEditor.svelte';
|
|
3
|
-
import { flowStore } from './../flows/flowStore';
|
|
4
|
-
import CopyFirstStepSchema from './CopyFirstStepSchema.svelte';
|
|
5
|
-
import FlowBox from './FlowBox.svelte';
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<FlowBox title="Flow Inputs">
|
|
9
|
-
<div slot="header">
|
|
10
|
-
<CopyFirstStepSchema />
|
|
11
|
-
</div>
|
|
12
|
-
<div slot="content">
|
|
13
|
-
<div class="p-6 border-t border-gray-300">
|
|
14
|
-
<SchemaEditor
|
|
15
|
-
on:change={() => {
|
|
16
|
-
$flowStore = $flowStore
|
|
17
|
-
}}
|
|
18
|
-
schema={$flowStore?.schema ?? emptySchema()}
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</FlowBox>
|