windmill-components 1.28.7 → 1.34.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/common.d.ts +3 -0
- package/components/AppConnect.svelte +28 -12
- package/components/ArgInput.svelte +25 -14
- package/components/ArgInput.svelte.d.ts +4 -0
- package/components/CenteredPage.svelte +1 -1
- package/components/DisplayResult.svelte +3 -3
- package/components/Drawer.svelte +108 -0
- package/components/Drawer.svelte.d.ts +23 -0
- package/components/Editor.svelte +70 -78
- package/components/Editor.svelte.d.ts +3 -0
- package/components/EditorBar.svelte +23 -10
- package/components/FlowBuilder.svelte +39 -33
- package/components/FlowEditor.svelte +17 -58
- package/components/FlowJobResult.svelte +18 -17
- package/components/FlowPreview.svelte +13 -34
- package/components/FlowPreview.svelte.d.ts +2 -4
- package/components/FlowPreviewContent.svelte +56 -44
- package/components/FlowPreviewContent.svelte.d.ts +0 -1
- package/components/FlowStatusViewer.svelte +123 -205
- package/components/FlowStatusViewer.svelte.d.ts +7 -4
- package/components/FlowViewer.svelte +4 -1
- package/components/IconedPath.svelte +12 -0
- package/components/IconedPath.svelte.d.ts +16 -0
- package/components/IconedResourceType.svelte +21 -2
- package/components/IconedResourceType.svelte.d.ts +1 -0
- package/components/InputTransformForm.svelte +9 -8
- package/components/InputTransformForm.svelte.d.ts +1 -1
- package/components/InviteGlobalUser.svelte +1 -1
- package/components/ItemPicker.svelte +6 -1
- package/components/JobStatus.svelte +1 -1
- package/components/ModuleStep.svelte +73 -93
- package/components/ModuleStep.svelte.d.ts +7 -2
- package/components/Path.svelte +62 -40
- package/components/Path.svelte.d.ts +2 -0
- package/components/ProgressBar.svelte +31 -0
- package/components/ProgressBar.svelte.d.ts +17 -0
- package/components/ProgressBarPart.svelte +20 -0
- package/components/ProgressBarPart.svelte.d.ts +20 -0
- package/components/ResourceEditor.svelte +2 -1
- package/components/ResourcePicker.svelte +9 -0
- package/components/SchemaForm.svelte +9 -4
- package/components/SchemaForm.svelte.d.ts +1 -1
- package/components/SchemaModal.svelte +20 -3
- package/components/ScriptBuilder.svelte +58 -21
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/ScriptEditor.svelte +4 -2
- package/components/SharedBadge.svelte +8 -3
- package/components/VariableEditor.svelte +1 -1
- package/components/flows/CopyFirstStepSchema.svelte +4 -3
- package/components/flows/DynamicInputHelpBox.svelte +6 -4
- package/components/flows/DynamicInputHelpBox.svelte.d.ts +1 -1
- package/components/flows/FlowBox.svelte +15 -2
- package/components/flows/FlowBox.svelte.d.ts +14 -14
- package/components/flows/FlowBoxHeader.svelte +10 -3
- package/components/flows/FlowBoxHeader.svelte.d.ts +3 -0
- package/components/flows/FlowInput.svelte +14 -12
- package/components/flows/FlowInputs.svelte +55 -35
- package/components/flows/FlowInputs.svelte.d.ts +3 -1
- package/components/flows/FlowModuleHeader.svelte +71 -55
- package/components/flows/FlowModuleHeader.svelte.d.ts +6 -6
- package/components/flows/FlowSettings.svelte +34 -57
- package/components/flows/FlowSettings.svelte.d.ts +0 -1
- package/components/flows/FlowTimeline.svelte +169 -0
- package/components/flows/FlowTimeline.svelte.d.ts +21 -0
- package/components/flows/flowState.d.ts +14 -0
- package/components/flows/flowState.js +52 -0
- package/components/flows/flowStateUtils.d.ts +37 -0
- package/components/flows/flowStateUtils.js +222 -0
- package/components/flows/flowStore.d.ts +1 -16
- package/components/flows/flowStore.js +7 -208
- package/components/flows/pickers/FlowScriptPicker.svelte +5 -9
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +0 -1
- package/components/flows/pickers/PickHubScript.svelte +1 -1
- package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -1
- package/components/flows/pickers/PickScript.svelte +1 -1
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
- package/components/flows/scheduleUtils.d.ts +7 -0
- package/components/flows/scheduleUtils.js +21 -0
- package/components/flows/stepOpenedStore.d.ts +1 -0
- package/components/flows/stepOpenedStore.js +6 -0
- package/components/flows/utils.d.ts +5 -12
- package/components/flows/utils.js +40 -112
- package/components/icons/DiscordIcon.svelte +16 -0
- package/components/icons/DiscordIcon.svelte.d.ts +17 -0
- package/components/icons/HttpIcon.svelte +21 -0
- package/components/icons/HttpIcon.svelte.d.ts +17 -0
- package/components/icons/MastodonIcon.svelte +16 -0
- package/components/icons/MastodonIcon.svelte.d.ts +17 -0
- package/components/icons/MatrixIcon.svelte +16 -0
- package/components/icons/MatrixIcon.svelte.d.ts +17 -0
- package/components/icons/S3Icon.svelte +16 -0
- package/components/icons/S3Icon.svelte.d.ts +17 -0
- package/components/icons/WindmillIcon.svelte +68 -0
- package/components/icons/WindmillIcon.svelte.d.ts +17 -0
- package/components/preview/FlowPreviewStatus.svelte +28 -0
- package/components/preview/FlowPreviewStatus.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +13 -13
- package/components/propertyPicker/utils.js +3 -2
- package/components/tabs/Tab.svelte +12 -0
- package/components/tabs/Tab.svelte.d.ts +19 -0
- package/components/tabs/TabPanel.svelte +11 -0
- package/components/tabs/TabPanel.svelte.d.ts +20 -0
- package/components/tabs/Tabs.svelte +3 -0
- package/components/tabs/Tabs.svelte.d.ts +23 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/core/request.js +1 -0
- package/gen/models/MainArgSignature.d.ts +14 -3
- package/gen/services/JobService.d.ts +10 -2
- package/gen/services/JobService.js +4 -2
- package/gen/services/ScriptService.d.ts +18 -0
- package/gen/services/ScriptService.js +30 -0
- package/infer.js +47 -24
- package/package.json +39 -20
- package/script_helpers.d.ts +4 -1
- package/script_helpers.js +68 -17
- package/stores.d.ts +1 -2
- package/stores.js +1 -4
- package/utils.d.ts +4 -2
- package/utils.js +33 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { page } from '$app/stores';
|
|
4
4
|
import { inferArgs } from '../infer';
|
|
5
|
-
import { DENO_INIT_CODE, DENO_INIT_CODE_TRIGGER, initialCode } from '../script_helpers';
|
|
5
|
+
import { DENO_INIT_CODE, DENO_INIT_CODE_TRIGGER, initialCode, POSTGRES_INIT_CODE } from '../script_helpers';
|
|
6
6
|
import { workspaceStore } from '../stores';
|
|
7
7
|
import { emptySchema, encodeState, sendUserToast, setQueryWithoutLoad } from '../utils';
|
|
8
8
|
import { Breadcrumb, BreadcrumbItem } from 'flowbite-svelte';
|
|
@@ -18,6 +18,7 @@ let scriptSchema;
|
|
|
18
18
|
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
19
19
|
export let script;
|
|
20
20
|
export let initialPath = '';
|
|
21
|
+
export let template = undefined;
|
|
21
22
|
let pathError = '';
|
|
22
23
|
$: setQueryWithoutLoad($page.url, 'state', encodeState(script));
|
|
23
24
|
$: {
|
|
@@ -26,10 +27,10 @@ $: {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
if (script.content == '') {
|
|
29
|
-
initContent(script.language,
|
|
30
|
+
initContent(script.language, template);
|
|
30
31
|
}
|
|
31
|
-
function initContent(
|
|
32
|
-
script.content = initialCode(
|
|
32
|
+
function initContent(language, template) {
|
|
33
|
+
script.content = initialCode(language, template == 'pgsql' ? 'pgsql' : script.is_trigger ? 'trigger' : undefined);
|
|
33
34
|
}
|
|
34
35
|
async function editScript() {
|
|
35
36
|
try {
|
|
@@ -81,7 +82,9 @@ onDestroy(() => {
|
|
|
81
82
|
});
|
|
82
83
|
</script>
|
|
83
84
|
|
|
84
|
-
<div
|
|
85
|
+
<div
|
|
86
|
+
class="flex flex-col h-screen max-w-screen-lg xl:-ml-20 xl:pl-4 w-full -mt-4 pt-4 md:mx-10 pr-2"
|
|
87
|
+
>
|
|
85
88
|
<!-- Nav between steps-->
|
|
86
89
|
<div class="flex flex-col w-full">
|
|
87
90
|
<div class="justify-between flex flex-row drop-shadow-sm w-full mt-4">
|
|
@@ -121,21 +124,34 @@ onDestroy(() => {
|
|
|
121
124
|
changeStep(step + 1)
|
|
122
125
|
}}>Next</button
|
|
123
126
|
>
|
|
124
|
-
{#if step == 2}
|
|
125
|
-
<button
|
|
126
|
-
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
127
|
-
on:click={async () => {
|
|
128
|
-
await inferSchema()
|
|
129
|
-
editScript()
|
|
130
|
-
}}>Save (commit)</button
|
|
131
|
-
>
|
|
132
|
-
{/if}
|
|
133
127
|
{:else}
|
|
134
|
-
<button class="default-button px-6 self-end" on:click={editScript}>Save
|
|
128
|
+
<button class="default-button px-6 self-end" on:click={editScript}>Save</button>
|
|
129
|
+
{/if}
|
|
130
|
+
{#if step > 1}
|
|
131
|
+
<button
|
|
132
|
+
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
133
|
+
on:click={async () => {
|
|
134
|
+
changeStep(step - 1)
|
|
135
|
+
}}>Back</button
|
|
136
|
+
>
|
|
137
|
+
{/if}
|
|
138
|
+
{#if step == 2}
|
|
139
|
+
<button
|
|
140
|
+
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
141
|
+
on:click={async () => {
|
|
142
|
+
await inferSchema()
|
|
143
|
+
editScript()
|
|
144
|
+
}}>Save (commit)</button
|
|
145
|
+
>
|
|
135
146
|
{/if}
|
|
136
147
|
</div>
|
|
137
148
|
</div>
|
|
138
|
-
<div class="flex flex-row-
|
|
149
|
+
<div class="flex flex-row justify-between gap-x-20">
|
|
150
|
+
<span class="my-1 text-xs text-gray-500">
|
|
151
|
+
<a target="_blank" href="https://github.com/windmill-labs/windmill-gh-action-deploy"
|
|
152
|
+
>sync from github instead</a
|
|
153
|
+
>
|
|
154
|
+
</span>
|
|
139
155
|
<span class="my-1 text-sm text-gray-500 italic">
|
|
140
156
|
{#if script.hash != ''} Editing from {script.hash} with path{/if}
|
|
141
157
|
{#if initialPath && initialPath != script.path} {initialPath} → {/if}
|
|
@@ -151,7 +167,8 @@ onDestroy(() => {
|
|
|
151
167
|
bind:error={pathError}
|
|
152
168
|
bind:path={script.path}
|
|
153
169
|
{initialPath}
|
|
154
|
-
|
|
170
|
+
on:enter={() => changeStep(2)}
|
|
171
|
+
namePlaceholder="my_script"
|
|
155
172
|
kind="script"
|
|
156
173
|
>
|
|
157
174
|
<div slot="ownerToolkit">
|
|
@@ -162,7 +179,7 @@ onDestroy(() => {
|
|
|
162
179
|
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
163
180
|
</div>
|
|
164
181
|
</Path>
|
|
165
|
-
<h3 class="text-gray-700
|
|
182
|
+
<h3 class="text-gray-700 border-b">Language</h3>
|
|
166
183
|
<div class="max-w-md">
|
|
167
184
|
<RadioButton
|
|
168
185
|
label="Language"
|
|
@@ -170,10 +187,26 @@ onDestroy(() => {
|
|
|
170
187
|
['Typescript (Deno)', 'deno'],
|
|
171
188
|
['Python 3.10', 'python3']
|
|
172
189
|
]}
|
|
173
|
-
on:change={(e) => initContent(e.detail,
|
|
190
|
+
on:change={(e) => initContent(e.detail, template)}
|
|
174
191
|
bind:value={script.language}
|
|
175
192
|
/>
|
|
176
193
|
</div>
|
|
194
|
+
{#if script.language == 'deno'}
|
|
195
|
+
<h4 class="text-gray-700 border-b">Template</h4>
|
|
196
|
+
|
|
197
|
+
<div class="max-w-md">
|
|
198
|
+
<RadioButton
|
|
199
|
+
label="Template"
|
|
200
|
+
options={[
|
|
201
|
+
['None', undefined],
|
|
202
|
+
['PostgreSQL', 'pgsql']
|
|
203
|
+
]}
|
|
204
|
+
on:change={(e) => initContent(script.language, e.detail)}
|
|
205
|
+
bind:value={template}
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
{/if}
|
|
209
|
+
|
|
177
210
|
<h3 class="text-gray-700 pb-1 border-b">Metadata</h3>
|
|
178
211
|
|
|
179
212
|
<label class="block ">
|
|
@@ -226,8 +259,12 @@ onDestroy(() => {
|
|
|
226
259
|
type="checkbox"
|
|
227
260
|
bind:checked={script.is_trigger}
|
|
228
261
|
on:change={() => {
|
|
229
|
-
if (
|
|
230
|
-
|
|
262
|
+
if (
|
|
263
|
+
script.content == DENO_INIT_CODE ||
|
|
264
|
+
script.content == DENO_INIT_CODE_TRIGGER ||
|
|
265
|
+
script.content == POSTGRES_INIT_CODE
|
|
266
|
+
) {
|
|
267
|
+
initContent(script.language, template)
|
|
231
268
|
}
|
|
232
269
|
}}
|
|
233
270
|
/>
|
|
@@ -24,7 +24,7 @@ export let path;
|
|
|
24
24
|
export let lang;
|
|
25
25
|
// Control Editor layout
|
|
26
26
|
export let viewPreview = true;
|
|
27
|
-
export let previewTab = '
|
|
27
|
+
export let previewTab = 'input';
|
|
28
28
|
let websocketAlive = { pyright: false, black: false, deno: false };
|
|
29
29
|
let modalViewerTitle = '';
|
|
30
30
|
let modalViewerContent;
|
|
@@ -131,7 +131,9 @@ async function inferSchema() {
|
|
|
131
131
|
});
|
|
132
132
|
await inferArgs(lang, editor.getCode(), schema);
|
|
133
133
|
schema = schema;
|
|
134
|
-
isDefault
|
|
134
|
+
isDefault
|
|
135
|
+
.filter((key) => schema.properties[key] != undefined)
|
|
136
|
+
.forEach((key) => (args[key] = schema.properties[key].default));
|
|
135
137
|
for (const key of Object.keys(args)) {
|
|
136
138
|
if (schema.properties[key] == undefined) {
|
|
137
139
|
delete args[key];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script>import { userStore } from '../stores';
|
|
2
|
+
import { faPeopleGroup, faShare } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import Icon from 'svelte-awesome';
|
|
2
4
|
import Badge from './Badge.svelte';
|
|
3
5
|
export let extraPerms = {};
|
|
4
6
|
export let canWrite;
|
|
@@ -46,11 +48,14 @@ $: {
|
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
50
|
{#if kind == 'read' || kind == 'write'}
|
|
49
|
-
<span class="mr-1">
|
|
51
|
+
<span class="mr-1 align-center">
|
|
50
52
|
{#if kind == 'read'}
|
|
51
|
-
<Badge tooltip={reason}>
|
|
53
|
+
<Badge tooltip={reason}>
|
|
54
|
+
<Icon data={faPeopleGroup} scale={0.7} />
|
|
55
|
+
read</Badge
|
|
56
|
+
>
|
|
52
57
|
{:else if kind == 'write'}
|
|
53
|
-
<Badge tooltip={reason}
|
|
58
|
+
<Badge tooltip={reason}><Icon data={faPeopleGroup} scale={0.7} /></Badge>
|
|
54
59
|
{/if}
|
|
55
60
|
</span>
|
|
56
61
|
{/if}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>import { Button } from 'flowbite-svelte';
|
|
2
|
-
import {
|
|
2
|
+
import { isCopyFirstStepSchemaDisabled } from './flowState';
|
|
3
|
+
import { copyFirstStepSchema } from './flowStore';
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
6
|
<Button
|
|
6
|
-
color="
|
|
7
|
-
size="
|
|
7
|
+
color="light"
|
|
8
|
+
size="xs"
|
|
8
9
|
disabled={$isCopyFirstStepSchemaDisabled}
|
|
9
10
|
on:click={copyFirstStepSchema}
|
|
10
11
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
2
2
|
import Icon from 'svelte-awesome';
|
|
3
3
|
import { slide } from 'svelte/transition';
|
|
4
|
-
export let
|
|
4
|
+
export let importPath = undefined;
|
|
5
5
|
$: opened = false;
|
|
6
6
|
</script>
|
|
7
7
|
|
|
@@ -70,8 +70,10 @@ x + 2</code
|
|
|
70
70
|
</li>
|
|
71
71
|
</ul>
|
|
72
72
|
<p>To re-enable editor assistance, import the helper functions types using:</p>
|
|
73
|
-
<code
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
<code>
|
|
74
|
+
{`import { previous_result, flow_input, step, variable, resource, params } from 'windmill${
|
|
75
|
+
importPath ? `@${importPath}` : ''
|
|
76
|
+
}'`}
|
|
77
|
+
</code>
|
|
76
78
|
</div>
|
|
77
79
|
{/if}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
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}
|
|
3
16
|
</div>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} FlowBoxProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} FlowBoxEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} FlowBoxSlots */
|
|
4
|
-
export default class FlowBox extends SvelteComponentTyped<{}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {
|
|
7
|
-
default: {};
|
|
8
|
-
}> {
|
|
9
|
-
}
|
|
10
|
-
export type FlowBoxProps = typeof __propDef.props;
|
|
11
|
-
export type FlowBoxEvents = typeof __propDef.events;
|
|
12
|
-
export type FlowBoxSlots = typeof __propDef.slots;
|
|
13
1
|
import { SvelteComponentTyped } from "svelte";
|
|
14
2
|
declare const __propDef: {
|
|
15
|
-
props: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
headerClickable?: boolean | undefined;
|
|
7
|
+
};
|
|
16
8
|
events: {
|
|
9
|
+
clickheader: CustomEvent<any>;
|
|
10
|
+
} & {
|
|
17
11
|
[evt: string]: CustomEvent<any>;
|
|
18
12
|
};
|
|
19
13
|
slots: {
|
|
20
|
-
|
|
14
|
+
header: {};
|
|
15
|
+
content: {};
|
|
21
16
|
};
|
|
22
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
23
|
export {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
export let title = undefined;
|
|
3
|
+
export let clickable = false;
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
2
5
|
</script>
|
|
3
6
|
|
|
4
|
-
<div
|
|
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
|
+
>
|
|
5
12
|
{#if title}
|
|
6
|
-
<h3 class="text-
|
|
13
|
+
<h3 class="text-sm font-bold text-gray-900">{title}</h3>
|
|
7
14
|
{/if}
|
|
8
15
|
<slot />
|
|
9
16
|
</div>
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { emptySchema } from '../../utils';
|
|
2
|
+
import SchemaEditor from '../SchemaEditor.svelte';
|
|
2
3
|
import { flowStore } from './../flows/flowStore';
|
|
3
4
|
import CopyFirstStepSchema from './CopyFirstStepSchema.svelte';
|
|
4
5
|
import FlowBox from './FlowBox.svelte';
|
|
5
|
-
import FlowBoxHeader from './FlowBoxHeader.svelte';
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<FlowBox>
|
|
9
|
-
<
|
|
8
|
+
<FlowBox title="Flow Inputs">
|
|
9
|
+
<div slot="header">
|
|
10
10
|
<CopyFirstStepSchema />
|
|
11
|
-
</
|
|
12
|
-
<div
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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>
|
|
19
21
|
</div>
|
|
20
22
|
</FlowBox>
|
|
@@ -4,42 +4,62 @@ import { createEventDispatcher } from 'svelte';
|
|
|
4
4
|
import FlowScriptPicker from './pickers/FlowScriptPicker.svelte';
|
|
5
5
|
import PickHubScript from './pickers/PickHubScript.svelte';
|
|
6
6
|
import PickScript from './pickers/PickScript.svelte';
|
|
7
|
-
export let
|
|
7
|
+
export let shouldDisableLoopCreation = false;
|
|
8
|
+
export let shouldDisableTriggerScripts = false;
|
|
8
9
|
const dispatch = createEventDispatcher();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
|
-
<div class="
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
12
|
+
<div class="space-y-4">
|
|
13
|
+
{#if !shouldDisableTriggerScripts}
|
|
14
|
+
<div class="text-sm font-bold">Scripts</div>
|
|
15
|
+
{/if}
|
|
16
|
+
|
|
17
|
+
<div class="grid sm:grid-col-2 lg:grid-cols-3 gap-4">
|
|
18
|
+
<PickScript on:pick />
|
|
19
|
+
<PickHubScript on:pick />
|
|
20
|
+
|
|
21
|
+
<FlowScriptPicker
|
|
22
|
+
label={`Create a for-loop here`}
|
|
23
|
+
disabled={shouldDisableLoopCreation}
|
|
24
|
+
icon={faRepeat}
|
|
25
|
+
iconColor="text-blue-500"
|
|
26
|
+
on:click={() => dispatch('loop')}
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<FlowScriptPicker
|
|
30
|
+
label={`New PostgreSQL query`}
|
|
31
|
+
icon={faCode}
|
|
32
|
+
iconColor="text-blue-800"
|
|
33
|
+
on:click={() => dispatch('new', { language: RawScript.language.DENO, type: 'pgsql' })}
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<FlowScriptPicker
|
|
37
|
+
label="New Python script (3.10)"
|
|
38
|
+
icon={faCode}
|
|
39
|
+
iconColor="text-green-500"
|
|
40
|
+
on:click={() => dispatch('new', { language: RawScript.language.PYTHON3, type: 'flow' })}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<FlowScriptPicker
|
|
44
|
+
label="New Typescript script (Deno)"
|
|
45
|
+
icon={faCode}
|
|
46
|
+
iconColor="text-blue-800"
|
|
47
|
+
on:click={() => dispatch('new', { language: RawScript.language.DENO, type: 'flow' })}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
{#if !shouldDisableTriggerScripts}
|
|
52
|
+
<div class="text-sm font-bold">Trigger scripts</div>
|
|
53
|
+
|
|
54
|
+
<div class="grid sm:grid-col-1 md:grid-col-2 lg:grid-cols-3 gap-4">
|
|
55
|
+
<PickScript isTrigger={true} on:pick />
|
|
56
|
+
<PickHubScript isTrigger={true} on:pick />
|
|
57
|
+
<FlowScriptPicker
|
|
58
|
+
label="New Typescript script (Deno)"
|
|
59
|
+
icon={faCode}
|
|
60
|
+
iconColor="text-blue-800"
|
|
61
|
+
on:click={() => dispatch('new', { language: RawScript.language.DENO, type: 'trigger' })}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
45
65
|
</div>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
|
|
4
|
+
shouldDisableLoopCreation?: boolean | undefined;
|
|
5
|
+
shouldDisableTriggerScripts?: boolean | undefined;
|
|
5
6
|
};
|
|
6
7
|
events: {
|
|
7
8
|
pick: CustomEvent<any>;
|
|
9
|
+
loop: CustomEvent<any>;
|
|
8
10
|
new: CustomEvent<any>;
|
|
9
11
|
} & {
|
|
10
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
<script>import { getScriptByPath } from '../../utils';
|
|
2
|
-
import { faCode, faCodeBranch, faSave, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
1
|
+
<script>import { getScriptByPath, valueToTsType } from '../../utils';
|
|
2
|
+
import { faArrowDown, faClose, faCode, faCodeBranch, faSave, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { Button } from 'flowbite-svelte';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
4
5
|
import Icon from 'svelte-awesome';
|
|
5
6
|
import { Highlight } from 'svelte-highlight';
|
|
6
7
|
import python from 'svelte-highlight/languages/python';
|
|
7
8
|
import typescript from 'svelte-highlight/languages/typescript';
|
|
9
|
+
import IconedPath from '../IconedPath.svelte';
|
|
10
|
+
import IconedResourceType from '../IconedResourceType.svelte';
|
|
8
11
|
import Modal from '../Modal.svelte';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export let open;
|
|
13
|
-
export let i;
|
|
14
|
-
export let shouldPick = false;
|
|
12
|
+
import { isEmptyFlowModule } from './flowStateUtils';
|
|
13
|
+
import { stepOpened } from './stepOpenedStore';
|
|
14
|
+
export let indexes;
|
|
15
15
|
export let mod;
|
|
16
|
+
$: shouldPick = isEmptyFlowModule(mod);
|
|
16
17
|
let modalViewer;
|
|
17
18
|
let modalViewerContent = '';
|
|
18
19
|
let modalViewerLanguage = 'deno';
|
|
@@ -27,60 +28,75 @@ async function viewCode() {
|
|
|
27
28
|
throw Error('Not a script');
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
scrollIntoView(el);
|
|
33
|
-
}
|
|
31
|
+
const dispatch = createEventDispatcher();
|
|
32
|
+
$: opened = $stepOpened === String(indexes.join('-'));
|
|
34
33
|
</script>
|
|
35
34
|
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{#if mod.value.
|
|
48
|
-
<
|
|
49
|
-
on:click={() =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
>
|
|
56
|
-
<Icon data={faCodeBranch} class="mr-2" />
|
|
57
|
-
Fork
|
|
58
|
-
</Button>
|
|
59
|
-
<Button size="sm" color="alternative" on:click={viewCode}>
|
|
60
|
-
<Icon data={faCode} class="mr-2" />
|
|
61
|
-
View code
|
|
62
|
-
</Button>
|
|
35
|
+
<div>
|
|
36
|
+
<h3 class="text-sm font-bold text-gray-900 flex flex-col">
|
|
37
|
+
<span class="text-xs shrink">
|
|
38
|
+
{#if 'path' in mod.value && mod.value.path}
|
|
39
|
+
<IconedPath path={mod.value.path} />
|
|
40
|
+
{:else if 'language' in mod.value && mod.value.language}
|
|
41
|
+
Inline {mod.value.language}
|
|
42
|
+
{:else}
|
|
43
|
+
Select a script
|
|
44
|
+
{/if}
|
|
45
|
+
</span>
|
|
46
|
+
{#if ('path' in mod.value && mod.value.path) || ('language' in mod.value && mod.value.language)}
|
|
47
|
+
<input
|
|
48
|
+
on:click|stopPropagation={() => undefined}
|
|
49
|
+
class="overflow-x-auto"
|
|
50
|
+
type="text"
|
|
51
|
+
bind:value={mod.summary}
|
|
52
|
+
placeholder="Summary"
|
|
53
|
+
/>
|
|
63
54
|
{/if}
|
|
55
|
+
</h3>
|
|
56
|
+
</div>
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
<div class="flex flex-row space-x-2" on:click|stopPropagation={() => undefined}>
|
|
59
|
+
{#if mod.value.type === 'script' && !shouldPick}
|
|
60
|
+
<Button size="xs" color="alternative" on:click={() => dispatch('fork')}>
|
|
61
|
+
<Icon data={faCodeBranch} class="mr-2" />
|
|
62
|
+
Fork
|
|
63
|
+
</Button>
|
|
64
|
+
<Button size="xs" color="alternative" on:click={viewCode}>
|
|
65
|
+
<Icon data={faCode} class="mr-2" />
|
|
66
|
+
View code
|
|
67
|
+
</Button>
|
|
68
|
+
{/if}
|
|
69
|
+
|
|
70
|
+
{#if mod.value.type === 'rawscript' && !shouldPick}
|
|
71
|
+
<Button size="xs" color="alternative" on:click={() => dispatch('createScriptFromInlineScript')}>
|
|
72
|
+
<Icon data={faSave} class="mr-2" />
|
|
73
|
+
Save to workspace
|
|
74
|
+
</Button>
|
|
75
|
+
{/if}
|
|
76
|
+
<Button
|
|
77
|
+
size="xs"
|
|
78
|
+
color="alternative"
|
|
79
|
+
on:click={() => {
|
|
80
|
+
dispatch('delete')
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<Icon data={faTrashAlt} class="mr-2" />
|
|
84
|
+
Remove step
|
|
85
|
+
</Button>
|
|
86
|
+
{#if opened}
|
|
87
|
+
<Button size="xs" color="dark" on:click={() => stepOpened.update(() => undefined)}>
|
|
88
|
+
<Icon data={faClose} />
|
|
89
|
+
</Button>
|
|
90
|
+
{:else}
|
|
71
91
|
<Button
|
|
72
|
-
size="
|
|
73
|
-
color="
|
|
74
|
-
on:click={() =>
|
|
75
|
-
open = -1
|
|
76
|
-
removeModule(i)
|
|
77
|
-
}}
|
|
92
|
+
size="xs"
|
|
93
|
+
color="light"
|
|
94
|
+
on:click={() => stepOpened.update(() => String(indexes.join('-')))}
|
|
78
95
|
>
|
|
79
|
-
<Icon data={
|
|
80
|
-
Remove step
|
|
96
|
+
<Icon data={faArrowDown} />
|
|
81
97
|
</Button>
|
|
82
|
-
|
|
83
|
-
</
|
|
98
|
+
{/if}
|
|
99
|
+
</div>
|
|
84
100
|
|
|
85
101
|
<Modal bind:this={modalViewer}>
|
|
86
102
|
<div slot="title">Script {'path' in mod?.value ? mod?.value.path : ''}</div>
|