windmill-components 1.56.1 → 1.56.5
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/assets/app.css +54 -0
- package/components/CenteredModal.svelte +18 -16
- package/components/CenteredModal.svelte.d.ts +1 -0
- package/components/Dropdown.svelte +4 -3
- package/components/Dropdown.svelte.d.ts +1 -0
- package/components/Editor.svelte +30 -30
- package/components/Editor.svelte.d.ts +3 -3
- package/components/FlowPreviewContent.svelte +2 -2
- package/components/InputTransformForm.svelte +45 -36
- package/components/InputTransformForm.svelte.d.ts +1 -0
- package/components/LogViewer.svelte +7 -4
- package/components/ModulePreview.svelte +20 -13
- package/components/Popover.svelte +9 -17
- package/components/Popover.svelte.d.ts +3 -0
- package/components/RadioButton.svelte +5 -3
- package/components/RadioButton.svelte.d.ts +2 -0
- package/components/ResourceEditor.svelte +2 -1
- package/components/SchemaEditor.svelte +3 -0
- package/components/SchemaForm.svelte +84 -76
- package/components/SchemaForm.svelte.d.ts +3 -0
- package/components/ScriptEditor.svelte +14 -9
- package/components/SimpleEditor.svelte +18 -20
- package/components/Star.svelte +15 -9
- package/components/TemplateEditor.svelte +25 -35
- package/components/TemplateEditor.svelte.d.ts +1 -25
- package/components/TestJobLoader.svelte +37 -20
- package/components/TestJobLoader.svelte.d.ts +10 -8
- package/components/Toggle.svelte +30 -7
- package/components/Toggle.svelte.d.ts +4 -0
- package/components/Tooltip.svelte +1 -1
- package/components/apps/components/buttons/AppButton.svelte +23 -8
- package/components/apps/components/buttons/AppButton.svelte.d.ts +1 -0
- package/components/apps/components/dataDisplay/AppBarChart.svelte +7 -2
- package/components/apps/components/dataDisplay/AppPieChart.svelte +1 -1
- package/components/apps/components/form/AppForm.svelte +7 -0
- package/components/apps/components/helpers/AlignWrapper.svelte +2 -1
- package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +1 -0
- package/components/apps/components/helpers/InputValue.svelte +17 -5
- package/components/apps/components/helpers/InputValue.svelte.d.ts +1 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +3 -0
- package/components/apps/components/helpers/RefreshButton.svelte +16 -11
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +2 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +40 -15
- package/components/apps/components/selectInputs/AppCheckbox.svelte +4 -0
- package/components/apps/components/table/AppTable.svelte +48 -24
- package/components/apps/components/textInputs/AppTextInput.svelte +7 -3
- package/components/apps/editor/AppEditor.svelte +83 -41
- package/components/apps/editor/AppEditor.svelte.d.ts +2 -0
- package/components/apps/editor/AppEditorHeader.svelte +5 -2
- package/components/apps/editor/AppPreview.svelte +3 -1
- package/components/apps/editor/AppPreview.svelte.d.ts +2 -0
- package/components/apps/editor/ComponentEditor.svelte +6 -7
- package/components/apps/editor/ComponentEditor.svelte.d.ts +1 -0
- package/components/apps/editor/ComponentHeader.svelte +31 -29
- package/components/apps/editor/ComponentHeader.svelte.d.ts +2 -1
- package/components/apps/editor/GridEditor.svelte +62 -46
- package/components/apps/editor/GridEditor.svelte.d.ts +6 -1
- package/components/apps/editor/RecomputeAllComponents.svelte +7 -13
- package/components/apps/editor/SettingsPanel.svelte +2 -2
- package/components/apps/editor/TablePanel.svelte +1 -0
- package/components/apps/editor/componentsPanel/ComponentList.svelte +4 -15
- package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +1 -1
- package/components/apps/editor/componentsPanel/componentStaticValues.js +1 -1
- package/components/apps/editor/componentsPanel/data.js +11 -15
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +1 -0
- package/components/apps/editor/contextPanel/ContextPanel.svelte +46 -43
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +9 -10
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +5 -1
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte.d.ts +2 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +62 -20
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +2 -2
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +73 -76
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +17 -15
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +1 -2
- package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +0 -1
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +5 -5
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +11 -18
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +22 -5
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +3 -3
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +16 -15
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +3 -2
- package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +21 -3
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +1 -3
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +0 -1
- package/components/apps/editor/settingsPanel/TableActions.svelte +18 -9
- package/components/apps/editor/settingsPanel/TableActions.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +9 -2
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte +6 -0
- package/components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +2 -7
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +0 -1
- package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte +1 -2
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +7 -6
- package/components/apps/gridUtils.js +3 -2
- package/components/apps/inputType.d.ts +9 -3
- package/components/apps/rx.d.ts +2 -2
- package/components/apps/rx.js +3 -2
- package/components/apps/types.d.ts +2 -1
- package/components/apps/utils.js +5 -3
- package/components/common/button/Button.svelte +3 -1
- package/components/common/button/Button.svelte.d.ts +1 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte +1 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +6 -2
- package/components/common/drawer/Drawer.svelte +6 -3
- package/components/common/menu/Menu.svelte +14 -1
- package/components/common/table/AppRow.svelte +5 -1
- package/components/common/table/FlowRow.svelte +5 -1
- package/components/common/table/LanguageBadge.svelte.d.ts +6 -13
- package/components/common/table/Row.svelte +10 -8
- package/components/common/table/ScriptRow.svelte +13 -11
- package/components/flows/content/FlowConstants.svelte +68 -0
- package/components/flows/content/FlowConstants.svelte.d.ts +14 -0
- package/components/flows/content/FlowEditorPanel.svelte +3 -0
- package/components/flows/content/FlowModuleComponent.svelte +4 -1
- package/components/flows/content/FlowModuleHeader.svelte +35 -84
- package/components/flows/content/FlowModuleHeader.svelte.d.ts +2 -2
- package/components/flows/flowStore.d.ts +1 -1
- package/components/flows/flowStore.js +8 -8
- package/components/flows/header/FlowPreviewButtons.svelte +2 -1
- package/components/flows/map/FlowConstantsItem.svelte +15 -0
- package/components/flows/map/FlowConstantsItem.svelte.d.ts +14 -0
- package/components/flows/map/FlowInputsItem.svelte +1 -2
- package/components/flows/map/FlowModuleSchemaItem.svelte +34 -25
- package/components/flows/map/FlowModuleSchemaMap.svelte +13 -3
- package/components/flows/map/FlowSettingsItem.svelte +2 -2
- package/components/flows/pickers/PickHubScript.svelte +1 -1
- package/components/sidebar/FavoriteMenu.svelte +23 -19
- package/components/sidebar/MenuLink.svelte +4 -4
- package/components/sidebar/MenuLink.svelte.d.ts +1 -1
- package/components/sidebar/SidebarContent.svelte +16 -16
- package/components/sidebar/WorkspaceMenu.svelte +17 -15
- package/logout.d.ts +1 -0
- package/logout.js +5 -3
- package/package.json +492 -488
- package/stores.js +1 -1
package/assets/app.css
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* Write your global styles here, in PostCSS syntax */
|
|
2
|
+
@tailwind base;
|
|
3
|
+
@tailwind components;
|
|
4
|
+
@tailwind utilities;
|
|
5
|
+
|
|
6
|
+
@layer base {
|
|
7
|
+
@font-face {
|
|
8
|
+
font-family: 'Inter';
|
|
9
|
+
src: url('/Inter-Variable.ttf');
|
|
10
|
+
font-weight: 100 900;
|
|
11
|
+
font-display: swap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.splitpanes--vertical > .splitpanes__pane {
|
|
15
|
+
transition: none !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.splitpanes--horizontal > .splitpanes__pane {
|
|
19
|
+
transition: none !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.monaco-workbench > .notifications-toasts.visible {
|
|
23
|
+
display: none !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nowrap pre code.hljs {
|
|
27
|
+
whitespace: normal !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
svelte-virtual-list-row {
|
|
31
|
+
overflow: visible !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
svelte-virtual-list-contents > * + * {
|
|
35
|
+
border-top-width: 1px !important;
|
|
36
|
+
border-bottom-width: 0px !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.monaco-editor textarea:focus {
|
|
40
|
+
box-shadow: none !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.templatable-editor span.mtk20 {
|
|
44
|
+
color: black !important;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@layer components {
|
|
49
|
+
/* Flow graph viewer -> Svelvet library internal class overwrite */
|
|
50
|
+
.Node {
|
|
51
|
+
display: flex !important;
|
|
52
|
+
cursor: pointer !important;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
<script>import { SettingsService } from '../gen';
|
|
2
|
+
import { onMount } from 'svelte';
|
|
2
3
|
import WindmillIcon from './icons/WindmillIcon.svelte';
|
|
3
4
|
export let subtitle = undefined;
|
|
4
5
|
export let title = 'Windmill';
|
|
6
|
+
export let disableLogo = false;
|
|
5
7
|
let version = '';
|
|
6
|
-
|
|
7
|
-
version =
|
|
8
|
+
onMount(async () => {
|
|
9
|
+
version = await SettingsService.backendVersion();
|
|
8
10
|
});
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
|
-
<div class="
|
|
12
|
-
<div class="
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
<div class="center-center min-h-screen p-4 relative bg-[#3b4252]">
|
|
14
|
+
<div class="border rounded-md shadow-md bg-white w-full max-w-[640px]
|
|
15
|
+
p-4 sm:py-8 sm:px-10 mb-6 md:mb-20 z-10">
|
|
16
|
+
<div class="mb-10">
|
|
17
|
+
<h1 class="text-center">
|
|
15
18
|
{title}
|
|
16
19
|
</h1>
|
|
17
20
|
{#if subtitle}
|
|
18
|
-
<p class="
|
|
21
|
+
<p class="text-sm text-center text-gray-600 mt-2">
|
|
19
22
|
{subtitle}
|
|
20
23
|
</p>
|
|
21
24
|
{/if}
|
|
22
|
-
<slot />
|
|
23
25
|
</div>
|
|
24
|
-
|
|
25
|
-
<!-- empty row to make the form a little bit above vertical centering-->
|
|
26
|
-
<div class="py-12" />
|
|
26
|
+
<slot />
|
|
27
27
|
</div>
|
|
28
|
-
|
|
29
|
-
<div class="
|
|
30
|
-
<
|
|
28
|
+
{#if !disableLogo}
|
|
29
|
+
<div class="hidden lg:block absolute top-10 right-50">
|
|
30
|
+
<div class="animate-[spin_100s_linear_infinite] ">
|
|
31
|
+
<WindmillIcon white height="100px" width="100px" />
|
|
32
|
+
</div>
|
|
33
|
+
<h2 class="text-center pt-2 text-gray-100">Windmill</h2>
|
|
31
34
|
</div>
|
|
32
|
-
|
|
33
|
-
</div>
|
|
35
|
+
{/if}
|
|
34
36
|
<div class="absolute top-0 right-0 text-2xs text-gray-300 italic px-3 py-1">
|
|
35
37
|
<span class="font-mono">{version}</span>
|
|
36
38
|
</div>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from 'svelte';
|
|
2
2
|
import Icon from 'svelte-awesome';
|
|
3
|
-
import {
|
|
3
|
+
import { MoreHorizontal } from 'lucide-svelte';
|
|
4
4
|
import { Button, Menu } from './common';
|
|
5
5
|
export let dropdownItems;
|
|
6
6
|
export let name = undefined;
|
|
7
7
|
export let placement = 'bottom-start';
|
|
8
|
+
export let btnClasses = '!text-blue-500 bg-transparent';
|
|
8
9
|
const dispatch = createEventDispatcher();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<Menu {placement} let:close>
|
|
12
|
-
<Button color="light" size="xs" btnClasses
|
|
13
|
+
<Button nonCaptureEvent color="light" size="xs" {btnClasses} slot="trigger">
|
|
13
14
|
{#if !$$slots.default}
|
|
14
|
-
<
|
|
15
|
+
<MoreHorizontal size={20} />
|
|
15
16
|
{:else}
|
|
16
17
|
<slot />
|
|
17
18
|
{/if}
|
package/components/Editor.svelte
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
<script context="module">import
|
|
2
|
-
|
|
3
|
-
target: monaco.languages.typescript.ScriptTarget.Latest,
|
|
4
|
-
allowNonTsExtensions: true,
|
|
5
|
-
noLib: true
|
|
6
|
-
});
|
|
7
|
-
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
8
|
-
noSemanticValidation: true,
|
|
9
|
-
noSuggestionDiagnostics: true,
|
|
10
|
-
noSyntaxValidation: true
|
|
11
|
-
});
|
|
12
|
-
monaco.editor.defineTheme('myTheme', {
|
|
13
|
-
base: 'vs',
|
|
14
|
-
inherit: true,
|
|
15
|
-
rules: [],
|
|
16
|
-
colors: {
|
|
17
|
-
'editorLineNumber.foreground': '#999',
|
|
18
|
-
'editorGutter.background': '#F9FAFB'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
monaco.editor.setTheme('myTheme');
|
|
1
|
+
<script context="module">import getMessageServiceOverride from 'vscode/service-override/messages';
|
|
2
|
+
import { StandaloneServices } from 'vscode/services';
|
|
22
3
|
try {
|
|
23
|
-
StandaloneServices
|
|
4
|
+
StandaloneServices?.initialize({
|
|
24
5
|
...getMessageServiceOverride(document.body)
|
|
25
6
|
});
|
|
26
7
|
}
|
|
@@ -29,18 +10,37 @@ catch (e) {
|
|
|
29
10
|
}
|
|
30
11
|
</script>
|
|
31
12
|
|
|
32
|
-
<script>import { browser, dev } from '$app/
|
|
13
|
+
<script>import { browser, dev } from '$app/environment';
|
|
33
14
|
import { page } from '$app/stores';
|
|
34
15
|
import { sendUserToast } from '../utils';
|
|
35
16
|
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
36
17
|
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
37
18
|
import { buildWorkerDefinition } from 'monaco-editor-workers';
|
|
38
|
-
import getMessageServiceOverride from 'vscode/service-override/messages';
|
|
39
19
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
20
|
+
import { languages, editor as meditor, KeyCode, KeyMod, Uri as mUri } from 'monaco-editor';
|
|
21
|
+
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
22
|
+
target: languages.typescript.ScriptTarget.Latest,
|
|
23
|
+
allowNonTsExtensions: true,
|
|
24
|
+
noLib: true
|
|
25
|
+
});
|
|
26
|
+
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
27
|
+
noSemanticValidation: true,
|
|
28
|
+
noSuggestionDiagnostics: true,
|
|
29
|
+
noSyntaxValidation: true
|
|
30
|
+
});
|
|
31
|
+
meditor.defineTheme('myTheme', {
|
|
32
|
+
base: 'vs',
|
|
33
|
+
inherit: true,
|
|
34
|
+
rules: [],
|
|
35
|
+
colors: {
|
|
36
|
+
'editorLineNumber.foreground': '#999',
|
|
37
|
+
'editorGutter.background': '#F9FAFB'
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
meditor.setTheme('myTheme');
|
|
40
41
|
import { BASH_INIT_CODE, DENO_INIT_CODE_CLEAR, GO_INIT_CODE, PYTHON_INIT_CODE_CLEAR } from '../script_helpers';
|
|
41
42
|
import { createHash as randomHash, editorConfig, langToExt, updateOptions } from '../editorUtils';
|
|
42
43
|
import { dirtyStore } from './common/confirmationModal/dirtyStore';
|
|
43
|
-
import { StandaloneServices } from 'vscode/services';
|
|
44
44
|
let divEl = null;
|
|
45
45
|
let editor;
|
|
46
46
|
export let lang;
|
|
@@ -352,25 +352,25 @@ async function closeWebsockets() {
|
|
|
352
352
|
websocketInterval && clearInterval(websocketInterval);
|
|
353
353
|
}
|
|
354
354
|
async function loadMonaco() {
|
|
355
|
-
const model =
|
|
355
|
+
const model = meditor.createModel(code, lang, mUri.parse(uri));
|
|
356
356
|
model.updateOptions(updateOptions);
|
|
357
|
-
editor =
|
|
357
|
+
editor = meditor.create(divEl, editorConfig(model, code, lang, automaticLayout, fixedOverflowWidgets));
|
|
358
358
|
let timeoutModel = undefined;
|
|
359
359
|
editor.onDidChangeModelContent((event) => {
|
|
360
360
|
$dirtyStore = true;
|
|
361
361
|
timeoutModel && clearTimeout(timeoutModel);
|
|
362
362
|
timeoutModel = setTimeout(() => {
|
|
363
363
|
code = getCode();
|
|
364
|
-
dispatch('change');
|
|
364
|
+
dispatch('change', code);
|
|
365
365
|
}, 500);
|
|
366
366
|
});
|
|
367
367
|
editor.onDidFocusEditorText(() => {
|
|
368
368
|
dispatch('focus');
|
|
369
|
-
editor.addCommand(
|
|
369
|
+
editor.addCommand(KeyMod.CtrlCmd | KeyCode.KeyS, function () {
|
|
370
370
|
code = getCode();
|
|
371
371
|
shouldBindKey && format && format();
|
|
372
372
|
});
|
|
373
|
-
editor.addCommand(
|
|
373
|
+
editor.addCommand(KeyMod.CtrlCmd | KeyCode.Enter, function () {
|
|
374
374
|
code = getCode();
|
|
375
375
|
shouldBindKey && cmdEnterAction && cmdEnterAction();
|
|
376
376
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import
|
|
2
|
+
import { editor as meditor } from 'monaco-editor';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
@@ -24,7 +24,7 @@ declare const __propDef: {
|
|
|
24
24
|
setCode?: ((ncode: string) => void) | undefined;
|
|
25
25
|
clearContent?: (() => Promise<void>) | undefined;
|
|
26
26
|
reloadWebsocket?: (() => Promise<void>) | undefined;
|
|
27
|
-
addAction?: ((id: string, label: string, callback: (editor:
|
|
27
|
+
addAction?: ((id: string, label: string, callback: (editor: meditor.IStandaloneCodeEditor) => void, keybindings?: number[]) => void) | undefined;
|
|
28
28
|
};
|
|
29
29
|
events: {
|
|
30
30
|
change: CustomEvent<any>;
|
|
@@ -46,6 +46,6 @@ export default class Editor extends SvelteComponentTyped<EditorProps, EditorEven
|
|
|
46
46
|
get setCode(): (ncode: string) => void;
|
|
47
47
|
get clearContent(): () => Promise<void>;
|
|
48
48
|
get reloadWebsocket(): () => Promise<void>;
|
|
49
|
-
get addAction(): (id: string, label: string, callback: (editor:
|
|
49
|
+
get addAction(): (id: string, label: string, callback: (editor: meditor.IStandaloneCodeEditor) => void, keybindings?: number[]) => void;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -16,7 +16,7 @@ export let previewMode;
|
|
|
16
16
|
export let open;
|
|
17
17
|
export let jobId = undefined;
|
|
18
18
|
export let job = undefined;
|
|
19
|
-
let isValid =
|
|
19
|
+
let isValid = true;
|
|
20
20
|
let isRunning = false;
|
|
21
21
|
let jobProgressReset;
|
|
22
22
|
const { selectedId, previewArgs } = getContext('FlowEditorContext');
|
|
@@ -50,7 +50,7 @@ function extractFlow(previewMode) {
|
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
const flow = JSON.parse(JSON.stringify($flowStore));
|
|
53
|
-
const idOrders = dfs(flow.value.modules);
|
|
53
|
+
const idOrders = dfs(flow.value.modules, (x) => x.id);
|
|
54
54
|
let upToIndex = idOrders.indexOf($selectedId);
|
|
55
55
|
if (upToIndex != -1) {
|
|
56
56
|
flow.value.modules = sliceModules(flow.value.modules, upToIndex, idOrders);
|
|
@@ -8,6 +8,7 @@ import { Button, ToggleButton, ToggleButtonGroup } from './common';
|
|
|
8
8
|
import { faCode } from '@fortawesome/free-solid-svg-icons';
|
|
9
9
|
import TemplateEditor from './TemplateEditor.svelte';
|
|
10
10
|
import Tooltip from './Tooltip.svelte';
|
|
11
|
+
import { setInputCat as computeInputCat } from '../utils';
|
|
11
12
|
export let schema;
|
|
12
13
|
export let arg;
|
|
13
14
|
export let argName;
|
|
@@ -17,10 +18,11 @@ export let previousModuleId;
|
|
|
17
18
|
export let pickForField = undefined;
|
|
18
19
|
export let variableEditor = undefined;
|
|
19
20
|
export let itemPicker = undefined;
|
|
21
|
+
export let noDynamicToggle = false;
|
|
20
22
|
let monaco = undefined;
|
|
21
23
|
let monacoTemplate = undefined;
|
|
22
24
|
let argInput = undefined;
|
|
23
|
-
let inputCat =
|
|
25
|
+
let inputCat = computeInputCat(schema.properties[argName].type, schema.properties[argName].format, schema.properties[argName].items?.type, schema.properties[argName].enum, schema.properties[argName].contentEncoding);
|
|
24
26
|
let propertyType = getPropertyType(arg);
|
|
25
27
|
function getPropertyType(arg) {
|
|
26
28
|
let type = arg?.type ?? 'static';
|
|
@@ -89,7 +91,7 @@ function onFocus() {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
const { focusProp, propPickerConfig } = getContext('PropPickerWrapper');
|
|
92
|
-
$: isStaticTemplate(inputCat) && propertyType == 'static' && setPropertyType(arg
|
|
94
|
+
$: isStaticTemplate(inputCat) && propertyType == 'static' && setPropertyType(arg?.value);
|
|
93
95
|
const openBracket = '${';
|
|
94
96
|
const closeBracket = '}';
|
|
95
97
|
</script>
|
|
@@ -117,21 +119,8 @@ const closeBracket = '}';
|
|
|
117
119
|
</span>
|
|
118
120
|
{/if}
|
|
119
121
|
</div>
|
|
120
|
-
|
|
121
|
-
<div>
|
|
122
|
-
<Button
|
|
123
|
-
variant="contained"
|
|
124
|
-
color="blue"
|
|
125
|
-
size="xs"
|
|
126
|
-
on:click={() => {
|
|
127
|
-
focusProp(argName, 'connect', (path) => {
|
|
128
|
-
connectProperty(path)
|
|
129
|
-
return true
|
|
130
|
-
})
|
|
131
|
-
}}>Connect →</Button
|
|
132
|
-
>
|
|
133
|
-
</div>
|
|
134
|
-
<div>
|
|
122
|
+
{#if !noDynamicToggle}
|
|
123
|
+
<div class="flex flex-row gap-x-4 gap-y-1 flex-wrap">
|
|
135
124
|
<ToggleButtonGroup
|
|
136
125
|
bind:selected={propertyType}
|
|
137
126
|
on:selected={(e) => {
|
|
@@ -142,24 +131,29 @@ const closeBracket = '}';
|
|
|
142
131
|
argName,
|
|
143
132
|
previousModuleId,
|
|
144
133
|
staticTemplate
|
|
145
|
-
? `\`${arg
|
|
134
|
+
? `\`${arg?.value ?? ''}\``
|
|
146
135
|
: arg.value
|
|
147
|
-
? JSON.stringify(arg
|
|
136
|
+
? JSON.stringify(arg?.value, null, 4)
|
|
148
137
|
: ''
|
|
149
138
|
)
|
|
150
139
|
}
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
if (arg) {
|
|
141
|
+
arg.value = undefined
|
|
142
|
+
}
|
|
153
143
|
propertyType = 'javascript'
|
|
154
144
|
arg.type = 'javascript'
|
|
155
145
|
} else {
|
|
156
146
|
if (staticTemplate) {
|
|
157
|
-
|
|
158
|
-
|
|
147
|
+
if (arg) {
|
|
148
|
+
arg.value = codeToStaticTemplate(arg.expr)
|
|
149
|
+
}
|
|
150
|
+
setPropertyType(arg?.value)
|
|
159
151
|
} else {
|
|
160
|
-
arg
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
if (arg) {
|
|
153
|
+
arg.type = 'static'
|
|
154
|
+
arg.value = undefined
|
|
155
|
+
arg.expr = undefined
|
|
156
|
+
}
|
|
163
157
|
}
|
|
164
158
|
propertyType = 'static'
|
|
165
159
|
}
|
|
@@ -187,9 +181,21 @@ const closeBracket = '}';
|
|
|
187
181
|
Dynamic (JS)
|
|
188
182
|
</ToggleButton>
|
|
189
183
|
</ToggleButtonGroup>
|
|
184
|
+
<Button
|
|
185
|
+
variant="contained"
|
|
186
|
+
color="blue"
|
|
187
|
+
size="xs"
|
|
188
|
+
on:click={() => {
|
|
189
|
+
focusProp(argName, 'connect', (path) => {
|
|
190
|
+
connectProperty(path)
|
|
191
|
+
return true
|
|
192
|
+
})
|
|
193
|
+
}}>Connect →</Button
|
|
194
|
+
>
|
|
190
195
|
</div>
|
|
191
|
-
|
|
196
|
+
{/if}
|
|
192
197
|
</div>
|
|
198
|
+
|
|
193
199
|
<div class="max-w-xs" />
|
|
194
200
|
|
|
195
201
|
<div
|
|
@@ -204,14 +210,17 @@ const closeBracket = '}';
|
|
|
204
210
|
Connect input →
|
|
205
211
|
</span>
|
|
206
212
|
{/if}
|
|
207
|
-
{#if isStaticTemplate(inputCat) && propertyType == 'static'}
|
|
208
|
-
<div class="py-1 rounded border border-1 border-gray-500">
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
{#if isStaticTemplate(inputCat) && propertyType == 'static' && !noDynamicToggle}
|
|
214
|
+
<div class="py-1 mt-2 min-h-[28px] rounded border border-1 border-gray-500">
|
|
215
|
+
{#if arg}
|
|
216
|
+
<TemplateEditor
|
|
217
|
+
bind:this={monacoTemplate}
|
|
218
|
+
{extraLib}
|
|
219
|
+
on:focus={onFocus}
|
|
220
|
+
bind:code={arg.value}
|
|
221
|
+
fontSize={14}
|
|
222
|
+
/>
|
|
223
|
+
{/if}
|
|
215
224
|
</div>
|
|
216
225
|
{:else if propertyType === undefined || propertyType == 'static'}
|
|
217
226
|
<ArgInput
|
|
@@ -264,5 +273,5 @@ const closeBracket = '}';
|
|
|
264
273
|
</div>
|
|
265
274
|
<div class="mb-6" />
|
|
266
275
|
{:else}
|
|
267
|
-
<p class="text-sm text-gray-700">
|
|
276
|
+
<p class="text-sm text-gray-700">Argument at {argName} is undefined</p>
|
|
268
277
|
{/if}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { faSpinner } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { Icon } from 'svelte-awesome';
|
|
3
|
+
import { fade } from 'svelte/transition';
|
|
2
4
|
import { Drawer, DrawerContent } from './common';
|
|
3
5
|
export let content;
|
|
4
6
|
export let isLoading;
|
|
@@ -43,9 +45,10 @@ let logViewer;
|
|
|
43
45
|
{/if}
|
|
44
46
|
|
|
45
47
|
<pre class="whitespace-pre-wrap break-words bg-gray-50 text-xs w-full p-2"
|
|
46
|
-
>{#if content}<span
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
>{#if content}<span>{content}</span>{:else if isLoading}<Icon
|
|
49
|
+
data={faSpinner}
|
|
50
|
+
class="animate-spin"
|
|
51
|
+
/>{:else}<span class="text-gray-600">No logs are available yet</span>{/if}</pre
|
|
49
52
|
>
|
|
50
53
|
</div>
|
|
51
54
|
</div>
|
|
@@ -6,46 +6,49 @@ import TestJobLoader from './TestJobLoader.svelte';
|
|
|
6
6
|
import LogViewer from './LogViewer.svelte';
|
|
7
7
|
import DisplayResult from './DisplayResult.svelte';
|
|
8
8
|
import Button from './common/button/Button.svelte';
|
|
9
|
-
import {
|
|
9
|
+
import { faSpinner } from '@fortawesome/free-solid-svg-icons';
|
|
10
10
|
import { flowStateStore } from './flows/flowState';
|
|
11
11
|
import { flowStore } from './flows/flowStore';
|
|
12
|
-
import { Alert } from './common';
|
|
13
12
|
import { workspaceStore } from '../stores';
|
|
14
|
-
|
|
15
|
-
// Test
|
|
16
|
-
let testIsLoading = false;
|
|
17
|
-
let testJob;
|
|
13
|
+
import { Icon } from 'svelte-awesome';
|
|
18
14
|
export let mod;
|
|
19
15
|
export let schema;
|
|
16
|
+
// Test
|
|
17
|
+
let testJobLoader;
|
|
18
|
+
let testIsLoading = false;
|
|
19
|
+
let testJob = undefined;
|
|
20
20
|
let stepArgs = {};
|
|
21
21
|
export function runTestWithStepArgs() {
|
|
22
22
|
runTest(stepArgs);
|
|
23
23
|
}
|
|
24
24
|
export async function runTest(args) {
|
|
25
25
|
const val = mod.value;
|
|
26
|
+
let jobId = undefined;
|
|
26
27
|
if (val.type == 'rawscript') {
|
|
27
|
-
await testJobLoader?.runPreview(val.path, val.content, val.language, args);
|
|
28
|
+
jobId = await testJobLoader?.runPreview(val.path, val.content, val.language, args);
|
|
28
29
|
}
|
|
29
30
|
else if (val.type == 'script') {
|
|
30
31
|
const script = val.hash
|
|
31
32
|
? await ScriptService.getScriptByHash({ workspace: $workspaceStore, hash: val.hash })
|
|
32
33
|
: await getScriptByPath(val.path);
|
|
33
|
-
await testJobLoader?.runPreview(val.path, script.content, script.language, args);
|
|
34
|
+
jobId = await testJobLoader?.runPreview(val.path, script.content, script.language, args);
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
36
37
|
throw Error('not testable module type');
|
|
37
38
|
}
|
|
38
|
-
sendUserToast(`started test ${truncateRev(
|
|
39
|
+
sendUserToast(`started test ${truncateRev(jobId ?? '', 10)}`);
|
|
39
40
|
}
|
|
40
41
|
function jobDone() {
|
|
41
42
|
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob' && `result` in testJob) {
|
|
42
|
-
$flowStateStore[mod.id]
|
|
43
|
+
if ($flowStateStore[mod.id]?.previewResult) {
|
|
44
|
+
$flowStateStore[mod.id].previewResult = testJob.result;
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
</script>
|
|
46
49
|
|
|
47
50
|
<TestJobLoader
|
|
48
|
-
on:done={jobDone}
|
|
51
|
+
on:done={() => jobDone()}
|
|
49
52
|
bind:this={testJobLoader}
|
|
50
53
|
bind:isLoading={testIsLoading}
|
|
51
54
|
bind:job={testJob}
|
|
@@ -74,7 +77,7 @@ function jobDone() {
|
|
|
74
77
|
color="red"
|
|
75
78
|
size="sm"
|
|
76
79
|
startIcon={{
|
|
77
|
-
icon:
|
|
80
|
+
icon: faSpinner,
|
|
78
81
|
classes: 'animate-spin'
|
|
79
82
|
}}
|
|
80
83
|
>
|
|
@@ -94,7 +97,11 @@ function jobDone() {
|
|
|
94
97
|
</pre>
|
|
95
98
|
{:else}
|
|
96
99
|
<div class="p-2">
|
|
97
|
-
{testIsLoading
|
|
100
|
+
{#if testIsLoading}
|
|
101
|
+
<Icon data={faSpinner} class="animate-spin" />
|
|
102
|
+
{:else}
|
|
103
|
+
Test to see the result here
|
|
104
|
+
{/if}
|
|
98
105
|
</div>
|
|
99
106
|
{/if}
|
|
100
107
|
</Pane>
|
|
@@ -39,29 +39,21 @@ function close() {
|
|
|
39
39
|
use:popperRef
|
|
40
40
|
on:mouseenter={open}
|
|
41
41
|
on:mouseleave={close}
|
|
42
|
+
on:click
|
|
43
|
+
class={$$props.class}
|
|
42
44
|
>
|
|
43
45
|
<slot />
|
|
44
46
|
</button>
|
|
45
47
|
{#if showTooltip}
|
|
46
|
-
<div
|
|
48
|
+
<div
|
|
49
|
+
use:popperContent={extraOpts}
|
|
50
|
+
on:mouseenter={open}
|
|
51
|
+
on:mouseleave={close}
|
|
52
|
+
class="z-50 py-2 px-3 rounded-md text-sm font-normal !text-gray-300 bg-gray-800
|
|
53
|
+
whitespace-normal text-left {$$props.class}"
|
|
54
|
+
>
|
|
47
55
|
<div class="max-w-sm">
|
|
48
56
|
<slot name="text" />
|
|
49
57
|
</div>
|
|
50
58
|
</div>
|
|
51
59
|
{/if}
|
|
52
|
-
|
|
53
|
-
<style>
|
|
54
|
-
#tooltip {
|
|
55
|
-
z-index: 50;
|
|
56
|
-
white-space: normal;
|
|
57
|
-
border-radius: 0.75rem;
|
|
58
|
-
--tw-bg-opacity: 1;
|
|
59
|
-
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
|
60
|
-
padding: 1rem;
|
|
61
|
-
text-align: left;
|
|
62
|
-
font-size: 0.875rem;
|
|
63
|
-
line-height: 1.25rem;
|
|
64
|
-
font-weight: 400;
|
|
65
|
-
--tw-text-opacity: 1;
|
|
66
|
-
color: rgb(209 213 219 / var(--tw-text-opacity))
|
|
67
|
-
}</style>
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
export let options;
|
|
3
3
|
export let value;
|
|
4
4
|
export let disabled = false;
|
|
5
|
+
export let labelClass = '';
|
|
6
|
+
export let inputClass = '';
|
|
5
7
|
import { createEventDispatcher } from 'svelte';
|
|
6
8
|
import Tooltip from './Tooltip.svelte';
|
|
7
9
|
const dispatch = createEventDispatcher();
|
|
8
10
|
</script>
|
|
9
11
|
|
|
10
12
|
<fieldset class="w-full">
|
|
11
|
-
<legend class="sr-only">{label}</legend>
|
|
13
|
+
<legend class="sr-only {labelClass}">{label}</legend>
|
|
12
14
|
<div class="flex flex-row flex-wrap gap-2 items-center mb-2 w-full">
|
|
13
15
|
{#each options as [label, val]}
|
|
14
16
|
<label
|
|
15
17
|
class="text-center text-sm border border-gray-300 h-full rounded-sm cursor-pointer p-2
|
|
16
|
-
grow whitespace-nowrap hover:border-gray-600 hover:bg-gray-100
|
|
17
|
-
{val === value ? '!bg-blue-50 !border-blue-500' : ''}"
|
|
18
|
+
grow whitespace-nowrap duration-200 hover:border-gray-600 hover:bg-gray-100
|
|
19
|
+
{val === value ? '!bg-blue-50 !border-blue-500' : ''} {inputClass}"
|
|
18
20
|
>
|
|
19
21
|
<input
|
|
20
22
|
{disabled}
|
|
@@ -144,8 +144,9 @@ function parseJson() {
|
|
|
144
144
|
{#if !emptyString(jsonError)}<span
|
|
145
145
|
class="text-red-400 text-xs mb-1 flex flex-row-reverse">{jsonError}</span
|
|
146
146
|
>{:else}<div class="py-2" />{/if}
|
|
147
|
-
<div class="h-full w-full">
|
|
147
|
+
<div class="h-full w-full border p-1 rounded">
|
|
148
148
|
<SimpleEditor
|
|
149
|
+
autoHeight
|
|
149
150
|
class="editor"
|
|
150
151
|
lang="json"
|
|
151
152
|
bind:code={rawCode}
|
|
@@ -11,6 +11,9 @@ import Tooltip from './Tooltip.svelte';
|
|
|
11
11
|
import { flip } from 'svelte/animate';
|
|
12
12
|
const dispatch = createEventDispatcher();
|
|
13
13
|
export let schema = emptySchema();
|
|
14
|
+
if (!schema) {
|
|
15
|
+
schema = emptySchema();
|
|
16
|
+
}
|
|
14
17
|
let schemaModal;
|
|
15
18
|
let schemaString = '';
|
|
16
19
|
// Internal state: bound to args builder modal
|