windmill-components 1.28.6 → 1.28.7
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 +3 -0
- package/components/Editor.svelte +27 -19
- package/components/FlowBuilder.svelte +3 -1
- package/components/FlowEditor.svelte +8 -5
- package/components/FlowEditor.svelte.d.ts +1 -0
- package/components/FlowPreview.svelte +1 -2
- package/components/FlowPreview.svelte.d.ts +0 -2
- package/components/FlowViewer.svelte +2 -1
- package/components/ModuleStep.svelte +4 -6
- package/components/ModuleStep.svelte.d.ts +0 -2
- package/components/flows/FlowInputs.svelte +18 -4
- package/components/flows/FlowSettings.svelte +11 -2
- package/components/flows/FlowSettings.svelte.d.ts +1 -0
- package/package.json +1 -1
|
@@ -271,6 +271,9 @@ $: inputCat = computeInputCat(type, format, itemsType?.type, enum_, contentEncod
|
|
|
271
271
|
lang="sql"
|
|
272
272
|
bind:code={value}
|
|
273
273
|
class="two-lines-editor"
|
|
274
|
+
on:change={async () => {
|
|
275
|
+
dispatch('input', { rawValue: value, isRaw: false })
|
|
276
|
+
}}
|
|
274
277
|
/>
|
|
275
278
|
</div>
|
|
276
279
|
{:else if inputCat == 'base64'}
|
package/components/Editor.svelte
CHANGED
|
@@ -130,6 +130,8 @@ function format() {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
let command = undefined;
|
|
134
|
+
let monacoServices = undefined;
|
|
133
135
|
export async function reloadWebsocket() {
|
|
134
136
|
await closeWebsockets();
|
|
135
137
|
if (lang == 'python' || deno) {
|
|
@@ -138,8 +140,9 @@ export async function reloadWebsocket() {
|
|
|
138
140
|
const { toSocket, WebSocketMessageReader, WebSocketMessageWriter } = await import('vscode-ws-jsonrpc');
|
|
139
141
|
const vscode = await import('vscode');
|
|
140
142
|
const { RequestType } = await import('vscode-jsonrpc');
|
|
143
|
+
// install Monaco language client services
|
|
141
144
|
const { MonacoServices } = await import('monaco-languageclient');
|
|
142
|
-
MonacoServices.install();
|
|
145
|
+
monacoServices = MonacoServices.install();
|
|
143
146
|
function createLanguageClient(transports, name, initializationOptions) {
|
|
144
147
|
const client = new MonacoLanguageClient({
|
|
145
148
|
name: name,
|
|
@@ -199,24 +202,24 @@ export async function reloadWebsocket() {
|
|
|
199
202
|
websocketAlive[name] = false;
|
|
200
203
|
});
|
|
201
204
|
try {
|
|
205
|
+
console.log('started client');
|
|
202
206
|
await languageClient.start();
|
|
203
207
|
}
|
|
204
208
|
catch (err) {
|
|
209
|
+
console.log('err at client');
|
|
205
210
|
console.error(err);
|
|
206
211
|
throw new Error(err);
|
|
207
212
|
}
|
|
208
213
|
lastWsAttempt = new Date();
|
|
209
214
|
nbWsAttempt = 0;
|
|
210
215
|
if (name == 'deno') {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
});
|
|
219
|
-
}
|
|
216
|
+
command && command.dispose();
|
|
217
|
+
command = undefined;
|
|
218
|
+
command = vscode.commands.registerCommand('deno.cache', (uris = []) => {
|
|
219
|
+
languageClient.sendRequest(new RequestType('deno/cache'), {
|
|
220
|
+
referrer: { uri },
|
|
221
|
+
uris: uris.map((uri) => ({ uri }))
|
|
222
|
+
});
|
|
220
223
|
});
|
|
221
224
|
}
|
|
222
225
|
websocketAlive[name] = true;
|
|
@@ -304,12 +307,20 @@ export async function reloadWebsocket() {
|
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
async function closeWebsockets() {
|
|
310
|
+
command && command.dispose();
|
|
311
|
+
command = undefined;
|
|
312
|
+
monacoServices && monacoServices.dispose();
|
|
313
|
+
monacoServices = undefined;
|
|
307
314
|
for (const x of websockets) {
|
|
308
315
|
try {
|
|
309
316
|
await x[0].stop();
|
|
310
317
|
x[1].close();
|
|
311
318
|
}
|
|
312
319
|
catch (err) {
|
|
320
|
+
try {
|
|
321
|
+
x[1].close();
|
|
322
|
+
}
|
|
323
|
+
catch (err) { }
|
|
313
324
|
console.log('error disposing websocket', err);
|
|
314
325
|
}
|
|
315
326
|
}
|
|
@@ -396,18 +407,15 @@ async function loadMonaco() {
|
|
|
396
407
|
}
|
|
397
408
|
}
|
|
398
409
|
if (lang == 'python' || deno) {
|
|
399
|
-
// install Monaco language client services
|
|
400
410
|
reloadWebsocket();
|
|
401
411
|
}
|
|
402
412
|
return () => {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
console.log('error disposing editor', err);
|
|
410
|
-
}
|
|
413
|
+
try {
|
|
414
|
+
closeWebsockets();
|
|
415
|
+
editor && editor.dispose();
|
|
416
|
+
}
|
|
417
|
+
catch (err) {
|
|
418
|
+
console.log('error disposing editor', err);
|
|
411
419
|
}
|
|
412
420
|
};
|
|
413
421
|
}
|
|
@@ -16,6 +16,7 @@ import ScriptSchema from './ScriptSchema.svelte';
|
|
|
16
16
|
export let initialPath = '';
|
|
17
17
|
let pathError = '';
|
|
18
18
|
let scheduleArgs;
|
|
19
|
+
let previewArgs;
|
|
19
20
|
let scheduleEnabled;
|
|
20
21
|
let scheduleCron;
|
|
21
22
|
let previewOpen = false;
|
|
@@ -176,6 +177,7 @@ onDestroy(() => {
|
|
|
176
177
|
bind:scheduleEnabled
|
|
177
178
|
bind:scheduleCron
|
|
178
179
|
bind:scheduleArgs
|
|
180
|
+
bind:previewArgs
|
|
179
181
|
/>
|
|
180
182
|
<Button
|
|
181
183
|
disabled={pathIsEmpty($flowStore.path)}
|
|
@@ -207,7 +209,7 @@ onDestroy(() => {
|
|
|
207
209
|
{#if $flowStore && step === 1}
|
|
208
210
|
<div class="fixed border-l-2 right-0 h-screen w-1/2 sm:w-1/3">
|
|
209
211
|
<FlowPreviewContent
|
|
210
|
-
bind:args={
|
|
212
|
+
bind:args={previewArgs}
|
|
211
213
|
on:close={() => (previewOpen = !previewOpen)}
|
|
212
214
|
on:change={(e) => {
|
|
213
215
|
previewResults.set(jobsToResults(e.detail))
|
|
@@ -14,6 +14,7 @@ export let initialPath = '';
|
|
|
14
14
|
export let scheduleArgs = {};
|
|
15
15
|
export let scheduleEnabled = false;
|
|
16
16
|
export let scheduleCron = '0 */5 * * *';
|
|
17
|
+
export let previewArgs = {};
|
|
17
18
|
let scheduleLoaded = false;
|
|
18
19
|
async function loadSchedule() {
|
|
19
20
|
if (!scheduleLoaded) {
|
|
@@ -30,6 +31,7 @@ async function loadSchedule() {
|
|
|
30
31
|
scheduleEnabled = schedule.enabled;
|
|
31
32
|
scheduleCron = schedule.schedule;
|
|
32
33
|
scheduleArgs = schedule.args ?? {};
|
|
34
|
+
previewArgs = JSON.parse(JSON.stringify(scheduleArgs));
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -37,7 +39,6 @@ $: if ($flowStore && $workspaceStore && initialPath != '') {
|
|
|
37
39
|
loadSchedule();
|
|
38
40
|
}
|
|
39
41
|
let open = 0;
|
|
40
|
-
let args = {};
|
|
41
42
|
</script>
|
|
42
43
|
|
|
43
44
|
{#if $flowStore}
|
|
@@ -46,19 +47,21 @@ let args = {};
|
|
|
46
47
|
bind:pathError
|
|
47
48
|
bind:initialPath
|
|
48
49
|
bind:scheduleArgs
|
|
50
|
+
{previewArgs}
|
|
49
51
|
bind:scheduleCron
|
|
50
52
|
bind:scheduleEnabled
|
|
51
53
|
bind:open
|
|
52
54
|
/>
|
|
53
55
|
<FlowInput />
|
|
54
56
|
{#each $flowStore?.value.modules as mod, i}
|
|
55
|
-
<ModuleStep bind:open bind:mod bind:args
|
|
57
|
+
<ModuleStep bind:open bind:mod bind:args={previewArgs} {i} />
|
|
56
58
|
{#if i == 0 && $mode == 'pull'}
|
|
57
59
|
<div class="flex justify-center bg-white shadow p-2">
|
|
58
60
|
<p>
|
|
59
|
-
Starting from here, the flow for loop over items from the
|
|
60
|
-
<br />
|
|
61
|
-
|
|
61
|
+
Starting from here, the flow for loop over items from the 1st step's result right above.
|
|
62
|
+
<br />For-loops insertable at other points is not supported yet but coming soon
|
|
63
|
+
(See
|
|
64
|
+
<a href="https://github.com/windmill-labs/windmill/issues/350">#350</a>.)
|
|
62
65
|
</p>
|
|
63
66
|
<Tooltip>
|
|
64
67
|
This flow being in 'Pull' mode, the rest of the flow will for loop over the list of
|
|
@@ -5,7 +5,7 @@ import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
|
5
5
|
import { createEventDispatcher, onDestroy } from 'svelte';
|
|
6
6
|
import Icon from 'svelte-awesome';
|
|
7
7
|
import FlowJobResult from './FlowJobResult.svelte';
|
|
8
|
-
import {
|
|
8
|
+
import { runFlowPreview } from './flows/utils';
|
|
9
9
|
import FlowStatusViewer from './FlowStatusViewer.svelte';
|
|
10
10
|
import RunForm from './RunForm.svelte';
|
|
11
11
|
import Tabs from './Tabs.svelte';
|
|
@@ -13,7 +13,6 @@ const dispatch = createEventDispatcher();
|
|
|
13
13
|
export let i;
|
|
14
14
|
export let flow;
|
|
15
15
|
export let schemas = [];
|
|
16
|
-
export let mode;
|
|
17
16
|
export let args = {};
|
|
18
17
|
let stepArgs = {};
|
|
19
18
|
let tab = 'upto';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Schema } from '../common';
|
|
3
3
|
import { type Flow } from '../gen';
|
|
4
|
-
import type { FlowMode } from './flows/flowStore';
|
|
5
4
|
declare const __propDef: {
|
|
6
5
|
props: {
|
|
7
6
|
i: number;
|
|
8
7
|
flow: Flow;
|
|
9
8
|
schemas?: Schema[] | undefined;
|
|
10
|
-
mode: FlowMode;
|
|
11
9
|
args?: Record<string, any> | undefined;
|
|
12
10
|
runPreview?: ((args: any) => Promise<void>) | undefined;
|
|
13
11
|
};
|
|
@@ -41,7 +41,7 @@ function toAny(x) {
|
|
|
41
41
|
{#if tab == 'ui'}
|
|
42
42
|
<div class="flow-root w-full pb-4">
|
|
43
43
|
{#if !embedded}
|
|
44
|
-
<h2 class="
|
|
44
|
+
<h2 class="my-4">{flow.summary}</h2>
|
|
45
45
|
<SvelteMarkdown source={flow.description ?? ''} />
|
|
46
46
|
|
|
47
47
|
<p class="font-black text-lg w-full my-4">
|
|
@@ -175,5 +175,6 @@ function toAny(x) {
|
|
|
175
175
|
<Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
|
|
176
176
|
</div>
|
|
177
177
|
{:else if tab == 'schema'}
|
|
178
|
+
<div class="my-4" />
|
|
178
179
|
<SchemaViewer schema={flow.schema} />
|
|
179
180
|
{/if}
|
|
@@ -9,12 +9,11 @@ import FlowPreview from './FlowPreview.svelte';
|
|
|
9
9
|
import FlowBox from './flows/FlowBox.svelte';
|
|
10
10
|
import FlowInputs from './flows/FlowInputs.svelte';
|
|
11
11
|
import FlowModuleHeader from './flows/FlowModuleHeader.svelte';
|
|
12
|
-
import { addModule, createInlineScriptModule, flowStore, loadSchema, pickScript, schemasStore } from './flows/flowStore';
|
|
12
|
+
import { addModule, createInlineScriptModule, flowStore, loadSchema, mode, pickScript, schemasStore } from './flows/flowStore';
|
|
13
13
|
import { getPickableProperties, jobsToResults } from './flows/utils';
|
|
14
14
|
import SchemaForm from './SchemaForm.svelte';
|
|
15
15
|
import Tooltip from './Tooltip.svelte';
|
|
16
16
|
export let open;
|
|
17
|
-
export let mode;
|
|
18
17
|
export let i;
|
|
19
18
|
export let mod;
|
|
20
19
|
export let args = {};
|
|
@@ -24,9 +23,9 @@ let pickableProperties = undefined;
|
|
|
24
23
|
let bigEditor = false;
|
|
25
24
|
$: schema = $schemasStore[i];
|
|
26
25
|
$: shouldPick = 'path' in mod.value && mod.value.path === '' && !('language' in mod.value);
|
|
27
|
-
$: pickableProperties = getPickableProperties($flowStore?.schema, args, $previewResults, mode, i);
|
|
26
|
+
$: pickableProperties = getPickableProperties($flowStore?.schema, args, $previewResults, $mode, i);
|
|
28
27
|
$: extraLib = buildExtraLib(schemaToTsType($flowStore?.schema), i === 0 ? schemaToTsType($flowStore?.schema) : objectToTsType($previewResults[i]));
|
|
29
|
-
const isTrigger = mode === 'pull' && i === 0;
|
|
28
|
+
const isTrigger = $mode === 'pull' && i === 0;
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
31
|
<button
|
|
@@ -75,7 +74,7 @@ const isTrigger = mode === 'pull' && i === 0;
|
|
|
75
74
|
<FlowInputs
|
|
76
75
|
{isTrigger}
|
|
77
76
|
on:pick={(e) => pickScript(e.detail.path, i)}
|
|
78
|
-
on:new={(e) => createInlineScriptModule(e.detail.language, i, mode)}
|
|
77
|
+
on:new={(e) => createInlineScriptModule(e.detail.language, i, $mode)}
|
|
79
78
|
/>
|
|
80
79
|
{/if}
|
|
81
80
|
{#if mod.value.type === 'rawscript'}
|
|
@@ -127,7 +126,6 @@ const isTrigger = mode === 'pull' && i === 0;
|
|
|
127
126
|
bind:args
|
|
128
127
|
flow={$flowStore}
|
|
129
128
|
{i}
|
|
130
|
-
{mode}
|
|
131
129
|
schemas={$schemasStore}
|
|
132
130
|
on:change={(e) => {
|
|
133
131
|
previewResults.set(jobsToResults(e.detail))
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import { type FlowModule } from '../gen';
|
|
3
|
-
import { type FlowMode } from './flows/flowStore';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
6
5
|
open: number;
|
|
7
|
-
mode: FlowMode;
|
|
8
6
|
i: number;
|
|
9
7
|
mod: FlowModule;
|
|
10
8
|
args?: Record<string, any> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { RawScript } from '../../gen';
|
|
2
|
-
import { faCode } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { faCode, faRepeat } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { createEventDispatcher } from 'svelte';
|
|
4
4
|
import FlowScriptPicker from './pickers/FlowScriptPicker.svelte';
|
|
5
5
|
import PickHubScript from './pickers/PickHubScript.svelte';
|
|
@@ -12,20 +12,34 @@ const dispatch = createEventDispatcher();
|
|
|
12
12
|
<PickScript {isTrigger} on:pick />
|
|
13
13
|
<PickHubScript {isTrigger} on:pick />
|
|
14
14
|
<FlowScriptPicker
|
|
15
|
-
label=
|
|
15
|
+
label={`Create a for-loop here (coming soon)`}
|
|
16
|
+
disabled={true}
|
|
17
|
+
icon={faRepeat}
|
|
18
|
+
iconColor="text-blue-500"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<FlowScriptPicker
|
|
22
|
+
label={`New Postgres SQL query`}
|
|
16
23
|
icon={faCode}
|
|
17
24
|
iconColor="text-blue-800"
|
|
18
|
-
on:click={() => dispatch('
|
|
25
|
+
on:click={() => dispatch('pick', { path: 'hub/130/execute_custom_query_postgresql' })}
|
|
19
26
|
/>
|
|
20
27
|
|
|
21
28
|
<FlowScriptPicker
|
|
22
29
|
disabled={isTrigger}
|
|
23
30
|
label="New Python {isTrigger ? 'trigger ' : ''}script (3.10)"
|
|
24
31
|
icon={faCode}
|
|
25
|
-
iconColor="text-
|
|
32
|
+
iconColor="text-green-500"
|
|
26
33
|
on:click={() => dispatch('new', { language: RawScript.language.PYTHON3 })}
|
|
27
34
|
tooltip={isTrigger
|
|
28
35
|
? 'Python is not supported for trigger scripts yet but is supported for every other steps'
|
|
29
36
|
: undefined}
|
|
30
37
|
/>
|
|
38
|
+
|
|
39
|
+
<FlowScriptPicker
|
|
40
|
+
label="New Typescript {isTrigger ? 'trigger ' : ''}script (Deno)"
|
|
41
|
+
icon={faCode}
|
|
42
|
+
iconColor="text-blue-800"
|
|
43
|
+
on:click={() => dispatch('new', { language: RawScript.language.DENO })}
|
|
44
|
+
/>
|
|
31
45
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { sendUserToast } from '../../utils';
|
|
2
2
|
import { faFileExport, faFileImport, faGlobe } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import { Dropdown, DropdownItem } from 'flowbite-svelte';
|
|
3
|
+
import { Button, Dropdown, DropdownItem } from 'flowbite-svelte';
|
|
4
4
|
import Icon from 'svelte-awesome';
|
|
5
5
|
import Editor from '../Editor.svelte';
|
|
6
6
|
import FlowViewer from '../FlowViewer.svelte';
|
|
@@ -19,6 +19,7 @@ import Tooltip from './../Tooltip.svelte';
|
|
|
19
19
|
import FlowBoxHeader from './FlowBoxHeader.svelte';
|
|
20
20
|
export let pathError = '';
|
|
21
21
|
export let initialPath = '';
|
|
22
|
+
export let previewArgs = {};
|
|
22
23
|
export let scheduleArgs = {};
|
|
23
24
|
export let scheduleEnabled = false;
|
|
24
25
|
export let scheduleCron = '0 */5 * * *';
|
|
@@ -167,7 +168,15 @@ let jsonValue = '';
|
|
|
167
168
|
{/if}
|
|
168
169
|
<CronInput bind:schedule={scheduleCron} />
|
|
169
170
|
</div>
|
|
170
|
-
|
|
171
|
+
<div class="flex flex-row-reverse">
|
|
172
|
+
<Button
|
|
173
|
+
color="alternative"
|
|
174
|
+
size="sm"
|
|
175
|
+
on:click={() => (scheduleArgs = JSON.parse(JSON.stringify(previewArgs)))}
|
|
176
|
+
>
|
|
177
|
+
Copy from preview arguments
|
|
178
|
+
</Button>
|
|
179
|
+
</div>
|
|
171
180
|
<SchemaForm schema={$flowStore.schema} bind:args={scheduleArgs} />
|
|
172
181
|
</CollapseLink>
|
|
173
182
|
{/if}
|
|
@@ -3,6 +3,7 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
pathError?: string | undefined;
|
|
5
5
|
initialPath?: string | undefined;
|
|
6
|
+
previewArgs?: Record<string, any> | undefined;
|
|
6
7
|
scheduleArgs?: Record<string, any> | undefined;
|
|
7
8
|
scheduleEnabled?: boolean | undefined;
|
|
8
9
|
scheduleCron?: string | undefined;
|