windmill-components 1.57.4 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AddUser.svelte +66 -0
- package/components/AddUser.svelte.d.ts +16 -0
- package/components/AppConnect.svelte +6 -5
- package/components/ArgInput.svelte +69 -26
- package/components/ArgInput.svelte.d.ts +1 -0
- package/components/Dropdown.svelte +2 -1
- package/components/EditorBar.svelte +3 -2
- package/components/FlowStatusViewer.svelte +24 -4
- package/components/IconedResourceType.svelte +4 -4
- package/components/InviteUser.svelte +0 -1
- package/components/ItemPicker.svelte +5 -5
- package/components/ModulePreview.svelte +1 -1
- package/components/MoveDrawer.svelte +2 -2
- package/components/NumberTypeNarrowing.svelte +19 -0
- package/components/NumberTypeNarrowing.svelte.d.ts +17 -0
- package/components/Path.svelte +5 -3
- package/components/Popover.svelte +22 -11
- package/components/Popover.svelte.d.ts +1 -0
- package/components/Range.svelte +304 -0
- package/components/Range.svelte.d.ts +37 -0
- package/components/ResourcePicker.svelte +9 -2
- package/components/RunForm.svelte +4 -2
- package/components/RunForm.svelte.d.ts +1 -0
- package/components/SchemaForm.svelte +8 -5
- package/components/ScriptBuilder.svelte +0 -1
- package/components/Tooltip.svelte +3 -2
- package/components/Tooltip.svelte.d.ts +3 -1
- package/components/apps/components/DisplayComponent.svelte +1 -1
- package/components/apps/components/buttons/AppButton.svelte +2 -5
- package/components/apps/components/dataDisplay/AppBarChart.svelte +1 -1
- package/components/apps/components/dataDisplay/AppHtml.svelte +1 -1
- package/components/apps/components/dataDisplay/AppPieChart.svelte +1 -1
- package/components/apps/components/dataDisplay/AppScatterChart.svelte +1 -1
- package/components/apps/components/dataDisplay/AppText.svelte +32 -9
- package/components/apps/components/dataDisplay/AppTimeseries.svelte +1 -1
- package/components/apps/components/form/AppForm.svelte +39 -26
- package/components/apps/components/helpers/RunnableComponent.svelte +12 -7
- package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +3 -0
- package/components/apps/components/helpers/RunnableWrapper.svelte +6 -0
- package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +3 -0
- package/components/apps/components/numberInputs/AppSliderInputs.svelte +37 -0
- package/components/apps/components/numberInputs/AppSliderInputs.svelte.d.ts +21 -0
- package/components/apps/components/table/AppTable.svelte +5 -5
- package/components/apps/editor/AppEditorHeader.svelte +77 -36
- package/components/apps/editor/AppExportButton.svelte +4 -7
- package/components/apps/editor/AppExportButton.svelte.d.ts +2 -0
- package/components/apps/editor/ComponentEditor.svelte +3 -0
- package/components/apps/editor/GridEditor.svelte +0 -1
- package/components/apps/editor/GridEditor.svelte.d.ts +0 -2
- package/components/apps/editor/componentsPanel/data.js +29 -0
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +7 -8
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +1 -1
- package/components/apps/editor/settingsPanel/ComponentPanel.svelte +4 -1
- package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +1 -3
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +52 -33
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +2 -4
- package/components/apps/editor/settingsPanel/TableActions.svelte +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +2 -1
- package/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte.d.ts +1 -0
- package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +4 -3
- package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte.d.ts +1 -0
- package/components/apps/editorUtils.js +7 -2
- package/components/apps/inputType.d.ts +1 -1
- package/components/apps/types.d.ts +5 -3
- package/components/apps/utils.d.ts +1 -1
- package/components/apps/utils.js +11 -4
- package/components/common/button/Button.svelte +2 -2
- package/components/common/drawer/Drawer.svelte +1 -1
- package/components/common/table/AppRow.svelte +18 -1
- package/components/common/table/LanguageBadge.svelte +3 -1
- package/components/common/table/Row.svelte +5 -3
- package/components/flows/CreateActionsApp.svelte +1 -3
- package/components/flows/CreateActionsFlow.svelte +1 -1
- package/components/flows/content/CapturePayload.svelte +4 -4
- package/components/flows/content/FlowSettings.svelte +0 -1
- package/components/flows/utils.js +8 -6
- package/components/home/ItemsList.svelte +10 -4
- package/components/home/ListFilters.svelte +9 -1
- package/components/icons/AppwriteIcon.svelte +16 -0
- package/components/icons/AppwriteIcon.svelte.d.ts +17 -0
- package/components/icons/AwsIcon.svelte +9 -0
- package/components/icons/AwsIcon.svelte.d.ts +17 -0
- package/components/icons/BcryptIcon.svelte +10 -0
- package/components/icons/BcryptIcon.svelte.d.ts +17 -0
- package/components/icons/{GItlabIcon.svelte → GitlabIcon.svelte} +0 -0
- package/components/icons/GitlabIcon.svelte.d.ts +17 -0
- package/components/icons/GoogleIcon.svelte +10 -0
- package/components/icons/GoogleIcon.svelte.d.ts +17 -0
- package/components/icons/HackernewsIcon.svelte +15 -0
- package/components/icons/HackernewsIcon.svelte.d.ts +17 -0
- package/components/icons/LinkdingIcon.svelte +13 -0
- package/components/icons/LinkdingIcon.svelte.d.ts +17 -0
- package/components/icons/MongodbIcon.svelte +7 -0
- package/components/icons/MongodbIcon.svelte.d.ts +17 -0
- package/components/icons/RedditIcon.svelte +8 -0
- package/components/icons/RedditIcon.svelte.d.ts +17 -0
- package/components/icons/SupabaseIcon.svelte +19 -0
- package/components/icons/SupabaseIcon.svelte.d.ts +17 -0
- package/components/icons/WebdavIcon.svelte +7 -0
- package/components/icons/WebdavIcon.svelte.d.ts +17 -0
- package/components/icons/ZammadIcon.svelte +23 -0
- package/components/icons/ZammadIcon.svelte.d.ts +17 -0
- package/components/icons/index.d.ts +25 -3
- package/components/icons/index.js +25 -3
- package/components/preview/FlowPreviewStatus.svelte +1 -1
- package/components/scripts/CreateActionsScript.svelte +1 -1
- package/gen/core/OpenAPI.js +1 -1
- package/gen/services/AppService.d.ts +1 -5
- package/gen/services/AppService.js +2 -2
- package/gen/services/CaptureService.d.ts +8 -8
- package/gen/services/CaptureService.js +9 -9
- package/gen/services/FlowService.d.ts +8 -0
- package/gen/services/FlowService.js +14 -0
- package/gen/services/JobService.d.ts +9 -1
- package/gen/services/JobService.js +10 -8
- package/gen/services/ScriptService.d.ts +8 -0
- package/gen/services/ScriptService.js +14 -0
- package/gen/services/WorkspaceService.d.ts +34 -1
- package/gen/services/WorkspaceService.js +46 -2
- package/package.json +517 -501
- package/utils.d.ts +3 -1
- package/utils.js +14 -0
- package/components/apps/editor/AppPublishButton.svelte +0 -46
- package/components/apps/editor/AppPublishButton.svelte.d.ts +0 -19
- package/components/icons/GItlabIcon.svelte.d.ts +0 -17
|
@@ -7,7 +7,7 @@ import { inferArgs } from '../../../../infer';
|
|
|
7
7
|
import Badge from '../../../common/badge/Badge.svelte';
|
|
8
8
|
import { fly } from 'svelte/transition';
|
|
9
9
|
import Editor from '../../../Editor.svelte';
|
|
10
|
-
import { scriptLangToEditorLang } from '../../../../utils';
|
|
10
|
+
import { emptySchema, scriptLangToEditorLang } from '../../../../utils';
|
|
11
11
|
import Tooltip from '../../../Tooltip.svelte';
|
|
12
12
|
let inlineScriptEditorDrawer;
|
|
13
13
|
export let inlineScript;
|
|
@@ -15,7 +15,7 @@ export let name = undefined;
|
|
|
15
15
|
export let id;
|
|
16
16
|
const { runnableComponents } = getContext('AppEditorContext');
|
|
17
17
|
let editor;
|
|
18
|
-
let validCode =
|
|
18
|
+
let validCode = true;
|
|
19
19
|
async function inferInlineScriptSchema(language, content, schema) {
|
|
20
20
|
try {
|
|
21
21
|
await inferArgs(language, content, schema);
|
|
@@ -28,8 +28,8 @@ async function inferInlineScriptSchema(language, content, schema) {
|
|
|
28
28
|
return schema;
|
|
29
29
|
}
|
|
30
30
|
onMount(async () => {
|
|
31
|
-
if (inlineScript) {
|
|
32
|
-
inlineScript.schema = await inferInlineScriptSchema(inlineScript?.language, inlineScript?.content,
|
|
31
|
+
if (inlineScript && !inlineScript.schema) {
|
|
32
|
+
inlineScript.schema = await inferInlineScriptSchema(inlineScript?.language, inlineScript?.content, emptySchema());
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
const dispatch = createEventDispatcher();
|
|
@@ -73,7 +73,7 @@ let runLoading = false;
|
|
|
73
73
|
startIcon={{ icon: faTrash }}
|
|
74
74
|
on:click={() => dispatch('delete')}
|
|
75
75
|
/>
|
|
76
|
-
{:else}
|
|
76
|
+
{:else if $runnableComponents[id] != undefined}
|
|
77
77
|
<Button
|
|
78
78
|
loading={runLoading}
|
|
79
79
|
size="xs"
|
|
@@ -84,9 +84,8 @@ let runLoading = false;
|
|
|
84
84
|
runLoading = false
|
|
85
85
|
}}
|
|
86
86
|
>
|
|
87
|
-
Run 
|
|
88
|
-
|
|
89
|
-
>
|
|
87
|
+
Run
|
|
88
|
+
<Tooltip light>Ctrl+Enter</Tooltip>
|
|
90
89
|
</Button>
|
|
91
90
|
{/if}
|
|
92
91
|
|
|
@@ -13,7 +13,7 @@ export let id;
|
|
|
13
13
|
async function fork(path) {
|
|
14
14
|
let { content, language, schema } = await getScriptByPath(path);
|
|
15
15
|
if (componentInput && componentInput.type == 'runnable') {
|
|
16
|
-
if (!schema || Object.keys(schema).length == 0) {
|
|
16
|
+
if (!schema || typeof schema == 'string' || Object.keys(schema).length == 0) {
|
|
17
17
|
schema = emptySchema();
|
|
18
18
|
await inferArgs(language, content, schema);
|
|
19
19
|
}
|
|
@@ -109,7 +109,10 @@ $: extraLib =
|
|
|
109
109
|
{:else if component.componentInput.type === 'connected' && component.componentInput !== undefined}
|
|
110
110
|
<ConnectedInputEditor bind:componentInput={component.componentInput} />
|
|
111
111
|
{:else if component.componentInput?.type === 'runnable' && component.componentInput !== undefined}
|
|
112
|
-
<RunnableInputEditor
|
|
112
|
+
<RunnableInputEditor
|
|
113
|
+
bind:appInput={component.componentInput}
|
|
114
|
+
defaultUserInput={component.type == 'formcomponent'}
|
|
115
|
+
/>
|
|
113
116
|
{/if}
|
|
114
117
|
</div>
|
|
115
118
|
{#if component.componentInput?.type === 'runnable' && Object.keys(component.componentInput.fields ?? {}).length > 0}
|
|
@@ -12,7 +12,5 @@ export let componentInput;
|
|
|
12
12
|
{:else if componentInput.type === 'static'}
|
|
13
13
|
<StaticInputEditor bind:componentInput />
|
|
14
14
|
{:else if componentInput.type === 'user'}
|
|
15
|
-
<span class="text-2xs italic text-gray-6f00"
|
|
16
|
-
>Field's value is set by the user in the visible field</span
|
|
17
|
-
>
|
|
15
|
+
<span class="text-2xs italic text-gray-6f00">Field's value is set by the user</span>
|
|
18
16
|
{/if}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script>import { Badge, ToggleButton, ToggleButtonGroup } from '../../../common';
|
|
2
|
-
import { capitalize } from '../../../../utils';
|
|
2
|
+
import { addWhitespaceBeforeCapitals, capitalize } from '../../../../utils';
|
|
3
3
|
import { faArrowRight, faPen, faTableCells, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { fieldTypeToTsType } from '../../utils';
|
|
5
5
|
import InputsSpecEditor from './InputsSpecEditor.svelte';
|
|
6
6
|
import { getContext } from 'svelte';
|
|
7
|
+
import Tooltip from '../../../Tooltip.svelte';
|
|
8
|
+
import Popover from '../../../Popover.svelte';
|
|
7
9
|
export let inputSpecs;
|
|
8
10
|
export let userInputEnabled = true;
|
|
9
11
|
export let staticOnly = false;
|
|
@@ -19,10 +21,17 @@ const { connectingInput } = getContext('AppEditorContext');
|
|
|
19
21
|
<div class="flex flex-col gap-1">
|
|
20
22
|
<div class="flex justify-between items-end gap-1">
|
|
21
23
|
<span class="text-sm font-semibold truncate">
|
|
22
|
-
{shouldCapitalize
|
|
24
|
+
{shouldCapitalize
|
|
25
|
+
? capitalize(addWhitespaceBeforeCapitals(inputSpecKey))
|
|
26
|
+
: inputSpecKey}
|
|
27
|
+
{#if input.tooltip}
|
|
28
|
+
<Tooltip>
|
|
29
|
+
{input.tooltip}
|
|
30
|
+
</Tooltip>
|
|
31
|
+
{/if}
|
|
23
32
|
</span>
|
|
24
33
|
|
|
25
|
-
<div class="flex gap-2 flex-wrap items-center">
|
|
34
|
+
<div class="flex gap-x-2 gap-y-1 flex-wrap justify-end items-center">
|
|
26
35
|
<Badge color="blue">
|
|
27
36
|
{input.fieldType === 'array' && input.subFieldType
|
|
28
37
|
? `${capitalize(fieldTypeToTsType(input.subFieldType))}[]`
|
|
@@ -33,7 +42,6 @@ const { connectingInput } = getContext('AppEditorContext');
|
|
|
33
42
|
<ToggleButtonGroup
|
|
34
43
|
bind:selected={inputSpecs[inputSpecKey].type}
|
|
35
44
|
on:selected={(e) => {
|
|
36
|
-
console.log(inputSpecs[inputSpecKey])
|
|
37
45
|
if (e.detail == 'connected' && !inputSpecs[inputSpecKey]['connection']) {
|
|
38
46
|
$connectingInput = {
|
|
39
47
|
opened: true,
|
|
@@ -43,45 +51,56 @@ const { connectingInput } = getContext('AppEditorContext');
|
|
|
43
51
|
}
|
|
44
52
|
}}
|
|
45
53
|
>
|
|
46
|
-
<
|
|
47
|
-
title="Static"
|
|
48
|
-
position="left"
|
|
49
|
-
value="static"
|
|
50
|
-
startIcon={{ icon: faPen }}
|
|
51
|
-
size="xs"
|
|
52
|
-
iconOnly
|
|
53
|
-
/>
|
|
54
|
-
{#if rowColumns}
|
|
54
|
+
<Popover placement="bottom" notClickable disapperTimoout={0}>
|
|
55
55
|
<ToggleButton
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
startIcon={{ icon: faTableCells }}
|
|
56
|
+
position="left"
|
|
57
|
+
value="static"
|
|
58
|
+
startIcon={{ icon: faPen }}
|
|
60
59
|
size="xs"
|
|
61
60
|
iconOnly
|
|
62
|
-
disabled={staticOnly}
|
|
63
61
|
/>
|
|
62
|
+
<svelte:fragment slot="text">Static</svelte:fragment>
|
|
63
|
+
</Popover>
|
|
64
|
+
{#if rowColumns}
|
|
65
|
+
<Popover placement="bottom" notClickable disapperTimoout={0}>
|
|
66
|
+
<ToggleButton
|
|
67
|
+
position="center"
|
|
68
|
+
value="row"
|
|
69
|
+
startIcon={{ icon: faTableCells }}
|
|
70
|
+
size="xs"
|
|
71
|
+
disabled={staticOnly}
|
|
72
|
+
>
|
|
73
|
+
<Tooltip>
|
|
74
|
+
Use the column name to have the value of the cell be passed to the action
|
|
75
|
+
</Tooltip>
|
|
76
|
+
</ToggleButton>
|
|
77
|
+
<svelte:fragment slot="text">Column</svelte:fragment>
|
|
78
|
+
</Popover>
|
|
79
|
+
{/if}
|
|
80
|
+
{#if userInputEnabled && !input.format?.startsWith('resource-')}
|
|
81
|
+
<Popover placement="bottom" notClickable disapperTimoout={0}>
|
|
82
|
+
<ToggleButton
|
|
83
|
+
position="center"
|
|
84
|
+
value="user"
|
|
85
|
+
startIcon={{ icon: faUser }}
|
|
86
|
+
size="xs"
|
|
87
|
+
iconOnly
|
|
88
|
+
disabled={staticOnly}
|
|
89
|
+
/>
|
|
90
|
+
<svelte:fragment slot="text">User Input</svelte:fragment>
|
|
91
|
+
</Popover>
|
|
64
92
|
{/if}
|
|
65
|
-
|
|
93
|
+
<Popover placement="bottom" notClickable disapperTimoout={0}>
|
|
66
94
|
<ToggleButton
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
startIcon={{ icon: faUser }}
|
|
95
|
+
position="right"
|
|
96
|
+
value="connected"
|
|
97
|
+
startIcon={{ icon: faArrowRight }}
|
|
71
98
|
size="xs"
|
|
72
99
|
iconOnly
|
|
73
100
|
disabled={staticOnly}
|
|
74
101
|
/>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
title="Connect"
|
|
78
|
-
position="right"
|
|
79
|
-
value="connected"
|
|
80
|
-
startIcon={{ icon: faArrowRight }}
|
|
81
|
-
size="xs"
|
|
82
|
-
iconOnly
|
|
83
|
-
disabled={staticOnly}
|
|
84
|
-
/>
|
|
102
|
+
<svelte:fragment slot="text">Connect</svelte:fragment>
|
|
103
|
+
</Popover>
|
|
85
104
|
</ToggleButtonGroup>
|
|
86
105
|
{/if}
|
|
87
106
|
</div>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { BaseAppComponent } from '../../types';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
inputSpecs:
|
|
6
|
-
onlyStatic?: boolean;
|
|
7
|
-
}>;
|
|
5
|
+
inputSpecs: BaseAppComponent['configuration'];
|
|
8
6
|
userInputEnabled?: boolean | undefined;
|
|
9
7
|
staticOnly?: boolean | undefined;
|
|
10
8
|
shouldCapitalize?: boolean | undefined;
|
|
@@ -13,7 +13,7 @@ const { selectedComponent, staticOutputs } = getContext('AppEditorContext');
|
|
|
13
13
|
function addComponent() {
|
|
14
14
|
const actionId = getNextId(components.map((x) => x.id.split('-')[1]));
|
|
15
15
|
const newComponent = {
|
|
16
|
-
id: `${id}
|
|
16
|
+
id: `${id}_${actionId}`,
|
|
17
17
|
type: 'buttoncomponent',
|
|
18
18
|
configuration: {
|
|
19
19
|
label: {
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import RunnableSelector from '../mainInput/RunnableSelector.svelte';
|
|
3
3
|
import SelectedRunnable from '../SelectedRunnable.svelte';
|
|
4
4
|
export let appInput;
|
|
5
|
+
export let defaultUserInput = false;
|
|
5
6
|
$: isRunnableSelected = isScriptByPathDefined(appInput) || isScriptByNameDefined(appInput);
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
{#if isRunnableSelected}
|
|
9
10
|
<SelectedRunnable bind:appInput />
|
|
10
11
|
{:else}
|
|
11
|
-
<RunnableSelector bind:appInput />
|
|
12
|
+
<RunnableSelector {defaultUserInput} bind:appInput />
|
|
12
13
|
{/if}
|
|
@@ -13,7 +13,7 @@ $: componentInput && onchange?.();
|
|
|
13
13
|
{#if componentInput.fieldType === 'number'}
|
|
14
14
|
<input type="number" bind:value={componentInput.value} />
|
|
15
15
|
{:else if componentInput.fieldType === 'textarea'}
|
|
16
|
-
<textarea
|
|
16
|
+
<textarea bind:value={componentInput.value} />
|
|
17
17
|
{:else if componentInput.fieldType === 'boolean'}
|
|
18
18
|
<Toggle bind:checked={componentInput.value} />
|
|
19
19
|
{:else if componentInput.fieldType === 'select'}
|
|
@@ -9,6 +9,7 @@ import { getContext } from 'svelte';
|
|
|
9
9
|
import { loadSchema, schemaToInputsSpec } from '../../../utils';
|
|
10
10
|
import { emptySchema } from '../../../../../utils';
|
|
11
11
|
export let appInput;
|
|
12
|
+
export let defaultUserInput = false;
|
|
12
13
|
let tab = 'inlinescripts';
|
|
13
14
|
let filter = '';
|
|
14
15
|
let picker;
|
|
@@ -19,7 +20,7 @@ async function loadSchemaFromTriggerable(path, runType) {
|
|
|
19
20
|
async function pickScript(path) {
|
|
20
21
|
if (appInput.type === 'runnable') {
|
|
21
22
|
const schema = await loadSchemaFromTriggerable(path, 'script');
|
|
22
|
-
const fields = schemaToInputsSpec(schema);
|
|
23
|
+
const fields = schemaToInputsSpec(schema, defaultUserInput);
|
|
23
24
|
appInput.runnable = {
|
|
24
25
|
type: 'runnableByPath',
|
|
25
26
|
path,
|
|
@@ -32,7 +33,7 @@ async function pickScript(path) {
|
|
|
32
33
|
async function pickFlow(path) {
|
|
33
34
|
if (appInput.type === 'runnable') {
|
|
34
35
|
const schema = await loadSchemaFromTriggerable(path, 'flow');
|
|
35
|
-
const fields = schemaToInputsSpec(schema);
|
|
36
|
+
const fields = schemaToInputsSpec(schema, defaultUserInput);
|
|
36
37
|
appInput.runnable = {
|
|
37
38
|
type: 'runnableByPath',
|
|
38
39
|
path,
|
|
@@ -45,7 +46,7 @@ async function pickFlow(path) {
|
|
|
45
46
|
async function pickHubScript(path) {
|
|
46
47
|
if (appInput.type === 'runnable') {
|
|
47
48
|
const schema = await loadSchemaFromTriggerable(path, 'hubscript');
|
|
48
|
-
const fields = schemaToInputsSpec(schema);
|
|
49
|
+
const fields = schemaToInputsSpec(schema, defaultUserInput);
|
|
49
50
|
appInput.runnable = {
|
|
50
51
|
type: 'runnableByPath',
|
|
51
52
|
path,
|
|
@@ -4,8 +4,13 @@ export function defaultCode(component, language) {
|
|
|
4
4
|
return [
|
|
5
5
|
{ foo: x, bar: 42 },
|
|
6
6
|
{ foo: "static", bar: 84 }]
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
}`;
|
|
8
|
+
}
|
|
9
|
+
else if (component === 'tablecomponent' && language === 'python3') {
|
|
10
|
+
return `def main(x: str):
|
|
11
|
+
return [
|
|
12
|
+
{ "foo": x, "bar": 42 },
|
|
13
|
+
{ "foo": "static", "bar": 84 }]`;
|
|
9
14
|
}
|
|
10
15
|
return undefined;
|
|
11
16
|
}
|
|
@@ -39,7 +39,7 @@ type RunnableByName = {
|
|
|
39
39
|
export type Runnable = RunnableByPath | RunnableByName | undefined;
|
|
40
40
|
export type ResultInput = {
|
|
41
41
|
runnable: Runnable;
|
|
42
|
-
fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
|
|
42
|
+
fields: Record<string, (StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput)>;
|
|
43
43
|
type: 'runnable';
|
|
44
44
|
value?: any;
|
|
45
45
|
};
|
|
@@ -2,7 +2,7 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import type { Preview } from '../../gen';
|
|
3
3
|
import type { FilledItem } from 'svelte-grid';
|
|
4
4
|
import type { Writable } from 'svelte/store';
|
|
5
|
-
import type { AppInput, ConnectedAppInput, ConnectedInput, StaticAppInput, UserAppInput } from './inputType';
|
|
5
|
+
import type { AppInput, ConnectedAppInput, ConnectedInput, RowAppInput, StaticAppInput, UserAppInput } from './inputType';
|
|
6
6
|
import type { World } from './rx';
|
|
7
7
|
type BaseComponent<T extends string> = {
|
|
8
8
|
type: T;
|
|
@@ -12,6 +12,7 @@ export type TextInputComponent = BaseComponent<'textinputcomponent'>;
|
|
|
12
12
|
export type PasswordInputComponent = BaseComponent<'passwordinputcomponent'>;
|
|
13
13
|
export type DateInputComponent = BaseComponent<'dateinputcomponent'>;
|
|
14
14
|
export type NumberInputComponent = BaseComponent<'numberinputcomponent'>;
|
|
15
|
+
export type SliderComponent = BaseComponent<'slidercomponent'>;
|
|
15
16
|
export type HtmlComponent = BaseComponent<'htmlcomponent'>;
|
|
16
17
|
export type TimeseriesComponent = BaseComponent<'timeseriescomponent'>;
|
|
17
18
|
export type ButtonComponent = BaseComponent<'buttoncomponent'> & {
|
|
@@ -42,8 +43,9 @@ export type Aligned = {
|
|
|
42
43
|
export interface BaseAppComponent extends Partial<Aligned> {
|
|
43
44
|
id: ComponentID;
|
|
44
45
|
componentInput: AppInput | undefined;
|
|
45
|
-
configuration: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput) & {
|
|
46
|
+
configuration: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput) & {
|
|
46
47
|
onlyStatic?: boolean;
|
|
48
|
+
tooltip?: string;
|
|
47
49
|
}>;
|
|
48
50
|
card: boolean | undefined;
|
|
49
51
|
/**
|
|
@@ -53,7 +55,7 @@ export interface BaseAppComponent extends Partial<Aligned> {
|
|
|
53
55
|
*/
|
|
54
56
|
softWrap?: boolean;
|
|
55
57
|
}
|
|
56
|
-
export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | BarChartComponent | TimeseriesComponent | HtmlComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ScatterChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent);
|
|
58
|
+
export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | SliderComponent | BarChartComponent | TimeseriesComponent | HtmlComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ScatterChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent);
|
|
57
59
|
export type ComponentSet = {
|
|
58
60
|
title: string;
|
|
59
61
|
components: AppComponent[];
|
|
@@ -2,7 +2,7 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
|
|
3
3
|
import type { AppComponent } from './types';
|
|
4
4
|
export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
|
|
5
|
-
export declare function schemaToInputsSpec(schema: Schema): Record<string, StaticAppInput>;
|
|
5
|
+
export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
|
|
6
6
|
export declare const displayData: Record<AppComponent['type'], {
|
|
7
7
|
name: string;
|
|
8
8
|
icon: any;
|
package/components/apps/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FlowService, ScriptService } from '../../gen';
|
|
2
2
|
import { inferArgs } from '../../infer';
|
|
3
|
-
import {
|
|
3
|
+
import { emptySchema } from '../../utils';
|
|
4
|
+
import { BarChart4, Binary, CircleDot, FormInput, Inspect, List, Monitor, PieChart, Play, Table2, Image, TextCursorInput, Type, Lock, Calendar, ToggleLeft, GripHorizontal, Code2, SlidersHorizontal } from 'lucide-svelte';
|
|
4
5
|
export async function loadSchema(workspace, path, runType) {
|
|
5
6
|
if (runType === 'script') {
|
|
6
7
|
const script = await ScriptService.getScriptByPath({
|
|
@@ -20,20 +21,22 @@ export async function loadSchema(workspace, path, runType) {
|
|
|
20
21
|
const script = await ScriptService.getHubScriptByPath({
|
|
21
22
|
path
|
|
22
23
|
});
|
|
24
|
+
if (script.schema == undefined || Object.keys(script.schema).length == 0 || typeof script.schema != 'object') {
|
|
25
|
+
script.schema = emptySchema();
|
|
26
|
+
}
|
|
23
27
|
await inferArgs(script.language, script.content, script.schema);
|
|
24
28
|
return script.schema;
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
|
-
export function schemaToInputsSpec(schema) {
|
|
31
|
+
export function schemaToInputsSpec(schema, defaultUserInput) {
|
|
28
32
|
if (schema?.properties == undefined) {
|
|
29
33
|
return {};
|
|
30
34
|
}
|
|
31
35
|
return Object.keys(schema.properties).reduce((accu, key) => {
|
|
32
36
|
const property = schema.properties[key];
|
|
33
37
|
accu[key] = {
|
|
34
|
-
type: 'static',
|
|
38
|
+
type: defaultUserInput && !property.format?.startsWith('resource-') ? 'user' : 'static',
|
|
35
39
|
value: property.default,
|
|
36
|
-
visible: property.format ? false : true,
|
|
37
40
|
fieldType: property.type,
|
|
38
41
|
format: property.format
|
|
39
42
|
};
|
|
@@ -113,6 +116,10 @@ export const displayData = {
|
|
|
113
116
|
name: 'Number',
|
|
114
117
|
icon: Binary
|
|
115
118
|
},
|
|
119
|
+
slidercomponent: {
|
|
120
|
+
name: 'Slider',
|
|
121
|
+
icon: SlidersHorizontal
|
|
122
|
+
},
|
|
116
123
|
passwordinputcomponent: {
|
|
117
124
|
name: 'Password',
|
|
118
125
|
icon: Lock
|
|
@@ -25,8 +25,8 @@ const dispatch = createEventDispatcher();
|
|
|
25
25
|
// Order of classes: border, border modifier, bg, bg modifier, text, text modifier, everything else
|
|
26
26
|
const colorVariants = {
|
|
27
27
|
blue: {
|
|
28
|
-
border: 'border-
|
|
29
|
-
contained: 'bg-
|
|
28
|
+
border: 'border-frost-500 hover:border-frost-700 focus:border-frost-700 bg-white hover:bg-frost-100 focus:bg-frost-100 text-frost-500 hover:text-frost-700 focus:text-frost-700 focus:ring-frost-300',
|
|
29
|
+
contained: 'bg-frost-500 hover:bg-frost-700 focus:bg-frost-700 text-white focus:ring-frost-300'
|
|
30
30
|
},
|
|
31
31
|
red: {
|
|
32
32
|
border: 'border-red-600 hover:border-red-700 bg-white hover:bg-red-100 text-red-600 hover:text-red-700 focus:ring-red-300',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import SharedBadge from '../../SharedBadge.svelte';
|
|
3
3
|
import { AppService } from '../../../gen';
|
|
4
4
|
import { userStore, workspaceStore } from '../../../stores';
|
|
5
|
-
import { faEdit, faEye, faFileExport, faPen, faShare, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { faCodeFork, faEdit, faEye, faFileExport, faPen, faShare, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
|
6
6
|
import { MoreVertical } from 'lucide-svelte';
|
|
7
7
|
import { createEventDispatcher } from 'svelte';
|
|
8
8
|
import Button from '../button/Button.svelte';
|
|
@@ -44,6 +44,18 @@ const dispatch = createEventDispatcher();
|
|
|
44
44
|
Edit
|
|
45
45
|
</Button>
|
|
46
46
|
</div>
|
|
47
|
+
{:else}
|
|
48
|
+
<div>
|
|
49
|
+
<Button
|
|
50
|
+
color="light"
|
|
51
|
+
size="xs"
|
|
52
|
+
variant="border"
|
|
53
|
+
startIcon={{ icon: faCodeFork }}
|
|
54
|
+
href="/apps/add?template={path}"
|
|
55
|
+
>
|
|
56
|
+
Fork
|
|
57
|
+
</Button>
|
|
58
|
+
</div>
|
|
47
59
|
{/if}
|
|
48
60
|
{/if}
|
|
49
61
|
|
|
@@ -71,6 +83,11 @@ const dispatch = createEventDispatcher();
|
|
|
71
83
|
icon: faPen,
|
|
72
84
|
href: `/apps/edit/${path}?nodraft=true`
|
|
73
85
|
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'Use as template',
|
|
88
|
+
icon: faCodeFork,
|
|
89
|
+
href: `/apps/add?template=${path}`
|
|
90
|
+
},
|
|
74
91
|
{
|
|
75
92
|
displayName: 'Move/Rename',
|
|
76
93
|
icon: faFileExport,
|
|
@@ -17,8 +17,10 @@ const color = {
|
|
|
17
17
|
}[kind];
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<div
|
|
21
|
-
|
|
20
|
+
<div
|
|
21
|
+
class="hover:bg-gray-50 w-full inline-flex items-center p-4 gap-4 first-of-type:!border-t-0
|
|
22
|
+
first-of-type:rounded-t-md last-of-type:rounded-b-md {color}"
|
|
23
|
+
>
|
|
22
24
|
<RowIcon {href} {kind} />
|
|
23
25
|
|
|
24
26
|
<a {href} class="min-w-0 grow hover:underline decoration-gray-400">
|
|
@@ -34,7 +36,7 @@ first-of-type:rounded-t-md last-of-type:rounded-b-md {color}">
|
|
|
34
36
|
</div>
|
|
35
37
|
</a>
|
|
36
38
|
{#if $$slots.badges}
|
|
37
|
-
<div class="w-32 hidden
|
|
39
|
+
<div class="w-32 hidden md:flex flex-row gap-1 items-start flex-wrap">
|
|
38
40
|
<slot name="badges" />
|
|
39
41
|
</div>
|
|
40
42
|
{/if}
|
|
@@ -23,9 +23,7 @@ async function importJson() {
|
|
|
23
23
|
startIcon={{ icon: faPlus }}
|
|
24
24
|
href="/apps/add?nodraft=true"
|
|
25
25
|
>
|
|
26
|
-
<svelte:fragment slot="main"
|
|
27
|
-
>New App (alpha) <LayoutDashboard class="ml-1.5" size={18} />
|
|
28
|
-
</svelte:fragment>
|
|
26
|
+
<svelte:fragment slot="main">App <LayoutDashboard class="ml-1.5" size={18} /></svelte:fragment>
|
|
29
27
|
<ButtonPopupItem on:click={() => drawer?.toggleDrawer?.()}>
|
|
30
28
|
Import from raw JSON
|
|
31
29
|
</ButtonPopupItem>
|
|
@@ -25,7 +25,7 @@ async function importJson() {
|
|
|
25
25
|
href="/flows/add?nodraft=true"
|
|
26
26
|
>
|
|
27
27
|
<svelte:fragment slot="main"
|
|
28
|
-
>
|
|
28
|
+
>Flow <Icon data={faBarsStaggered} scale={0.8} class="ml-1.5" />
|
|
29
29
|
</svelte:fragment>
|
|
30
30
|
<ButtonPopupItem on:click={() => drawer?.toggleDrawer?.()}>
|
|
31
31
|
Import from raw JSON
|
|
@@ -56,13 +56,13 @@ async function getCaptureInput() {
|
|
|
56
56
|
on:click={(e) => {
|
|
57
57
|
e.preventDefault()
|
|
58
58
|
copyToClipboard(
|
|
59
|
-
`${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/
|
|
59
|
+
`${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/capture_u/${$flowStore.path}`
|
|
60
60
|
)
|
|
61
61
|
}}
|
|
62
62
|
href="{$page.url.protocol}//{$page.url
|
|
63
|
-
.hostname}/api/w/{$workspaceStore}/
|
|
63
|
+
.hostname}/api/w/{$workspaceStore}/capture_u/{$flowStore.path}"
|
|
64
64
|
>{$page.url.protocol}//{$page.url
|
|
65
|
-
.hostname}/api/w/{$workspaceStore}/
|
|
65
|
+
.hostname}/api/w/{$workspaceStore}/capture_u/{$flowStore.path}
|
|
66
66
|
<Icon data={faClipboard} /></a
|
|
67
67
|
>
|
|
68
68
|
</div>
|
|
@@ -70,7 +70,7 @@ async function getCaptureInput() {
|
|
|
70
70
|
|
|
71
71
|
<div class="text-xs box mb-4 b">
|
|
72
72
|
<pre class="overflow-auto"
|
|
73
|
-
>{`curl -X POST ${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/
|
|
73
|
+
>{`curl -X POST ${$page.url.protocol}//${$page.url.hostname}/api/w/${$workspaceStore}/capture_u/${$flowStore.path} \\
|
|
74
74
|
-H 'Content-Type: application/json' \\
|
|
75
75
|
-d '{"foo": 42}'`}</pre
|
|
76
76
|
>
|
|
@@ -146,24 +146,26 @@ export function numberToChars(n) {
|
|
|
146
146
|
sp = 0;
|
|
147
147
|
while (sp < b.length) {
|
|
148
148
|
if (b[sp] > 25) {
|
|
149
|
-
div = Math.floor(b[sp] /
|
|
149
|
+
div = Math.floor(b[sp] / 27);
|
|
150
150
|
b[sp + 1] = div - 1;
|
|
151
|
-
b[sp] %=
|
|
151
|
+
b[sp] %= 27;
|
|
152
152
|
}
|
|
153
153
|
sp += 1;
|
|
154
154
|
}
|
|
155
155
|
out = '';
|
|
156
156
|
for (i = 0; i < b.length; i += 1) {
|
|
157
|
-
|
|
157
|
+
let charCode = aCharCode + b[i];
|
|
158
|
+
out = (charCode == 26 ? '-' : String.fromCharCode(charCode)) + out;
|
|
158
159
|
}
|
|
159
160
|
return out;
|
|
160
161
|
}
|
|
161
162
|
export function charsToNumber(n) {
|
|
162
|
-
let b = Math.pow(
|
|
163
|
+
let b = Math.pow(27, n.length - 1);
|
|
163
164
|
let res = 0;
|
|
164
165
|
for (let c of n) {
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
let charCode = c == '-' ? aCharCode + 26 : c.charCodeAt(0);
|
|
167
|
+
res += (charCode - aCharCode + 1) * b;
|
|
168
|
+
b = b / 27;
|
|
167
169
|
}
|
|
168
170
|
return res - 1;
|
|
169
171
|
}
|