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
|
@@ -6,11 +6,12 @@ declare const __propDef: {
|
|
|
6
6
|
job?: Job | undefined;
|
|
7
7
|
workspaceOverride?: string | undefined;
|
|
8
8
|
notfound?: boolean | undefined;
|
|
9
|
-
abstractRun?: ((fn: () => Promise<string>) => Promise<
|
|
10
|
-
runScriptByPath?: ((path: string | undefined, args: Record<string, any>) => Promise<
|
|
11
|
-
runFlowByPath?: ((path: string | undefined, args: Record<string, any>) => Promise<
|
|
12
|
-
runPreview?: ((path: string | undefined, code: string, lang: 'deno' | 'go' | 'python3' | 'bash', args: Record<string, any>) => Promise<
|
|
9
|
+
abstractRun?: ((fn: () => Promise<string>) => Promise<string>) | undefined;
|
|
10
|
+
runScriptByPath?: ((path: string | undefined, args: Record<string, any>) => Promise<string>) | undefined;
|
|
11
|
+
runFlowByPath?: ((path: string | undefined, args: Record<string, any>) => Promise<string>) | undefined;
|
|
12
|
+
runPreview?: ((path: string | undefined, code: string, lang: 'deno' | 'go' | 'python3' | 'bash', args: Record<string, any>) => Promise<string>) | undefined;
|
|
13
13
|
cancelJob?: (() => Promise<void>) | undefined;
|
|
14
|
+
clearCurrentJob?: (() => Promise<void>) | undefined;
|
|
14
15
|
watchJob?: ((testId: string) => Promise<void>) | undefined;
|
|
15
16
|
};
|
|
16
17
|
events: {
|
|
@@ -24,11 +25,12 @@ export type TestJobLoaderProps = typeof __propDef.props;
|
|
|
24
25
|
export type TestJobLoaderEvents = typeof __propDef.events;
|
|
25
26
|
export type TestJobLoaderSlots = typeof __propDef.slots;
|
|
26
27
|
export default class TestJobLoader extends SvelteComponentTyped<TestJobLoaderProps, TestJobLoaderEvents, TestJobLoaderSlots> {
|
|
27
|
-
get abstractRun(): (fn: () => Promise<string>) => Promise<
|
|
28
|
-
get runScriptByPath(): (path: string | undefined, args: Record<string, any>) => Promise<
|
|
29
|
-
get runFlowByPath(): (path: string | undefined, args: Record<string, any>) => Promise<
|
|
30
|
-
get runPreview(): (path: string | undefined, code: string, lang: "deno" | "python3" | "go" | "bash", args: Record<string, any>) => Promise<
|
|
28
|
+
get abstractRun(): (fn: () => Promise<string>) => Promise<string>;
|
|
29
|
+
get runScriptByPath(): (path: string | undefined, args: Record<string, any>) => Promise<string>;
|
|
30
|
+
get runFlowByPath(): (path: string | undefined, args: Record<string, any>) => Promise<string>;
|
|
31
|
+
get runPreview(): (path: string | undefined, code: string, lang: "deno" | "python3" | "go" | "bash", args: Record<string, any>) => Promise<string>;
|
|
31
32
|
get cancelJob(): () => Promise<void>;
|
|
33
|
+
get clearCurrentJob(): () => Promise<void>;
|
|
32
34
|
get watchJob(): (testId: string) => Promise<void>;
|
|
33
35
|
}
|
|
34
36
|
export {};
|
package/components/Toggle.svelte
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { classNames } from '../utils';
|
|
2
|
+
import { createEventDispatcher } from 'svelte';
|
|
2
3
|
export let options = {};
|
|
3
4
|
export let checked = false;
|
|
4
5
|
export let disabled = false;
|
|
6
|
+
export let size = 'sm';
|
|
5
7
|
const id = (Math.random() + 1).toString(36).substring(10);
|
|
6
8
|
const dispatch = createEventDispatcher();
|
|
7
9
|
</script>
|
|
8
10
|
|
|
9
|
-
<span class={$$props.class}>
|
|
10
|
-
<label
|
|
11
|
+
<span class="{$$props.class} z-auto">
|
|
12
|
+
<label
|
|
13
|
+
for={id}
|
|
14
|
+
class="inline-flex items-center mt-2 duration-200 {disabled
|
|
15
|
+
? 'grayscale opacity-50'
|
|
16
|
+
: 'cursor-pointer'}"
|
|
17
|
+
>
|
|
11
18
|
{#if Boolean(options?.left)}
|
|
12
|
-
<span
|
|
19
|
+
<span
|
|
20
|
+
class="mr-2 text-sm font-medium duration-200 {disabled ? 'text-gray-600' : 'text-gray-900'}"
|
|
21
|
+
>
|
|
22
|
+
{options?.left}
|
|
23
|
+
</span>
|
|
13
24
|
{/if}
|
|
14
|
-
|
|
25
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
26
|
+
<div class="relative" on:pointerdown on:click|stopPropagation>
|
|
15
27
|
<input
|
|
28
|
+
on:focus
|
|
29
|
+
on:click
|
|
16
30
|
{disabled}
|
|
17
31
|
type="checkbox"
|
|
18
32
|
value={false}
|
|
@@ -24,11 +38,20 @@ const dispatch = createEventDispatcher();
|
|
|
24
38
|
}}
|
|
25
39
|
/>
|
|
26
40
|
<div
|
|
27
|
-
class="w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-blue-300
|
|
41
|
+
class="w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-4 peer-focus:ring-blue-300
|
|
42
|
+
peer-checked:after:translate-x-full peer-checked:after:border-white after:content-['']
|
|
43
|
+
after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300
|
|
44
|
+
after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"
|
|
28
45
|
/>
|
|
29
46
|
</div>
|
|
30
47
|
{#if Boolean(options?.right)}
|
|
31
|
-
<span
|
|
48
|
+
<span
|
|
49
|
+
class="ml-2 text-sm font-medium duration-200
|
|
50
|
+
{disabled ? 'text-gray-500' : 'text-gray-900'}
|
|
51
|
+
{size === 'xs' ? 'text-xs' : 'text-sm'}"
|
|
52
|
+
>
|
|
53
|
+
{options?.right}
|
|
54
|
+
</span>
|
|
32
55
|
{/if}
|
|
33
56
|
</label>
|
|
34
57
|
</span>
|
|
@@ -8,8 +8,12 @@ declare const __propDef: {
|
|
|
8
8
|
} | undefined;
|
|
9
9
|
checked?: boolean | undefined;
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
|
+
size?: "xs" | "sm" | undefined;
|
|
11
12
|
};
|
|
12
13
|
events: {
|
|
14
|
+
pointerdown: PointerEvent;
|
|
15
|
+
click: MouseEvent;
|
|
16
|
+
focus: FocusEvent;
|
|
13
17
|
change: CustomEvent<any>;
|
|
14
18
|
} & {
|
|
15
19
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { Button } from '../../../common';
|
|
2
|
-
import {
|
|
2
|
+
import { faSpinner } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { getContext } from 'svelte';
|
|
4
4
|
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
5
5
|
import InputValue from '../helpers/InputValue.svelte';
|
|
@@ -11,15 +11,19 @@ export let recomputeIds = undefined;
|
|
|
11
11
|
export let extraQueryParams = {};
|
|
12
12
|
export let horizontalAlignment = undefined;
|
|
13
13
|
export let verticalAlignment = undefined;
|
|
14
|
+
export let noWFull = false;
|
|
14
15
|
export const staticOutputs = ['loading', 'result'];
|
|
15
16
|
const { runnableComponents, worldStore } = getContext('AppEditorContext');
|
|
16
|
-
let labelValue
|
|
17
|
+
let labelValue;
|
|
17
18
|
let color;
|
|
18
19
|
let size;
|
|
19
20
|
let runnableComponent;
|
|
20
21
|
let isLoading = false;
|
|
21
22
|
let ownClick = false;
|
|
22
23
|
$: outputs = $worldStore?.outputsById[id];
|
|
24
|
+
$: if (outputs?.loading != undefined) {
|
|
25
|
+
outputs.loading.set(false, true);
|
|
26
|
+
}
|
|
23
27
|
$: outputs?.loading.subscribe({
|
|
24
28
|
next: (value) => {
|
|
25
29
|
isLoading = value;
|
|
@@ -42,9 +46,15 @@ $: loading = isLoading && ownClick;
|
|
|
42
46
|
{extraQueryParams}
|
|
43
47
|
autoRefresh={false}
|
|
44
48
|
>
|
|
45
|
-
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
49
|
+
<AlignWrapper {noWFull} {horizontalAlignment} {verticalAlignment}>
|
|
46
50
|
<Button
|
|
47
|
-
on:
|
|
51
|
+
on:pointerdown={(e) => {
|
|
52
|
+
e?.stopPropagation()
|
|
53
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
54
|
+
}}
|
|
55
|
+
on:click={(e) => {
|
|
56
|
+
e?.stopPropagation()
|
|
57
|
+
e?.preventDefault()
|
|
48
58
|
ownClick = true
|
|
49
59
|
runnableComponent?.runComponent()
|
|
50
60
|
|
|
@@ -56,12 +66,17 @@ $: loading = isLoading && ownClick;
|
|
|
56
66
|
}}
|
|
57
67
|
{size}
|
|
58
68
|
{color}
|
|
59
|
-
endIcon={
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
endIcon={loading
|
|
70
|
+
? {
|
|
71
|
+
icon: faSpinner,
|
|
72
|
+
classes: 'animate-spin w-4'
|
|
73
|
+
}
|
|
74
|
+
: undefined}
|
|
63
75
|
>
|
|
64
76
|
{labelValue}
|
|
77
|
+
{#if !loading}
|
|
78
|
+
<span class="w-5" />
|
|
79
|
+
{/if}
|
|
65
80
|
</Button>
|
|
66
81
|
</AlignWrapper>
|
|
67
82
|
</RunnableWrapper>
|
|
@@ -9,6 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
extraQueryParams?: Record<string, any> | undefined;
|
|
10
10
|
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
11
11
|
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
12
|
+
noWFull?: boolean | undefined;
|
|
12
13
|
staticOutputs?: string[] | undefined;
|
|
13
14
|
};
|
|
14
15
|
events: {
|
|
@@ -20,7 +20,12 @@ $: backgroundColor = {
|
|
|
20
20
|
const options = {
|
|
21
21
|
responsive: true,
|
|
22
22
|
animation: false,
|
|
23
|
-
maintainAspectRatio: false
|
|
23
|
+
maintainAspectRatio: false,
|
|
24
|
+
plugins: {
|
|
25
|
+
legend: {
|
|
26
|
+
display: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
24
29
|
};
|
|
25
30
|
$: data = {
|
|
26
31
|
labels,
|
|
@@ -36,7 +41,7 @@ $: data = {
|
|
|
36
41
|
<InputValue {id} input={configuration.theme} bind:value={theme} />
|
|
37
42
|
<InputValue {id} input={configuration.labels} bind:value={labels} />
|
|
38
43
|
|
|
39
|
-
<RunnableWrapper bind:componentInput {id} bind:result>
|
|
44
|
+
<RunnableWrapper autoRefresh bind:componentInput {id} bind:result>
|
|
40
45
|
{#if result}
|
|
41
46
|
<Bar {data} {options} />
|
|
42
47
|
{/if}
|
|
@@ -36,7 +36,7 @@ $: data = {
|
|
|
36
36
|
<InputValue {id} input={configuration.theme} bind:value={theme} />
|
|
37
37
|
<InputValue {id} input={configuration.labels} bind:value={labels} />
|
|
38
38
|
|
|
39
|
-
<RunnableWrapper bind:componentInput {id} bind:result>
|
|
39
|
+
<RunnableWrapper autoRefresh bind:componentInput {id} bind:result>
|
|
40
40
|
{#if result}
|
|
41
41
|
<Pie {data} {options} />
|
|
42
42
|
{/if}
|
|
@@ -19,6 +19,9 @@ let runnableComponent;
|
|
|
19
19
|
let isLoading = false;
|
|
20
20
|
let ownClick = false;
|
|
21
21
|
$: outputs = $worldStore?.outputsById[id];
|
|
22
|
+
$: if (outputs?.loading != undefined) {
|
|
23
|
+
outputs.loading.set(false, true);
|
|
24
|
+
}
|
|
22
25
|
$: outputs?.loading.subscribe({
|
|
23
26
|
next: (value) => {
|
|
24
27
|
isLoading = value;
|
|
@@ -44,6 +47,10 @@ $: loading = isLoading && ownClick;
|
|
|
44
47
|
>
|
|
45
48
|
<AlignWrapper {horizontalAlignment}>
|
|
46
49
|
<Button
|
|
50
|
+
on:pointerdown={(e) => {
|
|
51
|
+
e?.stopPropagation()
|
|
52
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
53
|
+
}}
|
|
47
54
|
on:click={() => {
|
|
48
55
|
runnableComponent?.runComponent()
|
|
49
56
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { classNames } from '../../../../utils';
|
|
2
2
|
export let horizontalAlignment = undefined;
|
|
3
3
|
export let verticalAlignment = undefined;
|
|
4
|
+
export let noWFull = false;
|
|
4
5
|
function tailwindHorizontalAlignment(horizontalAlignment) {
|
|
5
6
|
switch (horizontalAlignment) {
|
|
6
7
|
case 'left':
|
|
@@ -21,7 +22,7 @@ function tailwindVerticalAlignment(verticalAlignment) {
|
|
|
21
22
|
return 'items-end';
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
$: classes = classNames('flex w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment), verticalAlignment ? 'h-full' : '');
|
|
25
|
+
$: classes = classNames('flex z-auto', noWFull ? '' : 'w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment), verticalAlignment ? 'h-full' : '');
|
|
25
26
|
</script>
|
|
26
27
|
|
|
27
28
|
<div class={classes}>
|
|
@@ -4,13 +4,23 @@ import { accessPropertyByPath } from '../../utils';
|
|
|
4
4
|
export let input;
|
|
5
5
|
export let value;
|
|
6
6
|
export let id = undefined;
|
|
7
|
+
export let row = {};
|
|
7
8
|
const { worldStore } = getContext('AppEditorContext');
|
|
9
|
+
$: input && setDefault();
|
|
8
10
|
$: state = $worldStore?.state;
|
|
9
|
-
$: input && $worldStore && handleConnection();
|
|
11
|
+
$: input && $worldStore && row && handleConnection();
|
|
10
12
|
$: input && $state && input.type == 'template' && setValue();
|
|
13
|
+
function setDefault() {
|
|
14
|
+
if (!value && input.defaultValue) {
|
|
15
|
+
value = input.defaultValue;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
11
18
|
function handleConnection() {
|
|
12
19
|
if (input.type === 'connected') {
|
|
13
|
-
$worldStore?.connect(input, onValueChange
|
|
20
|
+
$worldStore?.connect(input, onValueChange);
|
|
21
|
+
}
|
|
22
|
+
else if (input.type === 'row') {
|
|
23
|
+
value = row[input.column];
|
|
14
24
|
}
|
|
15
25
|
else if (input.type === 'static' || input.type == 'template') {
|
|
16
26
|
setValue();
|
|
@@ -75,9 +85,11 @@ function onValueChange(newValue) {
|
|
|
75
85
|
const { path } = connection;
|
|
76
86
|
const hasSubPath = ['.', '['].some((x) => path.includes(x));
|
|
77
87
|
if (hasSubPath) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
const realPath = path
|
|
89
|
+
.replace(/\[(\w+)\]/g, '.$1')
|
|
90
|
+
.split('.')
|
|
91
|
+
.slice(1)
|
|
92
|
+
.join('.');
|
|
81
93
|
value = accessPropertyByPath(newValue, realPath);
|
|
82
94
|
}
|
|
83
95
|
else {
|
|
@@ -6,6 +6,9 @@ export let id;
|
|
|
6
6
|
// Sync the result to the output
|
|
7
7
|
const { worldStore } = getContext('AppEditorContext');
|
|
8
8
|
$: outputs = $worldStore?.outputsById[id];
|
|
9
|
+
$: if (outputs?.loading != undefined) {
|
|
10
|
+
outputs.loading.set(false, true);
|
|
11
|
+
}
|
|
9
12
|
function setOutput() {
|
|
10
13
|
if (outputs) {
|
|
11
14
|
outputs.result?.set(result);
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
<script>import Button from '../../../common/button/Button.svelte';
|
|
2
2
|
import { faRefresh } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { RefreshCcw, RefreshCw } from 'lucide-svelte';
|
|
3
4
|
import { getContext } from 'svelte';
|
|
4
5
|
export let componentId;
|
|
5
|
-
const { runnableComponents } = getContext('AppEditorContext');
|
|
6
|
-
let loading = false;
|
|
6
|
+
const { runnableComponents, worldStore } = getContext('AppEditorContext');
|
|
7
7
|
async function refresh() {
|
|
8
|
-
|
|
8
|
+
window.dispatchEvent(new Event('pointerup'));
|
|
9
9
|
await $runnableComponents[componentId]?.();
|
|
10
|
-
loading = false;
|
|
11
10
|
}
|
|
11
|
+
let loading = false;
|
|
12
|
+
$: $worldStore?.outputsById[componentId]?.['loading']?.subscribe({
|
|
13
|
+
next: (value) => {
|
|
14
|
+
loading = value;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
12
17
|
</script>
|
|
13
18
|
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
<button
|
|
20
|
+
on:pointerdown|preventDefault|stopPropagation
|
|
21
|
+
on:click|preventDefault|stopPropagation={refresh}
|
|
22
|
+
class="center-center p-1 rounded border bg-white/60 z-40"
|
|
23
|
+
>
|
|
24
|
+
<RefreshCw class={loading ? 'animate-spin' : ''} size={16} />
|
|
25
|
+
</button>
|
|
@@ -4,10 +4,12 @@ import SchemaForm from '../../../SchemaForm.svelte';
|
|
|
4
4
|
import TestJobLoader from '../../../TestJobLoader.svelte';
|
|
5
5
|
import { AppService } from '../../../../gen';
|
|
6
6
|
import { workspaceStore } from '../../../../stores';
|
|
7
|
+
import { emptySchema } from '../../../../utils';
|
|
7
8
|
import { getContext, onMount } from 'svelte';
|
|
8
9
|
import { fieldTypeToTsType, loadSchema, schemaToInputsSpec } from '../../utils';
|
|
9
10
|
import InputValue from './InputValue.svelte';
|
|
10
11
|
import MissingConnectionWarning from './MissingConnectionWarning.svelte';
|
|
12
|
+
import RefreshButton from './RefreshButton.svelte';
|
|
11
13
|
// Component props
|
|
12
14
|
export let id;
|
|
13
15
|
export let fields;
|
|
@@ -29,14 +31,16 @@ let args = {};
|
|
|
29
31
|
let schema = undefined;
|
|
30
32
|
let testIsLoading = false;
|
|
31
33
|
let runnableInputValues = {};
|
|
32
|
-
$: mergedArgs = { ...extraQueryParams, ...runnableInputValues, ...args };
|
|
33
34
|
function setStaticInputsToArgs() {
|
|
35
|
+
let nargs = {};
|
|
34
36
|
Object.entries(fields ?? {}).forEach(([key, value]) => {
|
|
35
37
|
if (value.type === 'static') {
|
|
36
|
-
|
|
38
|
+
nargs[key] = value.value;
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
|
-
args
|
|
41
|
+
if (JSON.stringify(args) != JSON.stringify(nargs)) {
|
|
42
|
+
args = nargs;
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
$: fields && setStaticInputsToArgs();
|
|
42
46
|
function argMergedArgsValid(mergedArgs, testJobLoader) {
|
|
@@ -53,15 +57,21 @@ function argMergedArgsValid(mergedArgs, testJobLoader) {
|
|
|
53
57
|
}
|
|
54
58
|
return areAllArgsValid;
|
|
55
59
|
}
|
|
56
|
-
$: isValid =
|
|
60
|
+
$: isValid =
|
|
61
|
+
Object.keys(fields ?? {}).length == 0 ||
|
|
62
|
+
argMergedArgsValid({ ...extraQueryParams, ...runnableInputValues, ...args }, testJobLoader);
|
|
57
63
|
// Test job internal state
|
|
58
64
|
let testJob = undefined;
|
|
59
65
|
let testJobLoader = undefined;
|
|
60
66
|
$: outputs = $worldStore?.outputsById[id];
|
|
67
|
+
$: if (outputs?.loading != undefined) {
|
|
68
|
+
outputs.loading.set(false, true);
|
|
69
|
+
}
|
|
61
70
|
async function loadSchemaFromTriggerable(workspace, path, runType) {
|
|
62
|
-
return loadSchema(workspace, path, runType);
|
|
71
|
+
return loadSchema(workspace, path, runType) ?? emptySchema();
|
|
63
72
|
}
|
|
64
|
-
$: runnable && loadSchemaAndInputsByName();
|
|
73
|
+
$: runnable?.type === 'runnableByName' && loadSchemaAndInputsByName();
|
|
74
|
+
$: !schema && runnable?.type === 'runnableByPath' && loadSchemaAndInputsByPath();
|
|
65
75
|
async function loadSchemaAndInputsByName() {
|
|
66
76
|
if (runnable?.type === 'runnableByName') {
|
|
67
77
|
const { inlineScript } = runnable;
|
|
@@ -69,7 +79,7 @@ async function loadSchemaAndInputsByName() {
|
|
|
69
79
|
if (inlineScript) {
|
|
70
80
|
const newSchema = inlineScript.schema;
|
|
71
81
|
schema = newSchema;
|
|
72
|
-
const newFields = reloadInputs();
|
|
82
|
+
const newFields = reloadInputs(newSchema);
|
|
73
83
|
if (JSON.stringify(newFields) !== JSON.stringify(fields)) {
|
|
74
84
|
fields = newFields;
|
|
75
85
|
setTimeout(() => {
|
|
@@ -93,10 +103,9 @@ async function loadSchemaAndInputsByPath() {
|
|
|
93
103
|
fields = schemaToInputsSpec(schemaWithoutExtraQueries);
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
|
-
$: !schema && runnable?.type === 'runnableByPath' && loadSchemaAndInputsByPath();
|
|
97
106
|
// When the schema is loaded, we need to update the inputs spec
|
|
98
107
|
// in order to render the inputs the component panel
|
|
99
|
-
function reloadInputs() {
|
|
108
|
+
function reloadInputs(schema) {
|
|
100
109
|
let schemaWithoutExtraQueries = JSON.parse(JSON.stringify(schema));
|
|
101
110
|
// Remove extra query params from the schema, which are not directly configurable by the user
|
|
102
111
|
Object.keys(extraQueryParams).forEach((key) => {
|
|
@@ -131,7 +140,7 @@ function stripSchema(schema, inputs) {
|
|
|
131
140
|
// Remove hidden static inputs
|
|
132
141
|
Object.keys(inputs ?? {}).forEach((key) => {
|
|
133
142
|
const input = inputs[key];
|
|
134
|
-
if (input.type === 'static' &&
|
|
143
|
+
if (input.type === 'static' && schemaStripped !== undefined) {
|
|
135
144
|
delete schemaStripped.properties[key];
|
|
136
145
|
}
|
|
137
146
|
if (input.type === 'connected' && schemaStripped !== undefined) {
|
|
@@ -162,7 +171,7 @@ async function executeComponent() {
|
|
|
162
171
|
outputs?.loading?.set(true);
|
|
163
172
|
await testJobLoader?.abstractRun(() => {
|
|
164
173
|
const requestBody = {
|
|
165
|
-
args:
|
|
174
|
+
args: { ...extraQueryParams, ...args, ...runnableInputValues },
|
|
166
175
|
force_viewer_static_fields: {}
|
|
167
176
|
};
|
|
168
177
|
if (runnable?.type === 'runnableByName') {
|
|
@@ -192,7 +201,12 @@ export async function runComponent() {
|
|
|
192
201
|
</script>
|
|
193
202
|
|
|
194
203
|
{#each Object.keys(fields ?? {}) as key}
|
|
195
|
-
<InputValue
|
|
204
|
+
<InputValue
|
|
205
|
+
{id}
|
|
206
|
+
input={fields[key]}
|
|
207
|
+
bind:value={runnableInputValues[key]}
|
|
208
|
+
row={extraQueryParams['row'] ?? {}}
|
|
209
|
+
/>
|
|
196
210
|
{/each}
|
|
197
211
|
|
|
198
212
|
<TestJobLoader
|
|
@@ -210,18 +224,29 @@ export async function runComponent() {
|
|
|
210
224
|
|
|
211
225
|
<div class="h-full flex flex-col">
|
|
212
226
|
{#if schemaStripped !== undefined && (autoRefresh || forceSchemaDisplay)}
|
|
213
|
-
<SchemaForm
|
|
227
|
+
<SchemaForm
|
|
228
|
+
schema={schemaStripped}
|
|
229
|
+
bind:args
|
|
230
|
+
{isValid}
|
|
231
|
+
{disabledArgs}
|
|
232
|
+
shouldHideNoInputs
|
|
233
|
+
noVariablePicker
|
|
234
|
+
/>
|
|
214
235
|
{/if}
|
|
215
236
|
|
|
216
237
|
{#if !runnable && autoRefresh}
|
|
217
|
-
<Alert type="warning" size="xs" class="mt-2" title="Missing runnable">
|
|
238
|
+
<Alert type="warning" size="xs" class="mt-2 px-1" title="Missing runnable">
|
|
218
239
|
Please select a runnable
|
|
219
240
|
</Alert>
|
|
220
241
|
{:else if autoRefresh === true}
|
|
242
|
+
<div class="flex absolute top-1 right-1">
|
|
243
|
+
<RefreshButton componentId={id} />
|
|
244
|
+
</div>
|
|
245
|
+
|
|
221
246
|
{#if isValid}
|
|
222
247
|
<slot />
|
|
223
248
|
{:else}
|
|
224
|
-
<Alert type="info" size="xs" class="mt-2" title="Missing inputs">
|
|
249
|
+
<Alert type="info" size="xs" class="mt-2 px-1" title="Missing inputs">
|
|
225
250
|
Please fill in all the inputs
|
|
226
251
|
|
|
227
252
|
{#each Object.keys(fields ?? {}) as key}
|
|
@@ -19,6 +19,10 @@ $: outputs = $worldStore?.outputsById[id];
|
|
|
19
19
|
|
|
20
20
|
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
21
21
|
<Toggle
|
|
22
|
+
on:pointerdown={(e) => {
|
|
23
|
+
e?.stopPropagation()
|
|
24
|
+
window.dispatchEvent(new Event('pointerup'))
|
|
25
|
+
}}
|
|
22
26
|
bind:value
|
|
23
27
|
options={{ right: labelValue }}
|
|
24
28
|
on:change={(e) => {
|
|
@@ -16,7 +16,7 @@ export let configuration;
|
|
|
16
16
|
export let actionButtons;
|
|
17
17
|
export const staticOutputs = ['selectedRow', 'loading', 'result'];
|
|
18
18
|
$: result = [];
|
|
19
|
-
let search =
|
|
19
|
+
let search = undefined;
|
|
20
20
|
let searchValue = '';
|
|
21
21
|
let pagination = undefined;
|
|
22
22
|
let page = 1;
|
|
@@ -60,11 +60,19 @@ function searchInResult(result, searchValue) {
|
|
|
60
60
|
}
|
|
61
61
|
return result.filter((row) => Object.values(row).some((value) => value.toString().includes(searchValue)));
|
|
62
62
|
}
|
|
63
|
+
function renderCell(x, props) {
|
|
64
|
+
try {
|
|
65
|
+
return flexRender(x, props);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
63
71
|
let filteredResult = [];
|
|
64
72
|
$: filteredResult && setOptions(filteredResult);
|
|
65
|
-
$: extraQueryParams = search === '
|
|
66
|
-
$: search === '
|
|
67
|
-
$: (search === '
|
|
73
|
+
$: extraQueryParams = search === 'Runnable' ? { search: searchValue, page } : { page, search: '' };
|
|
74
|
+
$: search === 'Runnable' && (filteredResult = searchInResult(result, searchValue));
|
|
75
|
+
$: (search === 'Runnable' || search === 'Disabled') && (filteredResult = result);
|
|
68
76
|
$: outputs = $worldStore?.outputsById[id];
|
|
69
77
|
function rerender() {
|
|
70
78
|
table = createSvelteTable(options);
|
|
@@ -78,29 +86,33 @@ $: result && rerender();
|
|
|
78
86
|
<RunnableWrapper bind:componentInput {id} bind:result {extraQueryParams}>
|
|
79
87
|
{#if Array.isArray(result) && result.every(isObject)}
|
|
80
88
|
<div class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full">
|
|
81
|
-
|
|
82
|
-
<div class="
|
|
83
|
-
<
|
|
84
|
-
{#if search !== 'Disabled'}
|
|
89
|
+
{#if search !== 'Disabled'}
|
|
90
|
+
<div class="px-4 py-2">
|
|
91
|
+
<div class="flex items-center">
|
|
85
92
|
<div>
|
|
86
93
|
<DebouncedInput placeholder="Search..." bind:value={searchValue} />
|
|
87
94
|
</div>
|
|
88
|
-
|
|
95
|
+
</div>
|
|
89
96
|
</div>
|
|
90
|
-
|
|
97
|
+
{/if}
|
|
98
|
+
|
|
91
99
|
<div class="overflow-auto flex-1 w-full">
|
|
92
100
|
<table class="divide-y divide-gray-300 w-full border-b border-b-gray-200">
|
|
93
101
|
<thead class="bg-gray-50 text-left">
|
|
94
102
|
{#each $table.getHeaderGroups() as headerGroup}
|
|
95
103
|
<tr class="divide-x">
|
|
96
104
|
{#each headerGroup.headers as header}
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
{#if header?.column?.columnDef?.header}
|
|
106
|
+
{@const context = header?.getContext()}
|
|
107
|
+
{#if context}
|
|
108
|
+
{@const component = renderCell(header.column.columnDef.header, context)}
|
|
109
|
+
<th class="px-4 py-4 text-sm font-semibold">
|
|
110
|
+
{#if !header.isPlaceholder && component}
|
|
111
|
+
<svelte:component this={component} />
|
|
112
|
+
{/if}
|
|
113
|
+
</th>
|
|
102
114
|
{/if}
|
|
103
|
-
|
|
115
|
+
{/if}
|
|
104
116
|
{/each}
|
|
105
117
|
{#if actionButtons.length > 0}
|
|
106
118
|
<th class="px-4 py-4 text-sm font-semibold">Actions</th>
|
|
@@ -121,22 +133,34 @@ $: result && rerender();
|
|
|
121
133
|
? 'divide-blue-200 hover:divide-blue-300'
|
|
122
134
|
: 'divide-gray-200'
|
|
123
135
|
)}
|
|
124
|
-
on:click={() => toggleRow(row, rowIndex)}
|
|
125
136
|
>
|
|
126
137
|
{#each row.getVisibleCells() as cell, index (index)}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
{#if cell?.column?.columnDef?.header}
|
|
139
|
+
{@const context = cell?.getContext()}
|
|
140
|
+
{#if context}
|
|
141
|
+
{@const component = renderCell(cell.column.columnDef.cell, context)}
|
|
142
|
+
<td
|
|
143
|
+
on:click={() => toggleRow(row, rowIndex)}
|
|
144
|
+
class="p-4 whitespace-nowrap text-xs text-gray-900"
|
|
145
|
+
>
|
|
146
|
+
{#if component != undefined}
|
|
147
|
+
<svelte:component this={component} />
|
|
148
|
+
{/if}
|
|
149
|
+
</td>
|
|
150
|
+
{/if}
|
|
151
|
+
{/if}
|
|
132
152
|
{/each}
|
|
133
153
|
|
|
134
154
|
{#if actionButtons.length > 0}
|
|
135
|
-
<td
|
|
155
|
+
<td
|
|
156
|
+
class="flex w-full flex-row gap-2 p-4"
|
|
157
|
+
on:click={() => toggleRow(row, rowIndex)}
|
|
158
|
+
>
|
|
136
159
|
{#each actionButtons as actionButton, actionIndex (actionIndex)}
|
|
137
160
|
<AppButton
|
|
161
|
+
noWFull
|
|
138
162
|
{...actionButton}
|
|
139
|
-
extraQueryParams={{ row: row.original
|
|
163
|
+
extraQueryParams={{ row: row.original }}
|
|
140
164
|
bind:componentInput={actionButton.componentInput}
|
|
141
165
|
bind:staticOutputs={$staticOutputsStore[actionButton.id]}
|
|
142
166
|
/>
|