windmill-components 1.55.0 → 1.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.d.ts +1 -1
- package/common.js +3 -0
- package/components/AppConnect.svelte +2 -2
- package/components/ArgInput.svelte +1 -1
- package/components/CronInput.svelte +54 -53
- package/components/Dropdown.svelte +21 -9
- package/components/Editor.svelte +10 -10
- package/components/EditorBar.svelte +2 -2
- package/components/FlowBuilder.svelte +41 -25
- package/components/FlowGraphViewer.svelte +6 -2
- package/components/FlowMetadata.svelte +8 -3
- package/components/FlowViewer.svelte +2 -2
- package/components/FolderEditor.svelte +299 -0
- package/components/FolderEditor.svelte.d.ts +16 -0
- package/components/FolderInfo.svelte +13 -0
- package/components/FolderInfo.svelte.d.ts +16 -0
- package/components/FolderUsageInfo.svelte +17 -0
- package/components/FolderUsageInfo.svelte.d.ts +16 -0
- package/components/GroupEditor.svelte +287 -0
- package/components/GroupEditor.svelte.d.ts +18 -0
- package/components/GroupInfo.svelte +22 -0
- package/components/GroupInfo.svelte.d.ts +16 -0
- package/components/InputTransformForm.svelte +16 -7
- package/components/MoveDrawer.svelte +75 -0
- package/components/MoveDrawer.svelte.d.ts +19 -0
- package/components/Path.svelte +243 -96
- package/components/Path.svelte.d.ts +1 -4
- package/components/RadioButton.svelte +2 -0
- package/components/RadioButton.svelte.d.ts +1 -0
- package/components/ResourceEditor.svelte +11 -16
- package/components/RunForm.svelte +21 -4
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/ScheduleEditor.svelte +226 -0
- package/components/ScheduleEditor.svelte.d.ts +26 -0
- package/components/ScriptBuilder.svelte +109 -114
- package/components/ScriptEditor.svelte +17 -14
- package/components/ScriptEditor.svelte.d.ts +1 -0
- package/components/ScriptPicker.svelte +55 -29
- package/components/ScriptPicker.svelte.d.ts +1 -0
- package/components/ShareModal.svelte +94 -73
- package/components/ShareModal.svelte.d.ts +2 -4
- package/components/SimpleEditor.svelte +15 -10
- package/components/TemplateEditor.svelte +496 -0
- package/components/TemplateEditor.svelte.d.ts +25 -0
- package/components/TestJobLoader.svelte +1 -1
- package/components/VariableEditor.svelte +2 -1
- package/components/apps/CreateApp.svelte +1 -1
- package/components/apps/components/buttons/AppButton.svelte +3 -3
- package/components/apps/components/dataDisplay/AppBarChart.svelte +5 -4
- package/components/apps/components/dataDisplay/AppPieChart.svelte +3 -3
- package/components/apps/components/dateInputs/AppDateInput.svelte +34 -0
- package/components/apps/components/dateInputs/AppDateInput.svelte.d.ts +22 -0
- package/components/apps/components/form/AppForm.svelte +4 -5
- package/components/apps/components/form/AppForm.svelte.d.ts +0 -1
- package/components/apps/components/helpers/AlignWrapper.svelte +3 -4
- package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +2 -3
- package/components/apps/components/helpers/InputValue.svelte +54 -5
- package/components/apps/components/helpers/InputValue.svelte.d.ts +1 -0
- package/components/apps/components/helpers/NonRunnableComponent.svelte +2 -1
- package/components/apps/components/helpers/RefreshButton.svelte +20 -0
- package/components/apps/components/helpers/RefreshButton.svelte.d.ts +16 -0
- package/components/apps/components/helpers/RunnableComponent.svelte +38 -42
- package/components/apps/components/helpers/RunnableWrapper.svelte +6 -3
- package/components/apps/components/numberInputs/AppNumberInput.svelte +8 -11
- package/components/apps/components/numberInputs/AppNumberInput.svelte.d.ts +1 -0
- package/components/apps/components/selectInputs/AppCheckbox.svelte +1 -1
- package/components/apps/components/selectInputs/AppSelect.svelte +26 -0
- package/components/apps/components/selectInputs/AppSelect.svelte.d.ts +22 -0
- package/components/apps/components/table/AppTable.svelte +159 -0
- package/components/apps/components/{dataDisplay → table}/AppTable.svelte.d.ts +0 -0
- package/components/apps/components/table/AppTableFooter.svelte +54 -0
- package/components/apps/components/table/AppTableFooter.svelte.d.ts +20 -0
- package/components/apps/components/table/tableOptions.d.ts +10 -0
- package/components/apps/components/table/tableOptions.js +11 -0
- package/components/apps/components/textInputs/AppTextInput.svelte +17 -10
- package/components/apps/components/textInputs/AppTextInput.svelte.d.ts +2 -0
- package/components/apps/editor/AppEditor.svelte +35 -20
- package/components/apps/editor/AppEditorHeader.svelte +15 -7
- package/components/apps/editor/AppPreview.svelte +5 -3
- package/components/apps/editor/AppPreview.svelte.d.ts +4 -1
- package/components/apps/editor/ComponentEditor.svelte +21 -3
- package/components/apps/editor/ComponentEditor.svelte.d.ts +2 -0
- package/components/apps/editor/ComponentHeader.svelte +21 -4
- package/components/apps/editor/ComponentHeader.svelte.d.ts +2 -0
- package/components/apps/editor/GridEditor.svelte +40 -20
- package/components/apps/editor/RecomputeAllComponents.svelte +5 -7
- package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -82
- package/components/apps/editor/componentsPanel/data.js +78 -29
- package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +5 -1
- package/components/apps/editor/contextPanel/ContextPanel.svelte +35 -152
- package/components/apps/editor/contextPanel/ContextPanel.svelte.d.ts +1 -3
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +64 -0
- package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +18 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +95 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +20 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +32 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte.d.ts +19 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +63 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +17 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +44 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte.d.ts +14 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +126 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte.d.ts +16 -0
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +41 -0
- package/components/apps/editor/settingsPanel/AlignmentEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +44 -0
- package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte.d.ts +18 -0
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +48 -130
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +3 -0
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -2
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/Recompute.svelte +2 -2
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +46 -0
- package/components/apps/editor/settingsPanel/SelectedRunnable.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/common/PanelSection.svelte +1 -1
- package/components/apps/editor/settingsPanel/{ConnectedInputEditor.svelte → inputEditor/ConnectedInputEditor.svelte} +1 -2
- package/components/apps/editor/settingsPanel/{ConnectedInputEditor.svelte.d.ts → inputEditor/ConnectedInputEditor.svelte.d.ts} +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +12 -0
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +17 -0
- package/components/apps/editor/settingsPanel/{StaticInputEditor.svelte → inputEditor/StaticInputEditor.svelte} +5 -5
- package/components/apps/editor/settingsPanel/{StaticInputEditor.svelte.d.ts → inputEditor/StaticInputEditor.svelte.d.ts} +1 -1
- package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte +6 -3
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +66 -22
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +2 -3
- package/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte +1 -1
- package/components/apps/gridUtils.d.ts +3 -1
- package/components/apps/gridUtils.js +16 -1
- package/components/apps/inputType.d.ts +10 -4
- package/components/apps/rx.d.ts +8 -8
- package/components/apps/rx.js +17 -9
- package/components/apps/types.d.ts +14 -2
- package/components/apps/utils.d.ts +4 -3
- package/components/apps/utils.js +37 -5
- package/components/common/drawer/Drawer.svelte +1 -1
- package/components/common/drawer/Drawer.svelte.d.ts +1 -0
- package/components/common/popup/Popup.svelte +0 -2
- package/components/common/popup/Popup.svelte.d.ts +0 -4
- package/components/common/table/FlowRow.svelte +21 -7
- package/components/common/table/FlowRow.svelte.d.ts +2 -0
- package/components/common/table/ScriptRow.svelte +22 -7
- package/components/common/table/ScriptRow.svelte.d.ts +2 -0
- package/components/common/toggleButton/ToggleButton.svelte +1 -1
- package/components/common/toggleButton/ToggleButtonGroup.svelte +1 -1
- package/components/common/toggleButton/ToggleButtonGroup.svelte.d.ts +1 -0
- package/components/flows/content/FlowEditorPanel.svelte +10 -16
- package/components/flows/content/FlowInputs.svelte +18 -4
- package/components/flows/content/FlowInputs.svelte.d.ts +1 -0
- package/components/flows/content/FlowModuleComponent.svelte +1 -1
- package/components/flows/content/FlowModuleWrapper.svelte +26 -1
- package/components/flows/content/FlowSchedules.svelte +5 -0
- package/components/flows/content/FlowSettings.svelte +16 -24
- package/components/flows/content/FlowSettings.svelte.d.ts +0 -1
- package/components/flows/header/FlowPreviewButtons.svelte +13 -10
- package/components/flows/map/FlowErrorHandlerItem.svelte +1 -1
- package/components/flows/map/FlowModuleSchemaMap.svelte +12 -3
- package/components/flows/map/FlowSettingsItem.svelte +8 -15
- package/components/flows/map/InsertModuleButton.svelte +29 -2
- package/components/flows/map/InsertModuleButton.svelte.d.ts +3 -1
- package/components/flows/map/MapItem.svelte +2 -1
- package/components/flows/map/MapItem.svelte.d.ts +1 -0
- package/components/flows/pickers/WorkspaceScriptPicker.svelte +3 -0
- package/components/flows/previousResults.js +1 -1
- package/components/graph/FlowGraph.svelte +15 -15
- package/components/graph/model.d.ts +35 -1
- package/components/home/ItemsList.svelte +20 -12
- package/components/jobs/JobDetail.svelte +9 -3
- package/components/sidebar/SidebarContent.svelte +4 -3
- package/components/sidebar/UserMenu.svelte +1 -1
- package/editorUtils.d.ts +7 -1
- package/editorUtils.js +98 -3
- package/es5.d.ts.txt +4526 -0
- package/gen/index.d.ts +2 -0
- package/gen/index.js +1 -0
- package/gen/models/CompletedJob.d.ts +1 -0
- package/gen/models/EditSchedule.d.ts +0 -2
- package/gen/models/Folder.d.ts +5 -0
- package/gen/models/Folder.js +4 -0
- package/gen/models/QueuedJob.d.ts +1 -0
- package/gen/models/Script.d.ts +1 -1
- package/gen/models/User.d.ts +1 -0
- package/gen/services/FolderService.d.ts +128 -0
- package/gen/services/FolderService.js +151 -0
- package/gen/services/GranularAclService.d.ts +3 -3
- package/gen/services/GroupService.d.ts +5 -1
- package/gen/services/GroupService.js +4 -1
- package/gen/services/JobService.d.ts +25 -5
- package/gen/services/JobService.js +10 -5
- package/gen/services/ScriptService.d.ts +2 -1
- package/gen/services/UserService.d.ts +9 -0
- package/gen/services/UserService.js +15 -0
- package/package.json +485 -461
- package/script_helpers.d.ts +2 -2
- package/script_helpers.js +4 -4
- package/stores.d.ts +1 -0
- package/utils.d.ts +3 -0
- package/utils.js +44 -7
- package/components/GroupModal.svelte +0 -98
- package/components/GroupModal.svelte.d.ts +0 -17
- package/components/apps/components/dataDisplay/AppTable.svelte +0 -132
- package/components/apps/components/dataDisplay/app.md +0 -49
- package/components/apps/editor/contextPanel/InlineScriptCreationPanel.svelte +0 -29
- package/components/apps/editor/contextPanel/InlineScriptCreationPanel.svelte.d.ts +0 -16
|
@@ -9,7 +9,6 @@ export let configuration;
|
|
|
9
9
|
export let recomputeIds = undefined;
|
|
10
10
|
export let extraQueryParams = {};
|
|
11
11
|
export let horizontalAlignment = undefined;
|
|
12
|
-
export let verticalAlignment = undefined;
|
|
13
12
|
export const staticOutputs = ['loading', 'result'];
|
|
14
13
|
const { runnableComponents } = getContext('AppEditorContext');
|
|
15
14
|
let labelValue = 'Default label';
|
|
@@ -18,9 +17,9 @@ let size;
|
|
|
18
17
|
let runnableComponent;
|
|
19
18
|
</script>
|
|
20
19
|
|
|
21
|
-
<InputValue input={configuration.label} bind:value={labelValue} />
|
|
22
|
-
<InputValue input={configuration.color} bind:value={color} />
|
|
23
|
-
<InputValue input={configuration.size} bind:value={size} />
|
|
20
|
+
<InputValue {id} input={configuration.label} bind:value={labelValue} />
|
|
21
|
+
<InputValue {id} input={configuration.color} bind:value={color} />
|
|
22
|
+
<InputValue {id} input={configuration.size} bind:value={size} />
|
|
24
23
|
|
|
25
24
|
<RunnableWrapper
|
|
26
25
|
bind:runnableComponent
|
|
@@ -30,7 +29,7 @@ let runnableComponent;
|
|
|
30
29
|
autoRefresh={false}
|
|
31
30
|
forceSchemaDisplay={true}
|
|
32
31
|
>
|
|
33
|
-
<AlignWrapper {horizontalAlignment}
|
|
32
|
+
<AlignWrapper {horizontalAlignment}>
|
|
34
33
|
<Button
|
|
35
34
|
on:click={() => {
|
|
36
35
|
runnableComponent?.runComponent()
|
|
@@ -8,7 +8,6 @@ declare const __propDef: {
|
|
|
8
8
|
recomputeIds?: string[] | undefined;
|
|
9
9
|
extraQueryParams?: Record<string, any> | undefined;
|
|
10
10
|
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
11
|
-
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
12
11
|
staticOutputs?: string[] | undefined;
|
|
13
12
|
};
|
|
14
13
|
events: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>import { classNames } from '../../../../utils';
|
|
2
|
-
export let horizontalAlignment;
|
|
3
|
-
export let verticalAlignment;
|
|
4
|
-
export let disableVerticalAlignment = false;
|
|
2
|
+
export let horizontalAlignment = undefined;
|
|
3
|
+
export let verticalAlignment = undefined;
|
|
5
4
|
function tailwindHorizontalAlignment(horizontalAlignment) {
|
|
6
5
|
switch (horizontalAlignment) {
|
|
7
6
|
case 'left':
|
|
@@ -22,7 +21,7 @@ function tailwindVerticalAlignment(verticalAlignment) {
|
|
|
22
21
|
return 'items-end';
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
$: classes = classNames('flex w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment),
|
|
24
|
+
$: classes = classNames('flex w-full', tailwindHorizontalAlignment(horizontalAlignment), tailwindVerticalAlignment(verticalAlignment), verticalAlignment ? 'h-full' : '');
|
|
26
25
|
</script>
|
|
27
26
|
|
|
28
27
|
<div class={classes}>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
horizontalAlignment
|
|
5
|
-
verticalAlignment
|
|
6
|
-
disableVerticalAlignment?: boolean | undefined;
|
|
4
|
+
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
5
|
+
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
7
6
|
};
|
|
8
7
|
events: {
|
|
9
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,24 +1,73 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { isCodeInjection } from '../../../flows/utils';
|
|
2
|
+
import { getContext } from 'svelte';
|
|
2
3
|
import { accessPropertyByPath } from '../../utils';
|
|
3
4
|
export let input;
|
|
4
5
|
export let value;
|
|
6
|
+
export let id = undefined;
|
|
5
7
|
const { worldStore } = getContext('AppEditorContext');
|
|
8
|
+
$: state = $worldStore?.state;
|
|
6
9
|
$: input && $worldStore && handleConnection();
|
|
10
|
+
$: input && $state && input.type == 'template' && setValue();
|
|
7
11
|
function handleConnection() {
|
|
8
12
|
if (input.type === 'connected') {
|
|
9
|
-
$worldStore?.connect(input, onValueChange);
|
|
13
|
+
$worldStore?.connect(input, onValueChange, value);
|
|
10
14
|
}
|
|
11
|
-
else if (input.type === 'static') {
|
|
15
|
+
else if (input.type === 'static' || input.type == 'template') {
|
|
12
16
|
setValue();
|
|
13
17
|
}
|
|
14
18
|
else {
|
|
15
19
|
value = undefined;
|
|
16
20
|
}
|
|
17
21
|
}
|
|
22
|
+
function computeGlobalContext() {
|
|
23
|
+
Object.prototype.toString = function () {
|
|
24
|
+
return JSON.stringify(this);
|
|
25
|
+
};
|
|
26
|
+
return Object.fromEntries(Object.entries($worldStore?.outputsById ?? {})
|
|
27
|
+
.filter(([k, _]) => k != id)
|
|
28
|
+
.map(([key, value]) => {
|
|
29
|
+
return [
|
|
30
|
+
key,
|
|
31
|
+
Object.fromEntries(Object.entries(value ?? {}).map((x) => [x[0], x[1].peak()]))
|
|
32
|
+
];
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
18
35
|
function setValue() {
|
|
19
|
-
|
|
36
|
+
console.log(computeGlobalContext());
|
|
37
|
+
if (input.type === 'template' && isCodeInjection(input.eval)) {
|
|
38
|
+
try {
|
|
39
|
+
value = eval_like('`' + input.eval + '`', computeGlobalContext());
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
value = e.message;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (input.type === 'static') {
|
|
20
46
|
value = input.value;
|
|
21
47
|
}
|
|
48
|
+
else if (input.type === 'template') {
|
|
49
|
+
value = input.eval;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function create_context_function_template(eval_string, context) {
|
|
53
|
+
return `
|
|
54
|
+
return function (context) {
|
|
55
|
+
"use strict";
|
|
56
|
+
${Object.keys(context).length > 0
|
|
57
|
+
? `let ${Object.keys(context).map((key) => ` ${key} = context['${key}']`)};`
|
|
58
|
+
: ``}
|
|
59
|
+
return ${eval_string};
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
function make_context_evaluator(eval_string, context) {
|
|
64
|
+
let template = create_context_function_template(eval_string, context);
|
|
65
|
+
let functor = Function(template);
|
|
66
|
+
return functor();
|
|
67
|
+
}
|
|
68
|
+
function eval_like(text, context = {}) {
|
|
69
|
+
let evaluator = make_context_evaluator(text, context);
|
|
70
|
+
return evaluator(context);
|
|
22
71
|
}
|
|
23
72
|
function onValueChange(newValue) {
|
|
24
73
|
if (input.type === 'connected' && newValue !== undefined && newValue !== null) {
|
|
@@ -27,7 +76,7 @@ function onValueChange(newValue) {
|
|
|
27
76
|
// No connection
|
|
28
77
|
return;
|
|
29
78
|
}
|
|
30
|
-
const {
|
|
79
|
+
const { path } = connection;
|
|
31
80
|
const hasSubPath = ['.', '['].some((x) => path.includes(x));
|
|
32
81
|
if (hasSubPath) {
|
|
33
82
|
// Must remove top level property from path
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import Button from '../../../common/button/Button.svelte';
|
|
2
|
+
import { faRefresh } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { getContext } from 'svelte';
|
|
4
|
+
export let componentId;
|
|
5
|
+
const { runnableComponents } = getContext('AppEditorContext');
|
|
6
|
+
let loading = false;
|
|
7
|
+
async function refresh() {
|
|
8
|
+
loading = true;
|
|
9
|
+
await $runnableComponents[componentId]?.();
|
|
10
|
+
loading = false;
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Button
|
|
15
|
+
iconOnly
|
|
16
|
+
startIcon={{ icon: faRefresh, classes: loading ? 'animate-spin' : '' }}
|
|
17
|
+
color="dark"
|
|
18
|
+
size="xs"
|
|
19
|
+
on:click={refresh}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
componentId: string;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type RefreshButtonProps = typeof __propDef.props;
|
|
12
|
+
export type RefreshButtonEvents = typeof __propDef.events;
|
|
13
|
+
export type RefreshButtonSlots = typeof __propDef.slots;
|
|
14
|
+
export default class RefreshButton extends SvelteComponentTyped<RefreshButtonProps, RefreshButtonEvents, RefreshButtonSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<script>import { page } from '$app/stores';
|
|
2
2
|
import Alert from '../../../common/alert/Alert.svelte';
|
|
3
|
-
import Button from '../../../common/button/Button.svelte';
|
|
4
3
|
import SchemaForm from '../../../SchemaForm.svelte';
|
|
5
4
|
import TestJobLoader from '../../../TestJobLoader.svelte';
|
|
6
5
|
import { AppService } from '../../../../gen';
|
|
7
6
|
import { workspaceStore } from '../../../../stores';
|
|
8
|
-
import { faRefresh } from '@fortawesome/free-solid-svg-icons';
|
|
9
7
|
import { getContext, onMount } from 'svelte';
|
|
10
8
|
import { loadSchema, schemaToInputsSpec } from '../../utils';
|
|
11
9
|
import InputValue from './InputValue.svelte';
|
|
@@ -17,7 +15,7 @@ export let extraQueryParams = {};
|
|
|
17
15
|
export let autoRefresh = true;
|
|
18
16
|
export let result = undefined;
|
|
19
17
|
export let forceSchemaDisplay = false;
|
|
20
|
-
const {
|
|
18
|
+
const { worldStore, runnableComponents } = getContext('AppEditorContext');
|
|
21
19
|
onMount(() => {
|
|
22
20
|
$runnableComponents[id] = async () => {
|
|
23
21
|
await executeComponent();
|
|
@@ -28,7 +26,7 @@ let args = {};
|
|
|
28
26
|
let schema = undefined;
|
|
29
27
|
let testIsLoading = false;
|
|
30
28
|
let runnableInputValues = {};
|
|
31
|
-
$: mergedArgs = { ...
|
|
29
|
+
$: mergedArgs = { ...extraQueryParams, ...runnableInputValues, ...args };
|
|
32
30
|
function setStaticInputsToArgs() {
|
|
33
31
|
Object.entries(inputs ?? {}).forEach(([key, value]) => {
|
|
34
32
|
if (value.type === 'static') {
|
|
@@ -39,8 +37,11 @@ function setStaticInputsToArgs() {
|
|
|
39
37
|
}
|
|
40
38
|
$: inputs && setStaticInputsToArgs();
|
|
41
39
|
function argMergedArgsValid(mergedArgs, testJobLoader) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
40
|
+
if (!inputs) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (Object.keys(inputs).length !==
|
|
44
|
+
Object.keys(mergedArgs).length - Object.keys(extraQueryParams).length) {
|
|
44
45
|
return false;
|
|
45
46
|
}
|
|
46
47
|
const areAllArgsValid = Object.values(mergedArgs).every((arg) => arg !== undefined && arg !== null);
|
|
@@ -64,9 +65,11 @@ $: if ($workspaceStore && runnable?.type === 'runnableByPath' && !schema) {
|
|
|
64
65
|
loadSchemaFromTriggerable($workspaceStore, path, runType);
|
|
65
66
|
}
|
|
66
67
|
else if (runnable?.type === 'runnableByName' && !schema) {
|
|
67
|
-
const {
|
|
68
|
+
const { inlineScript } = runnable;
|
|
68
69
|
// Inline scripts directly provide the schema
|
|
69
|
-
|
|
70
|
+
if (inlineScript) {
|
|
71
|
+
schema = inlineScript.schema;
|
|
72
|
+
}
|
|
70
73
|
}
|
|
71
74
|
// When the schema is loaded, we need to update the inputs spec
|
|
72
75
|
// in order to render the inputs the component panel
|
|
@@ -116,12 +119,14 @@ async function executeComponent() {
|
|
|
116
119
|
force_viewer_static_fields: {}
|
|
117
120
|
};
|
|
118
121
|
if (runnable?.type === 'runnableByName') {
|
|
119
|
-
const {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const { inlineScript } = runnable;
|
|
123
|
+
if (inlineScript) {
|
|
124
|
+
requestBody['raw_code'] = {
|
|
125
|
+
content: inlineScript.content,
|
|
126
|
+
language: inlineScript.language,
|
|
127
|
+
path: inlineScript.path
|
|
128
|
+
};
|
|
129
|
+
}
|
|
125
130
|
}
|
|
126
131
|
else if (runnable?.type === 'runnableByPath') {
|
|
127
132
|
const { path, runType } = runnable;
|
|
@@ -140,7 +145,7 @@ export async function runComponent() {
|
|
|
140
145
|
</script>
|
|
141
146
|
|
|
142
147
|
{#each Object.keys(inputs ?? {}) as key}
|
|
143
|
-
<InputValue input={inputs[key]} bind:value={runnableInputValues[key]} />
|
|
148
|
+
<InputValue {id} input={inputs[key]} bind:value={runnableInputValues[key]} />
|
|
144
149
|
{/each}
|
|
145
150
|
|
|
146
151
|
<TestJobLoader
|
|
@@ -156,33 +161,24 @@ export async function runComponent() {
|
|
|
156
161
|
bind:this={testJobLoader}
|
|
157
162
|
/>
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
164
|
+
<div class="h-full flex flex-col">
|
|
165
|
+
{#if schemaStripped !== undefined && (autoRefresh || forceSchemaDisplay)}
|
|
166
|
+
<SchemaForm schema={schemaStripped} bind:args {isValid} {disabledArgs} shouldHideNoInputs />
|
|
167
|
+
{/if}
|
|
162
168
|
|
|
163
|
-
{#if !runnable}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
</Alert>
|
|
167
|
-
{:else if autoRefresh === true}
|
|
168
|
-
{#if isValid}
|
|
169
|
-
<div class="flex flex-row-reverse">
|
|
170
|
-
<Button
|
|
171
|
-
size="xs"
|
|
172
|
-
color="light"
|
|
173
|
-
variant="border"
|
|
174
|
-
on:click={() => executeComponent()}
|
|
175
|
-
disabled={!isValid}
|
|
176
|
-
startIcon={{ icon: faRefresh, classes: testIsLoading ? 'animate-spin' : '' }}
|
|
177
|
-
iconOnly
|
|
178
|
-
/>
|
|
179
|
-
</div>
|
|
180
|
-
<slot />
|
|
181
|
-
{:else}
|
|
182
|
-
<Alert type="warning" size="xs" class="mt-2" title="Missing inputs">
|
|
183
|
-
Please fill in all the inputs
|
|
169
|
+
{#if !runnable && autoRefresh}
|
|
170
|
+
<Alert type="warning" size="xs" class="mt-2" title="Missing runnable">
|
|
171
|
+
Please select a runnable
|
|
184
172
|
</Alert>
|
|
173
|
+
{:else if autoRefresh === true}
|
|
174
|
+
{#if isValid}
|
|
175
|
+
<slot />
|
|
176
|
+
{:else}
|
|
177
|
+
<Alert type="warning" size="xs" class="mt-2" title="Missing inputs">
|
|
178
|
+
Please fill in all the inputs
|
|
179
|
+
</Alert>
|
|
180
|
+
{/if}
|
|
181
|
+
{:else}
|
|
182
|
+
<slot />
|
|
185
183
|
{/if}
|
|
186
|
-
|
|
187
|
-
<slot />
|
|
188
|
-
{/if}
|
|
184
|
+
</div>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { isScriptByNameDefined, isScriptByPathDefined } from '../../utils';
|
|
2
|
+
import NonRunnableComponent from './NonRunnableComponent.svelte';
|
|
2
3
|
import RunnableComponent from './RunnableComponent.svelte';
|
|
3
4
|
export let componentInput;
|
|
4
5
|
export let id;
|
|
5
6
|
export let result = undefined;
|
|
6
|
-
// Optional props
|
|
7
7
|
export let extraQueryParams = {};
|
|
8
8
|
export let autoRefresh = true;
|
|
9
9
|
export let runnableComponent = undefined;
|
|
10
10
|
export let forceSchemaDisplay = false;
|
|
11
|
+
function isRunnableDefined() {
|
|
12
|
+
return isScriptByNameDefined(componentInput) || isScriptByPathDefined(componentInput);
|
|
13
|
+
}
|
|
11
14
|
</script>
|
|
12
15
|
|
|
13
16
|
{#if componentInput === undefined}
|
|
14
17
|
<slot />
|
|
15
|
-
{:else if componentInput.type === 'runnable' &&
|
|
18
|
+
{:else if componentInput.type === 'runnable' && isRunnableDefined()}
|
|
16
19
|
<RunnableComponent
|
|
17
20
|
bind:this={runnableComponent}
|
|
18
21
|
bind:inputs={componentInput.fields}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
|
-
import
|
|
2
|
+
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
3
3
|
import InputValue from '../helpers/InputValue.svelte';
|
|
4
4
|
export let id;
|
|
5
5
|
export let configuration;
|
|
6
|
+
export let verticalAlignment = undefined;
|
|
6
7
|
export const staticOutputs = ['result'];
|
|
7
8
|
const { worldStore } = getContext('AppEditorContext');
|
|
8
9
|
let value;
|
|
@@ -18,19 +19,15 @@ $: if (value || !value) {
|
|
|
18
19
|
}
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
|
-
<InputValue input={configuration.label} bind:value={labelValue} />
|
|
22
|
+
<InputValue {id} input={configuration.label} bind:value={labelValue} />
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
{labelValue}
|
|
27
|
-
</div>
|
|
28
|
-
<DebouncedInput
|
|
29
|
-
bind:value={value}
|
|
30
|
-
debounceDelay={300}
|
|
24
|
+
<AlignWrapper {verticalAlignment}>
|
|
25
|
+
<input
|
|
26
|
+
bind:value
|
|
31
27
|
type="number"
|
|
32
28
|
inputmode="numeric"
|
|
33
29
|
pattern="\d*"
|
|
34
30
|
placeholder="Type..."
|
|
31
|
+
class="h-full"
|
|
35
32
|
/>
|
|
36
|
-
</
|
|
33
|
+
</AlignWrapper>
|
|
@@ -15,7 +15,7 @@ let value = false;
|
|
|
15
15
|
$: outputs = $worldStore?.outputsById[id];
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<InputValue input={configuration.label} bind:value={labelValue} />
|
|
18
|
+
<InputValue {id} input={configuration.label} bind:value={labelValue} />
|
|
19
19
|
|
|
20
20
|
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
21
21
|
<Toggle
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import Select from 'svelte-select';
|
|
3
|
+
import AlignWrapper from '../helpers/AlignWrapper.svelte';
|
|
4
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
5
|
+
export const staticOutputs = ['loading', 'result'];
|
|
6
|
+
export let id;
|
|
7
|
+
export let configuration;
|
|
8
|
+
export let horizontalAlignment = undefined;
|
|
9
|
+
export let verticalAlignment = undefined;
|
|
10
|
+
const { worldStore } = getContext('AppEditorContext');
|
|
11
|
+
let label;
|
|
12
|
+
let items;
|
|
13
|
+
let itemKey;
|
|
14
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
15
|
+
function onChange({ detail }) {
|
|
16
|
+
outputs?.result.set(detail?.[itemKey] || undefined);
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<InputValue {id} input={configuration.label} bind:value={label} />
|
|
21
|
+
<InputValue {id} input={configuration.items} bind:value={items} />
|
|
22
|
+
<InputValue {id} input={configuration.itemKey} bind:value={itemKey} />
|
|
23
|
+
|
|
24
|
+
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
|
|
25
|
+
<Select on:clear={onChange} on:change={onChange} {items} placeholder="Select an item" />
|
|
26
|
+
</AlignWrapper>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AppInput } from '../../inputType';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
staticOutputs?: string[] | undefined;
|
|
6
|
+
id: string;
|
|
7
|
+
configuration: Record<string, AppInput>;
|
|
8
|
+
horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
|
|
9
|
+
verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export type AppSelectProps = typeof __propDef.props;
|
|
17
|
+
export type AppSelectEvents = typeof __propDef.events;
|
|
18
|
+
export type AppSelectSlots = typeof __propDef.slots;
|
|
19
|
+
export default class AppSelect extends SvelteComponentTyped<AppSelectProps, AppSelectEvents, AppSelectSlots> {
|
|
20
|
+
get staticOutputs(): string[];
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import InputValue from '../helpers/InputValue.svelte';
|
|
3
|
+
import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
|
|
4
|
+
import { writable } from 'svelte/store';
|
|
5
|
+
import { createSvelteTable, flexRender } from '@tanstack/svelte-table';
|
|
6
|
+
import AppButton from '../buttons/AppButton.svelte';
|
|
7
|
+
import { classNames, isObject } from '../../../../utils';
|
|
8
|
+
import DebouncedInput from '../helpers/DebouncedInput.svelte';
|
|
9
|
+
import AppTableFooter from './AppTableFooter.svelte';
|
|
10
|
+
import RefreshButton from '../helpers/RefreshButton.svelte';
|
|
11
|
+
import { tableOptions } from './tableOptions';
|
|
12
|
+
import Alert from '../../../common/alert/Alert.svelte';
|
|
13
|
+
export let id;
|
|
14
|
+
export let componentInput;
|
|
15
|
+
export let configuration;
|
|
16
|
+
export let actionButtons;
|
|
17
|
+
export const staticOutputs = ['selectedRow', 'loading', 'result'];
|
|
18
|
+
$: result = [];
|
|
19
|
+
let search = 'Disabled';
|
|
20
|
+
let searchValue = '';
|
|
21
|
+
let pagination = undefined;
|
|
22
|
+
let page = 1;
|
|
23
|
+
const options = writable({
|
|
24
|
+
data: [],
|
|
25
|
+
columns: [],
|
|
26
|
+
...tableOptions
|
|
27
|
+
});
|
|
28
|
+
let table = createSvelteTable(options);
|
|
29
|
+
const { worldStore, staticOutputs: staticOutputsStore } = getContext('AppEditorContext');
|
|
30
|
+
let selectedRowIndex = -1;
|
|
31
|
+
function toggleRow(row, rowIndex) {
|
|
32
|
+
if (selectedRowIndex === rowIndex) {
|
|
33
|
+
selectedRowIndex = -1;
|
|
34
|
+
outputs.selectedRow.set(null);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
selectedRowIndex = rowIndex;
|
|
38
|
+
outputs?.selectedRow.set(row.original);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function setOptions(filteredResult) {
|
|
42
|
+
if (!Array.isArray(result)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const headers = Array.from(new Set(result.flatMap((row) => Object.keys(row))));
|
|
46
|
+
$options = {
|
|
47
|
+
data: filteredResult,
|
|
48
|
+
columns: headers.map((header) => {
|
|
49
|
+
return {
|
|
50
|
+
accessorKey: header,
|
|
51
|
+
cell: (info) => info.getValue()
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
...tableOptions
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function searchInResult(result, searchValue) {
|
|
58
|
+
if (searchValue === '') {
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
return result.filter((row) => Object.values(row).some((value) => value.toString().includes(searchValue)));
|
|
62
|
+
}
|
|
63
|
+
let filteredResult = [];
|
|
64
|
+
$: filteredResult && setOptions(filteredResult);
|
|
65
|
+
$: extraQueryParams = search === 'Backend' ? { search: searchValue, page } : { page, search: '' };
|
|
66
|
+
$: search === 'Frontend' && (filteredResult = searchInResult(result, searchValue));
|
|
67
|
+
$: (search === 'Backend' || search === 'Disabled') && (filteredResult = result);
|
|
68
|
+
$: outputs = $worldStore?.outputsById[id];
|
|
69
|
+
function rerender() {
|
|
70
|
+
table = createSvelteTable(options);
|
|
71
|
+
}
|
|
72
|
+
$: result && rerender();
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<InputValue {id} input={configuration.search} bind:value={search} />
|
|
76
|
+
<InputValue {id} input={configuration.pagination} bind:value={pagination} />
|
|
77
|
+
|
|
78
|
+
<RunnableWrapper bind:componentInput {id} bind:result {extraQueryParams}>
|
|
79
|
+
{#if Array.isArray(result) && result.every(isObject)}
|
|
80
|
+
<div class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full">
|
|
81
|
+
<div class="py-2 px-4">
|
|
82
|
+
<div class="flex justify-between items-center">
|
|
83
|
+
<RefreshButton componentId={id} />
|
|
84
|
+
{#if search !== 'Disabled'}
|
|
85
|
+
<div>
|
|
86
|
+
<DebouncedInput placeholder="Search..." bind:value={searchValue} />
|
|
87
|
+
</div>
|
|
88
|
+
{/if}
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div class="overflow-auto flex-1 w-full">
|
|
92
|
+
<table class="divide-y divide-gray-300 w-full border-b border-b-gray-200">
|
|
93
|
+
<thead class="bg-gray-50 text-left">
|
|
94
|
+
{#each $table.getHeaderGroups() as headerGroup}
|
|
95
|
+
<tr class="divide-x">
|
|
96
|
+
{#each headerGroup.headers as header}
|
|
97
|
+
<th class="px-4 py-4 text-sm font-semibold">
|
|
98
|
+
{#if !header.isPlaceholder}
|
|
99
|
+
<svelte:component
|
|
100
|
+
this={flexRender(header.column.columnDef.header, header.getContext())}
|
|
101
|
+
/>
|
|
102
|
+
{/if}
|
|
103
|
+
</th>
|
|
104
|
+
{/each}
|
|
105
|
+
{#if actionButtons.length > 0}
|
|
106
|
+
<th class="px-4 py-4 text-sm font-semibold">Actions</th>
|
|
107
|
+
{/if}
|
|
108
|
+
</tr>
|
|
109
|
+
{/each}
|
|
110
|
+
</thead>
|
|
111
|
+
<tbody class="divide-y divide-gray-200 bg-white ">
|
|
112
|
+
{#each $table.getRowModel().rows as row, rowIndex (row.id)}
|
|
113
|
+
<tr
|
|
114
|
+
class={classNames(
|
|
115
|
+
selectedRowIndex === rowIndex
|
|
116
|
+
? 'bg-blue-100 hover:bg-blue-200'
|
|
117
|
+
: 'hover:bg-blue-50',
|
|
118
|
+
'divide-x',
|
|
119
|
+
'border-b w-full',
|
|
120
|
+
selectedRowIndex === rowIndex
|
|
121
|
+
? 'divide-blue-200 hover:divide-blue-300'
|
|
122
|
+
: 'divide-gray-200'
|
|
123
|
+
)}
|
|
124
|
+
on:click={() => toggleRow(row, rowIndex)}
|
|
125
|
+
>
|
|
126
|
+
{#each row.getVisibleCells() as cell, index (index)}
|
|
127
|
+
<td class="p-4 whitespace-nowrap text-xs text-gray-900">
|
|
128
|
+
<svelte:component
|
|
129
|
+
this={flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
130
|
+
/>
|
|
131
|
+
</td>
|
|
132
|
+
{/each}
|
|
133
|
+
|
|
134
|
+
{#if actionButtons.length > 0}
|
|
135
|
+
<td class="flex flex-row gap-2 p-4">
|
|
136
|
+
{#each actionButtons as props, actionIndex (actionIndex)}
|
|
137
|
+
<AppButton
|
|
138
|
+
{...props}
|
|
139
|
+
extraQueryParams={{ row }}
|
|
140
|
+
bind:componentInput={props.componentInput}
|
|
141
|
+
bind:staticOutputs={$staticOutputsStore[props.id]}
|
|
142
|
+
/>
|
|
143
|
+
{/each}
|
|
144
|
+
</td>
|
|
145
|
+
{/if}
|
|
146
|
+
</tr>
|
|
147
|
+
{/each}
|
|
148
|
+
</tbody>
|
|
149
|
+
</table>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<AppTableFooter paginationEnabled={pagination} {result} {table} />
|
|
153
|
+
</div>
|
|
154
|
+
{:else}
|
|
155
|
+
<Alert title="Parsing issues" type="error" size="xs">
|
|
156
|
+
The result should be an array of objects
|
|
157
|
+
</Alert>
|
|
158
|
+
{/if}
|
|
159
|
+
</RunnableWrapper>
|
|
File without changes
|