windmill-components 1.35.1 → 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 +21 -21
- package/components/ArgInput.svelte.d.ts +3 -3
- package/components/DisplayResult.svelte +73 -67
- package/components/Editor.svelte +184 -246
- package/components/Editor.svelte.d.ts +4 -4
- 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/IconedResourceType.svelte +1 -1
- package/components/InputTransformForm.svelte +88 -107
- 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 +5 -3
- 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 +147 -0
- package/components/SimpleEditor.svelte.d.ts +35 -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/editorUtils.d.ts +25 -0
- package/editorUtils.js +43 -0
- 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 +67 -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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
content: string | undefined;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
scrollToBottom?: (() => void) | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type LogViewerProps = typeof __propDef.props;
|
|
14
|
+
export declare type LogViewerEvents = typeof __propDef.events;
|
|
15
|
+
export declare type LogViewerSlots = typeof __propDef.slots;
|
|
16
|
+
export default class LogViewer extends SvelteComponentTyped<LogViewerProps, LogViewerEvents, LogViewerSlots> {
|
|
17
|
+
get scrollToBottom(): () => void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script>import { getScriptByPath, sendUserToast, truncateRev } from '../utils';
|
|
2
|
+
import { HSplitPane, VSplitPane } from 'svelte-split-pane';
|
|
3
|
+
import RunForm from './RunForm.svelte';
|
|
4
|
+
import TestJobLoader from './TestJobLoader.svelte';
|
|
5
|
+
import LogViewer from './LogViewer.svelte';
|
|
6
|
+
import DisplayResult from './DisplayResult.svelte';
|
|
7
|
+
import Button from './common/button/Button.svelte';
|
|
8
|
+
import { faRotateRight } from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import { flowStateStore } from './flows/flowState';
|
|
10
|
+
let testJobLoader;
|
|
11
|
+
// Test
|
|
12
|
+
let testIsLoading = false;
|
|
13
|
+
let testJob;
|
|
14
|
+
export let mod;
|
|
15
|
+
export let schema;
|
|
16
|
+
export let indices;
|
|
17
|
+
let stepArgs = {};
|
|
18
|
+
export function runTestWithStepArgs() {
|
|
19
|
+
runTest(stepArgs);
|
|
20
|
+
}
|
|
21
|
+
export async function runTest(args) {
|
|
22
|
+
const val = mod.value;
|
|
23
|
+
if (val.type == 'rawscript') {
|
|
24
|
+
await testJobLoader?.runPreview(val.path, val.content, val.language, args);
|
|
25
|
+
}
|
|
26
|
+
else if (val.type == 'script') {
|
|
27
|
+
const script = await getScriptByPath(val.path);
|
|
28
|
+
await testJobLoader?.runPreview(val.path, script.content, script.language, args);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw Error('not testable module type');
|
|
32
|
+
}
|
|
33
|
+
sendUserToast(`started test ${truncateRev(testJob?.id ?? '', 10)}`);
|
|
34
|
+
}
|
|
35
|
+
function jobDone() {
|
|
36
|
+
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob' && `result` in testJob) {
|
|
37
|
+
const result = testJob.result;
|
|
38
|
+
const pMod = $flowStateStore.modules[indices[0]];
|
|
39
|
+
if (pMod) {
|
|
40
|
+
if (indices[1] != undefined && pMod.childFlowModules) {
|
|
41
|
+
const cMod = pMod.childFlowModules[indices[1]];
|
|
42
|
+
if (cMod) {
|
|
43
|
+
cMod.previewResult = result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
pMod.previewResult = result;
|
|
48
|
+
}
|
|
49
|
+
$flowStateStore.modules[indices[0]] = pMod;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<TestJobLoader
|
|
56
|
+
on:done={jobDone}
|
|
57
|
+
bind:this={testJobLoader}
|
|
58
|
+
bind:isLoading={testIsLoading}
|
|
59
|
+
bind:job={testJob}
|
|
60
|
+
/>
|
|
61
|
+
<HSplitPane leftPaneSize="50%" rightPaneSize="50%" minLeftPaneSize="20%" minRightPaneSize="20%">
|
|
62
|
+
<left slot="left" class="relative">
|
|
63
|
+
<div class="overflow-auto h-full p-4">
|
|
64
|
+
<RunForm
|
|
65
|
+
runnable={{ summary: mod.summary ?? '', schema, description: '' }}
|
|
66
|
+
runAction={(_, args) => runTest(args)}
|
|
67
|
+
schedulable={false}
|
|
68
|
+
buttonText="Test just this step (Ctrl+Enter)"
|
|
69
|
+
detailed={false}
|
|
70
|
+
bind:args={stepArgs}
|
|
71
|
+
/>
|
|
72
|
+
{#if testIsLoading}
|
|
73
|
+
<Button
|
|
74
|
+
on:click={testJobLoader?.cancelJob}
|
|
75
|
+
btnClasses="w-full"
|
|
76
|
+
color="red"
|
|
77
|
+
size="sm"
|
|
78
|
+
startIcon={{
|
|
79
|
+
icon: faRotateRight,
|
|
80
|
+
classes: 'animate-spin'
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
Cancel
|
|
84
|
+
</Button>
|
|
85
|
+
{/if}
|
|
86
|
+
</div>
|
|
87
|
+
</left>
|
|
88
|
+
<right slot="right">
|
|
89
|
+
<div class="overflow-auto h-full">
|
|
90
|
+
<VSplitPane topPanelSize="50%" downPanelSize="50%">
|
|
91
|
+
<top slot="top">
|
|
92
|
+
<LogViewer content={testJob?.logs} isLoading={testIsLoading} />
|
|
93
|
+
</top>
|
|
94
|
+
<down slot="down">
|
|
95
|
+
<pre class="overflow-x-auto break-all relative h-full p-2 text-sm">
|
|
96
|
+
{#if testJob && 'result' in testJob && testJob.result}
|
|
97
|
+
<DisplayResult result={testJob.result} />
|
|
98
|
+
{:else if testIsLoading}
|
|
99
|
+
Waiting for Result...
|
|
100
|
+
{:else}
|
|
101
|
+
Test to see result here
|
|
102
|
+
{/if}
|
|
103
|
+
</pre>
|
|
104
|
+
</down>
|
|
105
|
+
</VSplitPane>
|
|
106
|
+
</div>
|
|
107
|
+
</right>
|
|
108
|
+
</HSplitPane>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Schema } from '../common';
|
|
3
|
+
import type { FlowModule } from '../gen';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
mod: FlowModule;
|
|
7
|
+
schema: Schema;
|
|
8
|
+
indices: [number, number | undefined];
|
|
9
|
+
runTestWithStepArgs?: (() => void) | undefined;
|
|
10
|
+
runTest?: ((args: any) => Promise<void>) | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export declare type ModulePreviewProps = typeof __propDef.props;
|
|
18
|
+
export declare type ModulePreviewEvents = typeof __propDef.events;
|
|
19
|
+
export declare type ModulePreviewSlots = typeof __propDef.slots;
|
|
20
|
+
export default class ModulePreview extends SvelteComponentTyped<ModulePreviewProps, ModulePreviewEvents, ModulePreviewSlots> {
|
|
21
|
+
get runTestWithStepArgs(): () => void;
|
|
22
|
+
get runTest(): (args: any) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -61,9 +61,7 @@ let scheduledForStr;
|
|
|
61
61
|
{#if !runnable.schema.properties || Object.keys(runnable.schema.properties).length === 0}
|
|
62
62
|
<div class="text-sm p-4">No arguments</div>
|
|
63
63
|
{:else}
|
|
64
|
-
<
|
|
65
|
-
<SchemaForm schema={runnable.schema} bind:isValid bind:args />
|
|
66
|
-
</div>
|
|
64
|
+
<SchemaForm schema={runnable.schema} bind:isValid bind:args />
|
|
67
65
|
{/if}
|
|
68
66
|
{:else}
|
|
69
67
|
<div class="text-sm">No schema</div>
|
|
@@ -96,30 +94,43 @@ let scheduledForStr;
|
|
|
96
94
|
</div>
|
|
97
95
|
</div>
|
|
98
96
|
{/if}
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
{#if schedulable}
|
|
98
|
+
<div class="flex justify-between mt-2 md:mt-6 mb-6">
|
|
99
|
+
<button
|
|
100
|
+
type="submit"
|
|
101
|
+
class="mr-6 text-sm underline text-gray-700 inline-flex items-center"
|
|
102
|
+
on:click={() => {
|
|
103
|
+
viewOptions = !viewOptions
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
108
106
|
<div>
|
|
109
107
|
Schedule to run later
|
|
110
108
|
<Icon data={viewOptions ? faChevronUp : faChevronDown} scale={0.5} />
|
|
111
109
|
</div>
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
</button>
|
|
111
|
+
<button
|
|
112
|
+
type="submit"
|
|
113
|
+
disabled={!isValid}
|
|
114
|
+
class="{isValid ? 'default-button' : 'default-button-disabled'} w-min px-6"
|
|
115
|
+
on:click={() => {
|
|
116
|
+
runAction(scheduledForStr, args)
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{scheduledForStr ? 'Schedule run to a later time' : buttonText}
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
{:else}
|
|
114
123
|
<button
|
|
115
124
|
type="submit"
|
|
116
125
|
disabled={!isValid}
|
|
117
|
-
class="{isValid
|
|
126
|
+
class="{isValid
|
|
127
|
+
? 'default-button'
|
|
128
|
+
: 'default-button-disabled'} w-full rounded rounded-md px-6 mb-4"
|
|
118
129
|
on:click={() => {
|
|
119
|
-
runAction(
|
|
130
|
+
runAction(undefined, args)
|
|
120
131
|
}}
|
|
121
132
|
>
|
|
122
|
-
{
|
|
133
|
+
{buttonText}
|
|
123
134
|
</button>
|
|
124
|
-
|
|
135
|
+
{/if}
|
|
125
136
|
</div>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Schema } from '../common';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
runnable:
|
|
5
|
+
runnable: {
|
|
6
|
+
summary?: string;
|
|
7
|
+
schema?: Schema;
|
|
8
|
+
description?: string;
|
|
9
|
+
} | undefined;
|
|
6
10
|
runAction: (scheduledForStr: string | undefined, args: Record<string, any>) => void;
|
|
7
11
|
buttonText?: string | undefined;
|
|
8
12
|
schedulable?: boolean | undefined;
|
|
@@ -3,9 +3,9 @@ import { faPen, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
|
3
3
|
import { Button } from 'flowbite-svelte';
|
|
4
4
|
import { createEventDispatcher } from 'svelte';
|
|
5
5
|
import Icon from 'svelte-awesome';
|
|
6
|
-
import Editor from './Editor.svelte';
|
|
7
6
|
import SchemaEditorProperty from './SchemaEditorProperty.svelte';
|
|
8
7
|
import SchemaModal, { DEFAULT_PROPERTY, schemaToModal } from './SchemaModal.svelte';
|
|
8
|
+
import SimpleEditor from './SimpleEditor.svelte';
|
|
9
9
|
import TableCustom from './TableCustom.svelte';
|
|
10
10
|
import Toggle from './Toggle.svelte';
|
|
11
11
|
import Tooltip from './Tooltip.svelte';
|
|
@@ -59,7 +59,9 @@ function handleAddOrEditArgument() {
|
|
|
59
59
|
else {
|
|
60
60
|
schema.properties[modalProperty.name] = modalToSchema(modalProperty);
|
|
61
61
|
if (modalProperty.required) {
|
|
62
|
-
schema.required
|
|
62
|
+
if (!schema.required.includes(modalProperty.name)) {
|
|
63
|
+
schema.required.push(modalProperty.name);
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
else if (schema.required.includes(modalProperty.name)) {
|
|
65
67
|
const index = schema.required.indexOf(modalProperty.name, 0);
|
|
@@ -208,7 +210,7 @@ function switchTab() {
|
|
|
208
210
|
</div>
|
|
209
211
|
{:else}
|
|
210
212
|
<div class="border rounded mt-4 p-2">
|
|
211
|
-
<
|
|
213
|
+
<SimpleEditor
|
|
212
214
|
on:change={() => {
|
|
213
215
|
try {
|
|
214
216
|
schema = JSON.parse(schemaString)
|
|
@@ -6,7 +6,6 @@ export let schema;
|
|
|
6
6
|
export let args = {};
|
|
7
7
|
export let editableSchema = false;
|
|
8
8
|
export let isValid = true;
|
|
9
|
-
export let pickableProperties = undefined;
|
|
10
9
|
export let extraLib = 'missing extraLib';
|
|
11
10
|
export let importPath = undefined;
|
|
12
11
|
let inputCheck = {};
|
|
@@ -34,7 +33,6 @@ $: schema?.properties && removeExtraKey();
|
|
|
34
33
|
bind:schema
|
|
35
34
|
bind:argName
|
|
36
35
|
bind:inputCheck
|
|
37
|
-
bind:pickableProperties
|
|
38
36
|
bind:extraLib
|
|
39
37
|
bind:importPath
|
|
40
38
|
/>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
<script>import { ScriptService } from '../gen';
|
|
1
|
+
<script>import { Script, ScriptService } from '../gen';
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { page } from '$app/stores';
|
|
4
4
|
import { inferArgs } from '../infer';
|
|
5
|
-
import {
|
|
5
|
+
import { initialCode, isInitialCode } from '../script_helpers';
|
|
6
6
|
import { workspaceStore } from '../stores';
|
|
7
|
-
import {
|
|
7
|
+
import { encodeState, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
8
8
|
import { Breadcrumb, BreadcrumbItem } from 'flowbite-svelte';
|
|
9
|
-
import { onDestroy } from 'svelte';
|
|
10
9
|
import SvelteMarkdown from 'svelte-markdown';
|
|
11
10
|
import Path from './Path.svelte';
|
|
12
11
|
import RadioButton from './RadioButton.svelte';
|
|
@@ -14,27 +13,24 @@ import Required from './Required.svelte';
|
|
|
14
13
|
import ScriptEditor from './ScriptEditor.svelte';
|
|
15
14
|
import ScriptSchema from './ScriptSchema.svelte';
|
|
16
15
|
import CenteredPage from './CenteredPage.svelte';
|
|
17
|
-
|
|
18
|
-
let scriptSchema;
|
|
16
|
+
import Tooltip from './Tooltip.svelte';
|
|
19
17
|
export let script;
|
|
20
18
|
export let initialPath = '';
|
|
21
|
-
export let template =
|
|
19
|
+
export let template = 'script';
|
|
22
20
|
let pathError = '';
|
|
23
21
|
$: setQueryWithoutLoad($page.url, 'state', encodeState(script));
|
|
24
22
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
25
|
-
$: {
|
|
26
|
-
if (script.language == 'python3') {
|
|
27
|
-
script.is_trigger = false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
23
|
if (script.content == '') {
|
|
31
|
-
initContent(script.language, template);
|
|
24
|
+
initContent(script.language, script.kind, template);
|
|
32
25
|
}
|
|
33
|
-
function initContent(language, template) {
|
|
34
|
-
script.content = initialCode(language, template
|
|
26
|
+
function initContent(language, kind, template) {
|
|
27
|
+
script.content = initialCode(language, kind, template);
|
|
35
28
|
}
|
|
36
29
|
async function editScript() {
|
|
37
30
|
try {
|
|
31
|
+
if (!script.schema) {
|
|
32
|
+
await inferArgs(script.language, script.content, script.schema);
|
|
33
|
+
}
|
|
38
34
|
const newHash = await ScriptService.createScript({
|
|
39
35
|
workspace: $workspaceStore,
|
|
40
36
|
requestBody: {
|
|
@@ -46,7 +42,7 @@ async function editScript() {
|
|
|
46
42
|
schema: script.schema,
|
|
47
43
|
is_template: script.is_template,
|
|
48
44
|
language: script.language,
|
|
49
|
-
|
|
45
|
+
kind: script.kind
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
48
|
sendUserToast(`Success! New script version created with hash ${newHash}`);
|
|
@@ -56,31 +52,12 @@ async function editScript() {
|
|
|
56
52
|
sendUserToast(`Impossible to save the script: ${error.body}`, true);
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
export function setCode(script) {
|
|
60
|
-
editor?.getEditor().setCode(script.content);
|
|
61
|
-
if (scriptSchema) {
|
|
62
|
-
if (script.schema) {
|
|
63
|
-
scriptSchema.setSchema(script.schema);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
scriptSchema.setSchema(emptySchema());
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async function inferSchema() {
|
|
71
|
-
await inferArgs(script.language, script.content, script.schema);
|
|
72
|
-
}
|
|
73
55
|
async function changeStep(step) {
|
|
74
|
-
if (step
|
|
75
|
-
script.
|
|
76
|
-
await inferSchema();
|
|
77
|
-
script.schema = script.schema;
|
|
56
|
+
if (step > 1) {
|
|
57
|
+
await inferArgs(script.language, script.content, script.schema);
|
|
78
58
|
}
|
|
79
59
|
goto(`?step=${step}`);
|
|
80
60
|
}
|
|
81
|
-
onDestroy(() => {
|
|
82
|
-
editor?.$destroy();
|
|
83
|
-
});
|
|
84
61
|
</script>
|
|
85
62
|
|
|
86
63
|
<div class="flex flex-col h-screen">
|
|
@@ -142,7 +119,6 @@ onDestroy(() => {
|
|
|
142
119
|
<button
|
|
143
120
|
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
144
121
|
on:click={async () => {
|
|
145
|
-
await inferSchema()
|
|
146
122
|
editScript()
|
|
147
123
|
}}
|
|
148
124
|
>
|
|
@@ -178,30 +154,80 @@ onDestroy(() => {
|
|
|
178
154
|
label="Language"
|
|
179
155
|
options={[
|
|
180
156
|
['Typescript (Deno)', 'deno'],
|
|
181
|
-
['Python 3.10', 'python3']
|
|
157
|
+
['Python 3.10', 'python3'],
|
|
158
|
+
['Go', 'go']
|
|
182
159
|
]}
|
|
183
|
-
on:change={(e) => initContent(e.detail, template)}
|
|
160
|
+
on:change={(e) => initContent(e.detail, script.kind, template)}
|
|
184
161
|
bind:value={script.language}
|
|
185
162
|
/>
|
|
186
163
|
</div>
|
|
164
|
+
<h4 class="text-gray-700 border-b">
|
|
165
|
+
Script Kind <Tooltip
|
|
166
|
+
>In most cases, you will want the General Script. <br />
|
|
167
|
+
Trigger are meant to be used as the first module of flows to trigger them based on watching
|
|
168
|
+
new events externally. <br />
|
|
169
|
+
Failure scripts are used to handle unrecoverable errors of flows and for handling errors
|
|
170
|
+
at the workspace level. <br />
|
|
171
|
+
Command scripts are used when the workspace is associated with a slack workspace to be triggered
|
|
172
|
+
on command.</Tooltip
|
|
173
|
+
>
|
|
174
|
+
</h4>
|
|
175
|
+
|
|
187
176
|
{#if script.language == 'deno'}
|
|
188
|
-
<
|
|
177
|
+
<div class="max-w-lg">
|
|
178
|
+
<RadioButton
|
|
179
|
+
label="Script Type"
|
|
180
|
+
options={[
|
|
181
|
+
['General Script', Script.kind.SCRIPT],
|
|
182
|
+
['Trigger Script', Script.kind.TRIGGER]
|
|
183
|
+
// ['Failure Handler', Script.kind.FAILURE],
|
|
184
|
+
// ['Command Handler', Script.kind.COMMAND]
|
|
185
|
+
]}
|
|
186
|
+
on:change={(e) => {
|
|
187
|
+
if (isInitialCode(script.content)) {
|
|
188
|
+
template = 'script'
|
|
189
|
+
initContent(script.language, e.detail, template)
|
|
190
|
+
}
|
|
191
|
+
}}
|
|
192
|
+
bind:value={script.kind}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
{:else}
|
|
196
|
+
<div class="max-w-lg">
|
|
197
|
+
<RadioButton
|
|
198
|
+
label="Script Type"
|
|
199
|
+
options={[['General Script', Script.kind.SCRIPT]]}
|
|
200
|
+
on:change={(e) => {
|
|
201
|
+
if (isInitialCode(script.content)) {
|
|
202
|
+
template = 'script'
|
|
203
|
+
initContent(script.language, e.detail, template)
|
|
204
|
+
}
|
|
205
|
+
}}
|
|
206
|
+
bind:value={script.kind}
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
{/if}
|
|
210
|
+
|
|
211
|
+
{#if script.language == 'deno' && script.kind == Script.kind.SCRIPT}
|
|
212
|
+
<h4 class="text-gray-700 border-b">
|
|
213
|
+
Script Template <Tooltip
|
|
214
|
+
>A template is a pre-filled script corresponding to a more specialized use-case</Tooltip
|
|
215
|
+
>
|
|
216
|
+
</h4>
|
|
189
217
|
|
|
190
218
|
<div class="max-w-md">
|
|
191
219
|
<RadioButton
|
|
192
220
|
label="Template"
|
|
193
221
|
options={[
|
|
194
|
-
['
|
|
195
|
-
['PostgreSQL', 'pgsql']
|
|
222
|
+
['Standard', 'script'],
|
|
223
|
+
['PostgreSQL Prepared Statement', 'pgsql']
|
|
196
224
|
]}
|
|
197
|
-
on:change={(e) => initContent(script.language, e.detail)}
|
|
225
|
+
on:change={(e) => initContent(script.language, script.kind, e.detail)}
|
|
198
226
|
bind:value={template}
|
|
199
227
|
/>
|
|
200
228
|
</div>
|
|
201
229
|
{/if}
|
|
202
230
|
|
|
203
|
-
<h3 class="text-gray-700 pb-1 border-b">Metadata</h3>
|
|
204
|
-
|
|
205
231
|
<label class="block ">
|
|
206
232
|
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
207
233
|
<textarea
|
|
@@ -241,28 +267,14 @@ onDestroy(() => {
|
|
|
241
267
|
</label>
|
|
242
268
|
|
|
243
269
|
<label class="block">
|
|
244
|
-
<span class="text-gray-700 mr-2"
|
|
270
|
+
<span class="text-gray-700 mr-2"
|
|
271
|
+
>Save as workspace template <Tooltip
|
|
272
|
+
>Enable your teammates to use this script as a template to write new scripts.</Tooltip
|
|
273
|
+
>
|
|
274
|
+
</span>
|
|
245
275
|
<input type="checkbox" bind:checked={script.is_template} />
|
|
246
276
|
</label>
|
|
247
277
|
|
|
248
|
-
<label class="block">
|
|
249
|
-
<span class="text-gray-700 mr-2">Save as trigger script</span>
|
|
250
|
-
<input
|
|
251
|
-
disabled={script.language == 'python3'}
|
|
252
|
-
type="checkbox"
|
|
253
|
-
bind:checked={script.is_trigger}
|
|
254
|
-
on:change={() => {
|
|
255
|
-
if (
|
|
256
|
-
script.content == DENO_INIT_CODE ||
|
|
257
|
-
script.content == DENO_INIT_CODE_TRIGGER ||
|
|
258
|
-
script.content == POSTGRES_INIT_CODE
|
|
259
|
-
) {
|
|
260
|
-
initContent(script.language, template)
|
|
261
|
-
}
|
|
262
|
-
}}
|
|
263
|
-
/>
|
|
264
|
-
</label>
|
|
265
|
-
|
|
266
278
|
<div>
|
|
267
279
|
<h3 class="text-gray-700 ">Description rendered</h3>
|
|
268
280
|
<div
|
|
@@ -276,7 +288,6 @@ onDestroy(() => {
|
|
|
276
288
|
</CenteredPage>
|
|
277
289
|
{:else if step === 2}
|
|
278
290
|
<ScriptEditor
|
|
279
|
-
bind:this={editor}
|
|
280
291
|
bind:schema={script.schema}
|
|
281
292
|
path={script.path}
|
|
282
293
|
bind:code={script.content}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { Script } from '../gen';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
script: Script;
|
|
6
6
|
initialPath?: string | undefined;
|
|
7
|
-
template?:
|
|
8
|
-
setCode?: ((script: Script) => void) | undefined;
|
|
7
|
+
template?: "script" | "pgsql" | undefined;
|
|
9
8
|
};
|
|
10
9
|
events: {
|
|
11
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -16,6 +15,5 @@ export declare type ScriptBuilderProps = typeof __propDef.props;
|
|
|
16
15
|
export declare type ScriptBuilderEvents = typeof __propDef.events;
|
|
17
16
|
export declare type ScriptBuilderSlots = typeof __propDef.slots;
|
|
18
17
|
export default class ScriptBuilder extends SvelteComponentTyped<ScriptBuilderProps, ScriptBuilderEvents, ScriptBuilderSlots> {
|
|
19
|
-
get setCode(): (script: Script) => void;
|
|
20
18
|
}
|
|
21
19
|
export {};
|