windmill-components 1.406.6 → 1.407.2
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/package/components/flows/content/FlowInputsQuick.svelte +1 -1
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +39 -14
- package/package/components/flows/pickers/WorkspaceScriptPickerQuick.svelte +2 -2
- package/package/components/graph/renderers/edges/BaseEdge.svelte +4 -3
- package/package.json +1 -1
|
@@ -54,20 +54,25 @@ async function insertNewModuleAtIndex(modules, index, kind, wsScript, wsFlow, in
|
|
|
54
54
|
[module, state] = await createBranchAll(module.id);
|
|
55
55
|
}
|
|
56
56
|
$flowStateStore[module.id] = state;
|
|
57
|
-
if (kind == 'trigger') {
|
|
58
|
-
module.summary = 'Trigger';
|
|
59
|
-
}
|
|
60
|
-
else if (kind == 'approval') {
|
|
61
|
-
module.summary = 'Approval';
|
|
62
|
-
}
|
|
63
|
-
else if (kind == 'end') {
|
|
64
|
-
module.summary = 'Terminate flow';
|
|
65
|
-
module.stop_after_if = { skip_if_stopped: false, expr: 'true' };
|
|
66
|
-
}
|
|
67
57
|
if (inlineScript) {
|
|
68
58
|
const { language, kind, subkind } = inlineScript;
|
|
69
59
|
[module, state] = await createInlineScriptModule(language, kind, subkind, module.id, module.summary);
|
|
70
60
|
$flowStateStore[module.id] = state;
|
|
61
|
+
if (kind == 'trigger') {
|
|
62
|
+
module.summary = 'Trigger';
|
|
63
|
+
}
|
|
64
|
+
else if (kind == 'approval') {
|
|
65
|
+
module.summary = 'Approval';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (kind == 'approval') {
|
|
69
|
+
module.suspend = { required_events: 1 };
|
|
70
|
+
}
|
|
71
|
+
else if (kind == 'trigger') {
|
|
72
|
+
module.stop_after_if = {
|
|
73
|
+
expr: '!result || (Array.isArray(result) && result.length == 0)',
|
|
74
|
+
skip_if_stopped: true
|
|
75
|
+
};
|
|
71
76
|
}
|
|
72
77
|
if (!modules)
|
|
73
78
|
return [module];
|
|
@@ -180,6 +185,12 @@ async function updateFlowInputsStore() {
|
|
|
180
185
|
};
|
|
181
186
|
}
|
|
182
187
|
}
|
|
188
|
+
function setExpr(module, expr) {
|
|
189
|
+
if (module.value.type == 'forloopflow') {
|
|
190
|
+
module.value.iterator = { type: 'javascript', expr };
|
|
191
|
+
module.value.parallel = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
183
194
|
</script>
|
|
184
195
|
|
|
185
196
|
<Portal name="flow-module">
|
|
@@ -275,7 +286,7 @@ async function updateFlowInputsStore() {
|
|
|
275
286
|
} else if (shouldRunTutorial('branchall', detail.detail, 3)) {
|
|
276
287
|
flowTutorials?.runTutorialById('branchall')
|
|
277
288
|
} else {
|
|
278
|
-
if (detail.modules) {
|
|
289
|
+
if (detail.modules && Array.isArray(detail.modules)) {
|
|
279
290
|
await tick()
|
|
280
291
|
if ($moving) {
|
|
281
292
|
push(history, $flowStore)
|
|
@@ -289,19 +300,33 @@ async function updateFlowInputsStore() {
|
|
|
289
300
|
insertNewPreprocessorModule(detail.inlineScript, detail.script)
|
|
290
301
|
$selectedId = 'preprocessor'
|
|
291
302
|
} else {
|
|
303
|
+
const index = detail.index ?? 0
|
|
292
304
|
await insertNewModuleAtIndex(
|
|
293
305
|
detail.modules,
|
|
294
|
-
|
|
306
|
+
index,
|
|
295
307
|
detail.kind,
|
|
296
308
|
detail.script,
|
|
297
309
|
detail.flow,
|
|
298
310
|
detail.inlineScript
|
|
299
311
|
)
|
|
300
|
-
|
|
312
|
+
const id = detail.modules[detail.index ?? 0].id
|
|
313
|
+
$selectedId = id
|
|
314
|
+
|
|
315
|
+
if (detail.kind == 'trigger') {
|
|
316
|
+
await insertNewModuleAtIndex(
|
|
317
|
+
detail.modules,
|
|
318
|
+
index + 1,
|
|
319
|
+
'forloop',
|
|
320
|
+
undefined,
|
|
321
|
+
undefined,
|
|
322
|
+
undefined
|
|
323
|
+
)
|
|
324
|
+
setExpr(detail.modules[index + 1], `results.${id}`)
|
|
325
|
+
}
|
|
301
326
|
}
|
|
302
327
|
}
|
|
303
328
|
|
|
304
|
-
if (['branchone', 'branchall'].includes(detail.
|
|
329
|
+
if (['branchone', 'branchall'].includes(detail.kind)) {
|
|
305
330
|
await addBranch(detail.modules[detail.index ?? 0])
|
|
306
331
|
}
|
|
307
332
|
$flowStateStore = $flowStateStore
|
|
@@ -58,7 +58,7 @@ function onKeyDown(e) {
|
|
|
58
58
|
dispatch('pickFlow', { path: item.path });
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
dispatch('pickScript', { path: item.path, hash: lockHash ? item.hash : undefined });
|
|
61
|
+
dispatch('pickScript', { path: item.path, hash: lockHash ? item.hash : undefined, kind });
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -90,7 +90,7 @@ function onKeyDown(e) {
|
|
|
90
90
|
if (kind == 'flow') {
|
|
91
91
|
dispatch('pickFlow', { path: path })
|
|
92
92
|
} else {
|
|
93
|
-
dispatch('pickScript', { path: path, hash: lockHash ? hash : undefined })
|
|
93
|
+
dispatch('pickScript', { path: path, hash: lockHash ? hash : undefined, kind })
|
|
94
94
|
}
|
|
95
95
|
}}
|
|
96
96
|
>
|
|
@@ -40,7 +40,6 @@ const { useDataflow } = getContext('FlowGraphContext');
|
|
|
40
40
|
allowTrigger={data.enableTrigger}
|
|
41
41
|
modules={data?.modules ?? []}
|
|
42
42
|
on:new={(e) => {
|
|
43
|
-
// console.log('new', e)
|
|
44
43
|
data?.eventHandlers.insert({
|
|
45
44
|
modules: data.modules,
|
|
46
45
|
index: data.index,
|
|
@@ -53,7 +52,8 @@ const { useDataflow } = getContext('FlowGraphContext');
|
|
|
53
52
|
data?.eventHandlers.insert({
|
|
54
53
|
modules: data.modules,
|
|
55
54
|
index: data.index,
|
|
56
|
-
script: e.detail
|
|
55
|
+
script: e.detail,
|
|
56
|
+
kind: e.detail.kind
|
|
57
57
|
})
|
|
58
58
|
}}
|
|
59
59
|
on:pickFlow={(e) => {
|
|
@@ -87,7 +87,8 @@ const { useDataflow } = getContext('FlowGraphContext');
|
|
|
87
87
|
data?.eventHandlers.insert({
|
|
88
88
|
modules: data.modules,
|
|
89
89
|
index: data.index,
|
|
90
|
-
script: e.detail
|
|
90
|
+
script: e.detail,
|
|
91
|
+
kind: e.detail.kind
|
|
91
92
|
})
|
|
92
93
|
}}
|
|
93
94
|
on:pickFlow={(e) => {
|