windmill-components 1.35.42 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AppConnect.svelte +85 -59
- package/components/ArgInput.svelte +50 -33
- package/components/ArgInput.svelte.d.ts +1 -1
- package/components/Button.svelte +15 -48
- package/components/Button.svelte.d.ts +1 -1
- package/components/CronInput.svelte +1 -1
- package/components/DisplayResult.svelte +75 -67
- package/components/Dropdown.svelte +9 -7
- package/components/Editor.svelte +187 -178
- package/components/Editor.svelte.d.ts +4 -2
- package/components/EditorBar.svelte +135 -98
- package/components/EditorBar.svelte.d.ts +2 -1
- package/components/FlowBuilder.svelte +115 -134
- package/components/FlowJobResult.svelte +4 -5
- package/components/FlowModulesViewer.svelte +89 -7
- package/components/FlowModulesViewer.svelte.d.ts +1 -0
- package/components/FlowPreviewContent.svelte +88 -27
- package/components/FlowPreviewContent.svelte.d.ts +1 -1
- package/components/FlowStatusViewer.svelte +39 -24
- package/components/FlowStatusViewer.svelte.d.ts +0 -1
- package/components/FlowViewer.svelte +17 -11
- package/components/GroupModal.svelte +10 -1
- package/components/HighlightCode.svelte +22 -0
- package/components/HighlightCode.svelte.d.ts +17 -0
- package/components/IconedPath.svelte +9 -7
- package/components/InputTransformForm.svelte +97 -115
- package/components/InputTransformForm.svelte.d.ts +0 -1
- package/components/InputTransformsViewer.svelte +1 -1
- package/components/InviteGlobalUser.svelte +8 -8
- package/components/InviteUser.svelte +9 -9
- package/components/ItemPicker.svelte +37 -30
- package/components/ItemPicker.svelte.d.ts +2 -1
- package/components/JobStatus.svelte +2 -1
- package/components/LogViewer.svelte +23 -0
- package/components/LogViewer.svelte.d.ts +19 -0
- package/components/ModulePreview.svelte +107 -0
- package/components/ModulePreview.svelte.d.ts +24 -0
- package/components/Path.svelte +1 -1
- package/components/RadioButton.svelte +3 -2
- package/components/ResourceEditor.svelte +22 -34
- package/components/ResourceTypePicker.svelte +23 -34
- package/components/RunForm.svelte +34 -31
- package/components/RunForm.svelte.d.ts +6 -2
- package/components/SchemaEditor.svelte +19 -11
- package/components/SchemaForm.svelte +3 -3
- package/components/SchemaForm.svelte.d.ts +1 -1
- package/components/SchemaModal.svelte +18 -7
- package/components/ScriptBuilder.svelte +99 -83
- package/components/ScriptBuilder.svelte.d.ts +2 -4
- package/components/ScriptEditor.svelte +71 -143
- package/components/ScriptEditor.svelte.d.ts +0 -5
- package/components/ScriptPicker.svelte +24 -14
- package/components/ScriptPicker.svelte.d.ts +2 -1
- package/components/ScriptSchema.svelte +8 -11
- package/components/ScriptSchema.svelte.d.ts +0 -1
- package/components/ShareModal.svelte +6 -6
- package/components/SharedBadge.svelte +5 -13
- package/components/SimpleEditor.svelte +14 -10
- package/components/StringTypeNarrowing.svelte +24 -30
- package/components/TestJobLoader.svelte +106 -0
- package/components/TestJobLoader.svelte.d.ts +26 -0
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +15 -24
- package/components/common/actionRow/ActionRow.svelte +31 -0
- package/components/common/actionRow/ActionRow.svelte.d.ts +22 -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 +76 -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 +110 -0
- package/components/common/button/Button.svelte.d.ts +39 -0
- package/components/common/button/model.d.ts +6 -0
- package/components/common/button/model.js +1 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte +72 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte.d.ts +23 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +41 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte.d.ts +14 -0
- package/components/common/confirmationModal/dirtyStore.d.ts +1 -0
- package/components/common/confirmationModal/dirtyStore.js +2 -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 -6
- 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 +25 -0
- package/components/flows/content/FlowEditorPanel.svelte.d.ts +16 -0
- package/components/flows/content/FlowFailureModule.svelte +15 -0
- package/components/flows/content/FlowFailureModule.svelte.d.ts +14 -0
- package/components/flows/content/FlowInput.svelte +26 -0
- package/components/flows/{FlowInput.svelte.d.ts → content/FlowInput.svelte.d.ts} +0 -0
- package/components/flows/content/FlowInputs.svelte +91 -0
- package/components/flows/{FlowInputs.svelte.d.ts → content/FlowInputs.svelte.d.ts} +1 -0
- package/components/flows/content/FlowLoop.svelte +168 -0
- package/components/flows/content/FlowLoop.svelte.d.ts +18 -0
- package/components/flows/content/FlowLoopWrapper.svelte +9 -0
- package/components/flows/content/FlowLoopWrapper.svelte.d.ts +14 -0
- package/components/flows/content/FlowModule.svelte +211 -0
- package/components/flows/content/FlowModule.svelte.d.ts +29 -0
- package/components/flows/content/FlowModuleEarlyStop.svelte +76 -0
- package/components/flows/content/FlowModuleEarlyStop.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleHeader.svelte +157 -0
- package/components/flows/{FlowModuleHeader.svelte.d.ts → content/FlowModuleHeader.svelte.d.ts} +5 -3
- package/components/flows/content/FlowModuleScript.svelte +21 -0
- package/components/flows/content/FlowModuleScript.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleSuspend.svelte +27 -0
- package/components/flows/content/FlowModuleSuspend.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleWrapper.svelte +45 -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 +17 -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 +78 -0
- package/components/flows/{FlowSettings.svelte.d.ts → content/FlowSettings.svelte.d.ts} +2 -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 +16 -14
- package/components/flows/flowStateUtils.js +81 -73
- package/components/flows/flowStore.js +7 -4
- package/components/flows/header/FlowImportExportMenu.svelte +55 -0
- package/components/flows/header/FlowImportExportMenu.svelte.d.ts +14 -0
- package/components/flows/header/FlowPreviewButtons.svelte +57 -0
- package/components/flows/header/FlowPreviewButtons.svelte.d.ts +14 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte +60 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte.d.ts +14 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte +80 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +32 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte +241 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +20 -0
- package/components/flows/pickers/PickHubScript.svelte +5 -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 +44 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +33 -0
- package/components/flows/scheduleUtils.d.ts +0 -1
- package/components/flows/scheduleUtils.js +0 -1
- package/components/flows/types.d.ts +8 -0
- package/components/flows/types.js +1 -0
- package/components/flows/utils.d.ts +3 -1
- package/components/flows/utils.js +26 -10
- package/components/icons/AirtableIcon.svelte +1 -1
- package/components/icons/DiscordIcon.svelte +1 -1
- package/components/icons/GCloudIcon.svelte +1 -1
- package/components/icons/GItlabIcon.svelte +1 -1
- package/components/icons/GSheetsIcon.svelte +1 -1
- package/components/icons/GcalIcon.svelte +1 -1
- package/components/icons/GdriveIcon.svelte +1 -1
- package/components/icons/GithubIcon.svelte +1 -1
- package/components/icons/GmailIcon.svelte +1 -1
- package/components/icons/HatIcon.svelte +19 -0
- package/components/icons/HatIcon.svelte.d.ts +16 -0
- package/components/icons/MastodonIcon.svelte +1 -1
- package/components/icons/MatrixIcon.svelte +1 -1
- package/components/icons/PostgresIcon.svelte +1 -1
- package/components/icons/S3Icon.svelte +1 -1
- package/components/icons/Slack.svelte +1 -1
- package/components/icons/TogglIcon.svelte +8 -46
- package/components/jobs/JobDetail.svelte +1 -1
- 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 +18 -12
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/PropPicker.svelte +108 -11
- 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 +3 -0
- package/editorUtils.js +1 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +1 -0
- package/gen/models/CompletedJob.d.ts +2 -1
- package/gen/models/CompletedJob.js +1 -0
- package/gen/models/FlowModule.d.ts +3 -0
- package/gen/models/FlowStatus.d.ts +3 -0
- package/gen/models/FlowStatusModule.d.ts +1 -1
- 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/Retry.d.ts +11 -0
- package/gen/models/Retry.js +4 -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 +71 -38
- package/script_helpers.d.ts +8 -2
- package/script_helpers.js +88 -16
- package/stores.d.ts +1 -1
- package/utils.d.ts +8 -6
- package/utils.js +57 -21
- 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/FlowInputs.svelte +0 -65
- 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 {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>import { ResourceService, ScriptService, VariableService } from '../gen';
|
|
2
2
|
import { getScriptByPath, loadHubScripts, sendUserToast } from '../utils';
|
|
3
|
-
import { faCode, faCube, faFile, faRotate, faRotateLeft } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
import Icon from 'svelte-awesome';
|
|
3
|
+
import { faCode, faCube, faDollarSign, faFile, faRotate, faRotateLeft, faWallet } from '@fortawesome/free-solid-svg-icons';
|
|
5
4
|
import { hubScripts, workspaceStore } from '../stores';
|
|
6
5
|
import { Highlight } from 'svelte-highlight';
|
|
7
6
|
import { python, typescript } from 'svelte-highlight/languages';
|
|
@@ -9,9 +8,12 @@ import ItemPicker from './ItemPicker.svelte';
|
|
|
9
8
|
import Modal from './Modal.svelte';
|
|
10
9
|
import ResourceEditor from './ResourceEditor.svelte';
|
|
11
10
|
import VariableEditor from './VariableEditor.svelte';
|
|
11
|
+
import Button from './common/button/Button.svelte';
|
|
12
12
|
export let lang;
|
|
13
13
|
export let editor;
|
|
14
14
|
export let websocketAlive;
|
|
15
|
+
export let iconOnly = false;
|
|
16
|
+
let contextualVariablePicker;
|
|
15
17
|
let variablePicker;
|
|
16
18
|
let resourcePicker;
|
|
17
19
|
let scriptPicker;
|
|
@@ -20,16 +22,24 @@ 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
|
-
|
|
25
|
-
const variables = (await VariableService.listVariable({ workspace: $workspaceStore ?? 'NO_W' })).map((x) => {
|
|
35
|
+
return (await VariableService.listVariable({ workspace: $workspaceStore ?? '' })).map((x) => {
|
|
26
36
|
return { name: x.path, ...x };
|
|
27
37
|
});
|
|
28
|
-
|
|
38
|
+
}
|
|
39
|
+
async function loadContextualVariables() {
|
|
40
|
+
return await VariableService.listContextualVariables({
|
|
29
41
|
workspace: $workspaceStore ?? 'NO_W'
|
|
30
42
|
});
|
|
31
|
-
r = r.concat(variables).concat(rvariables);
|
|
32
|
-
return r;
|
|
33
43
|
}
|
|
34
44
|
async function loadScripts() {
|
|
35
45
|
const workspaceScripts = await ScriptService.listScripts({
|
|
@@ -66,35 +76,41 @@ async function loadScripts() {
|
|
|
66
76
|
</div></Modal
|
|
67
77
|
>
|
|
68
78
|
|
|
79
|
+
<ItemPicker
|
|
80
|
+
bind:this={contextualVariablePicker}
|
|
81
|
+
pickCallback={(path, name) => {
|
|
82
|
+
if (lang == 'deno') {
|
|
83
|
+
editor.insertAtCursor(`Deno.env.get('${name}')`)
|
|
84
|
+
} else if (lang == 'python3') {
|
|
85
|
+
if (!editor.getCode().includes('import os')) {
|
|
86
|
+
editor.insertAtBeginning('import os\n')
|
|
87
|
+
}
|
|
88
|
+
editor.insertAtCursor(`os.environ.get("${name}")`)
|
|
89
|
+
}
|
|
90
|
+
sendUserToast(`${name} inserted at cursor`)
|
|
91
|
+
}}
|
|
92
|
+
itemName="Contextual Variable"
|
|
93
|
+
extraField="name"
|
|
94
|
+
loadItems={loadContextualVariables}
|
|
95
|
+
/>
|
|
96
|
+
|
|
69
97
|
<ItemPicker
|
|
70
98
|
bind:this={variablePicker}
|
|
71
99
|
pickCallback={(path, name) => {
|
|
72
|
-
if (
|
|
73
|
-
if (
|
|
74
|
-
editor.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
editor.insertAtBeginning('import os\n')
|
|
78
|
-
}
|
|
79
|
-
editor.insertAtCursor(`os.environ.get("${name}")`)
|
|
100
|
+
if (lang == 'deno') {
|
|
101
|
+
if (!editor.getCode().includes('import * as wmill from')) {
|
|
102
|
+
editor.insertAtBeginning(
|
|
103
|
+
`import * as wmill from 'https://deno.land/x/windmill@v${__pkg__.version}/mod.ts'\n`
|
|
104
|
+
)
|
|
80
105
|
}
|
|
81
|
-
|
|
82
|
-
} else {
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
editor.insertAtBeginning(
|
|
86
|
-
`import * as wmill from 'https://deno.land/x/windmill@v${__pkg__.version}/mod.ts'\n`
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
editor.insertAtCursor(`(await wmill.getVariable('${path}'))`)
|
|
90
|
-
} else {
|
|
91
|
-
if (!editor.getCode().includes('import wmill')) {
|
|
92
|
-
editor.insertAtBeginning('import wmill\n')
|
|
93
|
-
}
|
|
94
|
-
editor.insertAtCursor(`wmill.get_variable("${path}")`)
|
|
106
|
+
editor.insertAtCursor(`(await wmill.getVariable('${path}'))`)
|
|
107
|
+
} else if (lang == 'python3') {
|
|
108
|
+
if (!editor.getCode().includes('import wmill')) {
|
|
109
|
+
editor.insertAtBeginning('import wmill\n')
|
|
95
110
|
}
|
|
96
|
-
|
|
111
|
+
editor.insertAtCursor(`wmill.get_variable("${path}")`)
|
|
97
112
|
}
|
|
113
|
+
sendUserToast(`${name} inserted at cursor`)
|
|
98
114
|
}}
|
|
99
115
|
itemName="Variable"
|
|
100
116
|
extraField="name"
|
|
@@ -104,15 +120,16 @@ async function loadScripts() {
|
|
|
104
120
|
<div class="text-xs mr-2 align-middle">
|
|
105
121
|
The variable you were looking for does not exist yet?
|
|
106
122
|
</div>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
<Button
|
|
124
|
+
variant="border"
|
|
125
|
+
color="blue"
|
|
126
|
+
size="sm"
|
|
110
127
|
on:click={() => {
|
|
111
128
|
variableEditor.initNew()
|
|
112
129
|
}}
|
|
113
130
|
>
|
|
114
131
|
Create a new variable
|
|
115
|
-
</
|
|
132
|
+
</Button>
|
|
116
133
|
</div>
|
|
117
134
|
</ItemPicker>
|
|
118
135
|
|
|
@@ -126,7 +143,7 @@ async function loadScripts() {
|
|
|
126
143
|
)
|
|
127
144
|
}
|
|
128
145
|
editor.insertAtCursor(`(await wmill.getResource('${path}'))`)
|
|
129
|
-
} else {
|
|
146
|
+
} else if (lang == 'python3') {
|
|
130
147
|
if (!editor.getCode().includes('import wmill')) {
|
|
131
148
|
editor.insertAtBeginning('import wmill\n')
|
|
132
149
|
}
|
|
@@ -143,92 +160,112 @@ async function loadScripts() {
|
|
|
143
160
|
<div class="text-xs mr-2 align-middle">
|
|
144
161
|
The resource you were looking for does not exist yet?
|
|
145
162
|
</div>
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
<Button
|
|
164
|
+
variant="border"
|
|
165
|
+
color="blue"
|
|
166
|
+
size="sm"
|
|
149
167
|
on:click={() => {
|
|
150
168
|
resourceEditor.initNew()
|
|
151
169
|
}}
|
|
152
170
|
>
|
|
153
171
|
Create a new resource
|
|
154
|
-
</
|
|
172
|
+
</Button>
|
|
155
173
|
</div>
|
|
156
174
|
</ItemPicker>
|
|
157
175
|
|
|
158
176
|
<ResourceEditor bind:this={resourceEditor} on:refresh={resourcePicker.openModal} />
|
|
159
177
|
<VariableEditor bind:this={variableEditor} on:create={variablePicker.openModal} />
|
|
160
178
|
|
|
161
|
-
<div class="flex
|
|
162
|
-
<div>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
<div class="flex flex-row justify-between items-center overflow-hidden w-full">
|
|
180
|
+
<div class="flex flex-row divide-x items-center">
|
|
181
|
+
<div>
|
|
182
|
+
<Button
|
|
183
|
+
color="light"
|
|
184
|
+
btnClasses="mr-1"
|
|
185
|
+
on:click={contextualVariablePicker.openModal}
|
|
186
|
+
size="xs"
|
|
187
|
+
spacingSize="md"
|
|
188
|
+
startIcon={{ icon: faDollarSign }}
|
|
189
|
+
{iconOnly}
|
|
190
|
+
>
|
|
191
|
+
+Contextual Variable
|
|
192
|
+
</Button>
|
|
193
|
+
</div>
|
|
194
|
+
<div>
|
|
195
|
+
<Button
|
|
196
|
+
color="light"
|
|
197
|
+
btnClasses="mr-1"
|
|
198
|
+
on:click={variablePicker.openModal}
|
|
199
|
+
size="xs"
|
|
200
|
+
spacingSize="md"
|
|
201
|
+
startIcon={{ icon: faWallet }}
|
|
202
|
+
{iconOnly}
|
|
203
|
+
>
|
|
204
|
+
+Variable
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
<div>
|
|
208
|
+
<Button
|
|
209
|
+
btnClasses="mx-1"
|
|
210
|
+
size="xs"
|
|
211
|
+
spacingSize="md"
|
|
212
|
+
color="light"
|
|
213
|
+
on:click={resourcePicker.openModal}
|
|
214
|
+
{iconOnly}
|
|
215
|
+
startIcon={{ icon: faCube }}
|
|
216
|
+
>
|
|
217
|
+
+Resource
|
|
218
|
+
</Button>
|
|
219
|
+
</div>
|
|
186
220
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
221
|
+
<div>
|
|
222
|
+
<Button
|
|
223
|
+
btnClasses="mx-1"
|
|
224
|
+
size="xs"
|
|
225
|
+
spacingSize="md"
|
|
226
|
+
color="light"
|
|
227
|
+
on:click={scriptPicker.openModal}
|
|
228
|
+
{iconOnly}
|
|
229
|
+
startIcon={{ icon: faCode }}
|
|
230
|
+
>
|
|
231
|
+
View Script
|
|
232
|
+
</Button>
|
|
233
|
+
</div>
|
|
199
234
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
235
|
+
<div>
|
|
236
|
+
<Button
|
|
237
|
+
btnClasses="mx-1"
|
|
238
|
+
size="xs"
|
|
239
|
+
spacingSize="md"
|
|
240
|
+
color="light"
|
|
241
|
+
on:click={editor.clearContent}
|
|
242
|
+
{iconOnly}
|
|
243
|
+
startIcon={{ icon: faRotateLeft }}
|
|
244
|
+
>
|
|
245
|
+
Reset content
|
|
246
|
+
</Button>
|
|
247
|
+
</div>
|
|
211
248
|
</div>
|
|
212
249
|
<div>
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
250
|
+
<Button
|
|
251
|
+
btnClasses="ml-1"
|
|
252
|
+
size="xs"
|
|
253
|
+
spacingSize="md"
|
|
254
|
+
color="light"
|
|
255
|
+
on:click={editor.reloadWebsocket}
|
|
256
|
+
startIcon={{ icon: faRotate }}
|
|
219
257
|
>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
258
|
+
{#if !iconOnly}
|
|
259
|
+
Reload assistants
|
|
260
|
+
{/if}
|
|
223
261
|
<span class="ml-1">
|
|
224
262
|
{#if lang == 'deno'}
|
|
225
263
|
(<span class={websocketAlive.deno ? 'text-green-600' : 'text-red-700'}>Deno</span>)
|
|
226
264
|
{:else if lang == 'python3'}
|
|
227
265
|
(<span class={websocketAlive.pyright ? 'text-green-600' : 'text-red-700'}>Pyright</span>
|
|
228
|
-
|
|
229
266
|
<span class={websocketAlive.black ? 'text-green-600' : 'text-red-700'}>Black</span>)
|
|
230
267
|
{/if}
|
|
231
268
|
</span>
|
|
232
|
-
</
|
|
269
|
+
</Button>
|
|
233
270
|
</div>
|
|
234
271
|
</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 {
|
|
8
|
-
import { onDestroy, onMount } from 'svelte';
|
|
5
|
+
import { encodeState, formatCron, loadHubScripts, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
6
|
+
import { faGlobe, faPen } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { setContext } from 'svelte';
|
|
9
8
|
import Icon from 'svelte-awesome';
|
|
9
|
+
import { writable } from 'svelte/store';
|
|
10
|
+
import CenteredPage from './CenteredPage.svelte';
|
|
11
|
+
import Button from './common/button/Button.svelte';
|
|
12
|
+
import { dirtyStore } from './common/confirmationModal/dirtyStore';
|
|
13
|
+
import UnsavedConfirmationModal from './common/confirmationModal/UnsavedConfirmationModal.svelte';
|
|
10
14
|
import { OFFSET } from './CronInput.svelte';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import FlowPreviewContent from './FlowPreviewContent.svelte';
|
|
14
|
-
import { flowStateStore, flowStateToFlow } from './flows/flowState';
|
|
15
|
+
import FlowEditor from './flows/FlowEditor.svelte';
|
|
16
|
+
import { flowStateStore } from './flows/flowState';
|
|
15
17
|
import { flowStore } from './flows/flowStore';
|
|
18
|
+
import FlowImportExportMenu from './flows/header/FlowImportExportMenu.svelte';
|
|
19
|
+
import { loadFlowSchedule } from './flows/scheduleUtils';
|
|
16
20
|
import { cleanInputs } from './flows/utils';
|
|
17
|
-
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
|
-
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
26
23
|
async function createSchedule(path) {
|
|
24
|
+
const { cron, args, enabled } = $scheduleStore;
|
|
27
25
|
await ScheduleService.createSchedule({
|
|
28
26
|
workspace: $workspaceStore,
|
|
29
27
|
requestBody: {
|
|
30
28
|
path: path,
|
|
31
|
-
schedule: formatCron(
|
|
29
|
+
schedule: formatCron(cron),
|
|
32
30
|
offset: OFFSET,
|
|
33
31
|
script_path: path,
|
|
34
32
|
is_flow: true,
|
|
35
|
-
args
|
|
36
|
-
enabled
|
|
33
|
+
args,
|
|
34
|
+
enabled
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
async function saveFlow() {
|
|
41
|
-
const flow = cleanInputs(
|
|
39
|
+
const flow = cleanInputs($flowStore);
|
|
40
|
+
const { cron, args, enabled } = $scheduleStore;
|
|
41
|
+
$dirtyStore = false;
|
|
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
|
}
|
|
@@ -104,125 +104,106 @@ async function saveFlow() {
|
|
|
104
104
|
sendUserToast(`Success! flow saved at ${$flowStore.path}`);
|
|
105
105
|
goto(`/flows/get/${$flowStore.path}`);
|
|
106
106
|
}
|
|
107
|
-
async function changeStep(step) {
|
|
108
|
-
goto(`?step=${step}`);
|
|
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
107
|
flowStore.subscribe((flow) => {
|
|
121
108
|
if (flow) {
|
|
122
109
|
setQueryWithoutLoad($page.url, 'state', encodeState(flow));
|
|
123
110
|
}
|
|
124
111
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
112
|
+
const selectedIdStore = writable('settings');
|
|
113
|
+
const scheduleStore = writable({ args: {}, cron: '', enabled: false });
|
|
114
|
+
const previewArgsStore = writable({});
|
|
115
|
+
function select(selectedId) {
|
|
116
|
+
selectedIdStore.set(selectedId);
|
|
117
|
+
}
|
|
118
|
+
setContext('FlowEditorContext', {
|
|
119
|
+
selectedId: selectedIdStore,
|
|
120
|
+
schedule: scheduleStore,
|
|
121
|
+
select,
|
|
122
|
+
previewArgs: previewArgsStore
|
|
133
123
|
});
|
|
124
|
+
async function loadSchedule() {
|
|
125
|
+
loadFlowSchedule(initialPath, $workspaceStore)
|
|
126
|
+
.then((schedule) => {
|
|
127
|
+
scheduleStore.set(schedule);
|
|
128
|
+
})
|
|
129
|
+
.catch(() => {
|
|
130
|
+
scheduleStore.set({
|
|
131
|
+
cron: '0 */5 * * *',
|
|
132
|
+
args: {},
|
|
133
|
+
enabled: false
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
$: initialPath && $workspaceStore && loadSchedule();
|
|
138
|
+
loadHubScripts();
|
|
134
139
|
</script>
|
|
135
140
|
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</BreadcrumbItem>
|
|
151
|
-
</Breadcrumb>
|
|
152
|
-
<div class="flex flex-row-reverse ml-2">
|
|
153
|
-
{#if step == 1}
|
|
154
|
-
<button
|
|
155
|
-
disabled={pathError != ''}
|
|
156
|
-
class="default-button px-6 max-h-8"
|
|
157
|
-
on:click={() => changeStep(2)}
|
|
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>
|
|
141
|
+
<UnsavedConfirmationModal />
|
|
142
|
+
|
|
143
|
+
<div class="flex flex-col flex-1 h-full">
|
|
144
|
+
<!-- Nav between steps-->
|
|
145
|
+
<div class="justify-between flex flex-row w-full my-2 px-4 space-x-4 h-10">
|
|
146
|
+
<div id="flow_title" class="flex justify-between items-center">
|
|
147
|
+
<button class="flex flex-row items-center w-full h-full" on:click={() => select('settings')}>
|
|
148
|
+
<span class="font-mono text-sm"> {$flowStore.path}</span>
|
|
149
|
+
<Icon
|
|
150
|
+
data={faPen}
|
|
151
|
+
scale={0.8}
|
|
152
|
+
class="text-gray-500 ml-2 flex justify-center items-center mb-0.5"
|
|
153
|
+
/>
|
|
154
|
+
</button>
|
|
178
155
|
</div>
|
|
179
|
-
<div class="
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
|
|
156
|
+
<div class="shrink h-full">
|
|
157
|
+
<button
|
|
158
|
+
class="flex flex-row items-center w-full h-full"
|
|
159
|
+
on:click={() => {
|
|
160
|
+
select('settings')
|
|
161
|
+
document.getElementById('flow-summary')?.focus()
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
<div class="overflow-x-auto flex items-center h-full text-sm text-left font-semibold">
|
|
165
|
+
<div
|
|
166
|
+
>{$flowStore.summary == '' || !$flowStore.summary
|
|
167
|
+
? 'No summary'
|
|
168
|
+
: $flowStore.summary}</div
|
|
169
|
+
>
|
|
170
|
+
</div>
|
|
171
|
+
<div>
|
|
172
|
+
<Icon data={faPen} scale={0.8} class="text-gray-500 ml-1" />
|
|
173
|
+
</div>
|
|
174
|
+
</button>
|
|
184
175
|
</div>
|
|
176
|
+
<div class="flex flex-row-reverse ml-2 space-x-reverse space-x-2">
|
|
177
|
+
<Button disabled={pathError != ''} color="blue" size="sm" on:click={saveFlow}>Save</Button>
|
|
178
|
+
<FlowImportExportMenu />
|
|
185
179
|
|
|
186
|
-
|
|
180
|
+
<Button
|
|
181
|
+
color="light"
|
|
182
|
+
size="sm"
|
|
183
|
+
variant="border"
|
|
184
|
+
on:click={() => {
|
|
185
|
+
const url = new URL('https://hub.windmill.dev/flows/add')
|
|
186
|
+
const openFlow = {
|
|
187
|
+
value: $flowStore.value,
|
|
188
|
+
summary: $flowStore.summary,
|
|
189
|
+
description: $flowStore.description,
|
|
190
|
+
schema: $flowStore.schema
|
|
191
|
+
}
|
|
192
|
+
url.searchParams.append('flow', btoa(JSON.stringify(openFlow)))
|
|
193
|
+
window.open(url, '_blank')?.focus()
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<Icon data={faGlobe} scale={0.8} class="inline mr-2" />
|
|
197
|
+
Publish to Hub
|
|
198
|
+
</Button>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
187
201
|
|
|
188
|
-
|
|
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
|
-
<Button
|
|
199
|
-
disabled={pathIsEmpty($flowStore.path)}
|
|
200
|
-
size="lg"
|
|
201
|
-
pill
|
|
202
|
-
on:click={() => (previewOpen = !previewOpen)}
|
|
203
|
-
class={`blue-button fixed bottom-10 right-10 ${previewOpen ? 'hidden' : ''}`}
|
|
204
|
-
>
|
|
205
|
-
Preview flow
|
|
206
|
-
{pathIsEmpty($flowStore.path) ? '(pick a name first!)' : ''}
|
|
202
|
+
<!-- metadata -->
|
|
207
203
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
bind:summary={$flowStore.summary}
|
|
214
|
-
bind:description={$flowStore.description}
|
|
215
|
-
bind:schema={$flowStore.schema}
|
|
216
|
-
/>
|
|
217
|
-
{/if}
|
|
218
|
-
{:else}
|
|
219
|
-
<p>Loading</p>
|
|
220
|
-
{/if}
|
|
221
|
-
</div>
|
|
204
|
+
{#if $flowStateStore}
|
|
205
|
+
<FlowEditor {initialPath} />
|
|
206
|
+
{:else}
|
|
207
|
+
<CenteredPage>Loading...</CenteredPage>
|
|
208
|
+
{/if}
|
|
222
209
|
</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}
|