windmill-components 1.22.42 → 1.28.3
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/AppConnect.svelte +93 -47
- package/components/AppConnect.svelte.d.ts +2 -2
- package/components/ArgInfo.svelte +0 -5
- package/components/ArgInput.svelte +91 -64
- package/components/ArgInput.svelte.d.ts +8 -3
- package/components/Button.svelte +4 -4
- package/components/CenteredPage.svelte +1 -1
- package/components/CollapseLink.svelte +12 -0
- package/components/CollapseLink.svelte.d.ts +19 -0
- package/components/CronInput.svelte +84 -0
- package/components/CronInput.svelte.d.ts +18 -0
- package/components/DisplayResult.svelte +28 -15
- package/components/Editor.svelte +136 -66
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +56 -45
- package/components/FlowBuilder.svelte +155 -70
- package/components/FlowEditor.svelte +79 -200
- package/components/FlowEditor.svelte.d.ts +3 -2
- package/components/FlowJobResult.svelte +1 -1
- package/components/FlowPreview.svelte +18 -24
- package/components/FlowPreviewContent.svelte +68 -0
- package/components/FlowPreviewContent.svelte.d.ts +21 -0
- package/components/FlowStatusViewer.svelte +85 -37
- package/components/FlowStatusViewer.svelte.d.ts +3 -2
- package/components/FlowViewer.svelte +85 -45
- package/components/FlowViewer.svelte.d.ts +2 -1
- package/components/IconedResourceType.svelte +30 -5
- package/components/InputTransformForm.svelte +209 -0
- package/components/InputTransformForm.svelte.d.ts +26 -0
- package/components/InputTransformsViewer.svelte +19 -0
- package/components/InputTransformsViewer.svelte.d.ts +17 -0
- package/components/InviteGlobalUser.svelte +2 -2
- package/components/InviteUser.svelte +2 -2
- package/components/JobStatus.svelte +32 -25
- package/components/Modal.svelte +44 -42
- package/components/ModuleStep.svelte +94 -79
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +1 -0
- package/components/Path.svelte.d.ts +1 -1
- package/components/RadioButton.svelte +11 -96
- package/components/RadioButton.svelte.d.ts +4 -2
- package/components/ResourceEditor.svelte +4 -5
- package/components/ResourceEditor.svelte.d.ts +2 -2
- package/components/ResourcePicker.svelte +25 -2
- package/components/ResourcePicker.svelte.d.ts +3 -0
- package/components/ResourceTypePicker.svelte +17 -29
- package/components/ResourceTypePicker.svelte.d.ts +1 -0
- package/components/RunForm.svelte +14 -15
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/SchemaEditor.svelte +87 -71
- package/components/SchemaEditor.svelte.d.ts +2 -0
- package/components/SchemaEditorProperty.svelte +11 -0
- package/components/SchemaEditorProperty.svelte.d.ts +17 -0
- package/components/SchemaForm.svelte +21 -127
- package/components/SchemaForm.svelte.d.ts +3 -4
- package/components/SchemaModal.svelte +20 -33
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/SchemaViewer.svelte +4 -6
- package/components/ScriptBuilder.svelte +40 -43
- package/components/ScriptEditor.svelte +71 -66
- package/components/ScriptPicker.svelte +10 -12
- package/components/ScriptPicker.svelte.d.ts +1 -1
- package/components/ScriptSchema.svelte +0 -5
- package/components/ShareModal.svelte +1 -1
- package/components/SharedBadge.svelte +12 -10
- package/components/StringTypeNarrowing.svelte +8 -4
- package/components/StringTypeNarrowing.svelte.d.ts +1 -0
- package/components/TableCustom.svelte +7 -9
- package/components/TableSimple.svelte +1 -1
- package/components/Toggle.svelte +8 -10
- package/components/Toggle.svelte.d.ts +5 -11
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +21 -6
- package/components/flows/CopyFirstStepSchema.svelte +7 -5
- package/components/flows/DynamicInputHelpBox.svelte +1 -1
- package/components/flows/FlowBox.svelte +3 -0
- package/components/flows/FlowBox.svelte.d.ts +23 -0
- package/components/flows/FlowBoxHeader.svelte +9 -0
- package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
- package/components/flows/FlowInput.svelte +20 -0
- package/components/flows/FlowInput.svelte.d.ts +14 -0
- package/components/flows/FlowInputs.svelte +7 -3
- package/components/flows/FlowModuleHeader.svelte +42 -40
- package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
- package/components/flows/FlowSettings.svelte +174 -0
- package/components/flows/FlowSettings.svelte.d.ts +21 -0
- package/components/flows/flowStore.d.ts +5 -2
- package/components/flows/flowStore.js +65 -9
- package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
- package/components/flows/utils.d.ts +11 -7
- package/components/flows/utils.js +114 -45
- package/components/icons/AirtableIcon.svelte +17 -0
- package/components/icons/AirtableIcon.svelte.d.ts +17 -0
- package/components/icons/GCloudIcon.svelte +16 -0
- package/components/icons/GCloudIcon.svelte.d.ts +17 -0
- package/components/icons/GItlabIcon.svelte +16 -0
- package/components/icons/GItlabIcon.svelte.d.ts +17 -0
- package/components/icons/GSheetsIcon.svelte +16 -0
- package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
- package/components/icons/GcalIcon.svelte +16 -0
- package/components/icons/GcalIcon.svelte.d.ts +17 -0
- package/components/icons/GdriveIcon.svelte +16 -0
- package/components/icons/GdriveIcon.svelte.d.ts +17 -0
- package/components/icons/GmailIcon.svelte +16 -0
- package/components/icons/GmailIcon.svelte.d.ts +17 -0
- package/components/icons/PostgresIcon.svelte +8 -49
- package/components/icons/Slack.svelte +9 -18
- package/components/icons/TogglIcon.svelte +59 -0
- package/components/icons/TogglIcon.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +35 -37
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +2 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
- package/components/propertyPicker/PropPicker.svelte +13 -15
- package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
- package/components/propertyPicker/WarningMessage.svelte +14 -41
- package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
- package/components/propertyPicker/utils.d.ts +1 -0
- package/components/propertyPicker/utils.js +25 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +11 -2
- package/gen/index.js +1 -2
- package/gen/models/CompletedJob.d.ts +1 -1
- package/gen/models/Flow.d.ts +3 -13
- package/gen/models/FlowMetadata.d.ts +9 -0
- package/gen/models/FlowMetadata.js +4 -0
- package/gen/models/FlowModuleValue.d.ts +5 -22
- package/gen/models/FlowModuleValue.js +1 -15
- package/gen/models/ForloopFlow.d.ts +8 -0
- package/gen/models/ForloopFlow.js +4 -0
- package/gen/models/InputTransform.d.ts +3 -12
- package/gen/models/InputTransform.js +1 -8
- package/gen/models/JavascriptTransform.d.ts +4 -0
- package/gen/models/JavascriptTransform.js +4 -0
- package/gen/models/MainArgSignature.d.ts +1 -1
- package/gen/models/NewSchedule.d.ts +1 -0
- package/gen/models/OpenFlowWPath.d.ts +4 -0
- package/gen/models/OpenFlowWPath.js +4 -0
- package/gen/models/PathFlow.d.ts +4 -0
- package/gen/models/PathFlow.js +4 -0
- package/gen/models/PathScript.d.ts +4 -0
- package/gen/models/PathScript.js +4 -0
- package/gen/models/RawScript.d.ts +12 -0
- package/gen/models/RawScript.js +11 -0
- package/gen/models/Schedule.d.ts +1 -1
- package/gen/models/StaticTransform.d.ts +4 -0
- package/gen/models/StaticTransform.js +4 -0
- package/gen/models/TokenResponse.d.ts +3 -3
- package/gen/models/Usage.d.ts +5 -0
- package/gen/models/Usage.js +4 -0
- package/gen/models/User.d.ts +2 -0
- package/gen/schemas/$AuditLog.d.ts +32 -0
- package/gen/schemas/$AuditLog.js +35 -0
- package/gen/schemas/$CompletedJob.d.ts +98 -0
- package/gen/schemas/$CompletedJob.js +103 -0
- package/gen/schemas/$ContextualVariable.d.ts +16 -0
- package/gen/schemas/$ContextualVariable.js +19 -0
- package/gen/schemas/$CreateResource.d.ts +22 -0
- package/gen/schemas/$CreateResource.js +25 -0
- package/gen/schemas/$CreateVariable.d.ts +26 -0
- package/gen/schemas/$CreateVariable.js +29 -0
- package/gen/schemas/$CreateWorkspace.d.ts +20 -0
- package/gen/schemas/$CreateWorkspace.js +23 -0
- package/gen/schemas/$EditResource.d.ts +13 -0
- package/gen/schemas/$EditResource.js +16 -0
- package/gen/schemas/$EditResourceType.d.ts +10 -0
- package/gen/schemas/$EditResourceType.js +13 -0
- package/gen/schemas/$EditSchedule.d.ts +20 -0
- package/gen/schemas/$EditSchedule.js +23 -0
- package/gen/schemas/$EditVariable.d.ts +16 -0
- package/gen/schemas/$EditVariable.js +19 -0
- package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
- package/gen/schemas/$EditWorkspaceUser.js +10 -0
- package/gen/schemas/$Flow.d.ts +23 -0
- package/gen/schemas/$Flow.js +26 -0
- package/gen/schemas/$FlowMetadata.d.ts +31 -0
- package/gen/schemas/$FlowMetadata.js +34 -0
- package/gen/schemas/$FlowPreview.d.ts +80 -0
- package/gen/schemas/$FlowPreview.js +83 -0
- package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
- package/gen/schemas/$GlobalUserInfo.js +29 -0
- package/gen/schemas/$Group.d.ts +23 -0
- package/gen/schemas/$Group.js +26 -0
- package/gen/schemas/$Job.d.ts +17 -0
- package/gen/schemas/$Job.js +20 -0
- package/gen/schemas/$ListableVariable.d.ts +35 -0
- package/gen/schemas/$ListableVariable.js +38 -0
- package/gen/schemas/$Login.d.ts +12 -0
- package/gen/schemas/$Login.js +15 -0
- package/gen/schemas/$MainArgSignature.d.ts +50 -0
- package/gen/schemas/$MainArgSignature.js +53 -0
- package/gen/schemas/$NewSchedule.d.ts +30 -0
- package/gen/schemas/$NewSchedule.js +33 -0
- package/gen/schemas/$NewToken.d.ts +11 -0
- package/gen/schemas/$NewToken.js +14 -0
- package/gen/schemas/$NewUser.d.ts +16 -0
- package/gen/schemas/$NewUser.js +19 -0
- package/gen/schemas/$Preview.d.ts +19 -0
- package/gen/schemas/$Preview.js +22 -0
- package/gen/schemas/$QueuedJob.d.ts +139 -0
- package/gen/schemas/$QueuedJob.js +144 -0
- package/gen/schemas/$Resource.d.ts +31 -0
- package/gen/schemas/$Resource.js +34 -0
- package/gen/schemas/$ResourceType.d.ts +17 -0
- package/gen/schemas/$ResourceType.js +20 -0
- package/gen/schemas/$Schedule.d.ts +47 -0
- package/gen/schemas/$Schedule.js +50 -0
- package/gen/schemas/$Script.d.ts +77 -0
- package/gen/schemas/$Script.js +80 -0
- package/gen/schemas/$ScriptArgs.d.ts +6 -0
- package/gen/schemas/$ScriptArgs.js +9 -0
- package/gen/schemas/$SlackToken.d.ts +24 -0
- package/gen/schemas/$SlackToken.js +27 -0
- package/gen/schemas/$TokenResponse.d.ts +23 -0
- package/gen/schemas/$TokenResponse.js +26 -0
- package/gen/schemas/$TruncatedToken.d.ts +25 -0
- package/gen/schemas/$TruncatedToken.js +28 -0
- package/gen/schemas/$Usage.d.ts +13 -0
- package/gen/schemas/$Usage.js +16 -0
- package/gen/schemas/$User.d.ts +42 -0
- package/gen/schemas/$User.js +45 -0
- package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
- package/gen/schemas/$UserWorkspaceList.js +31 -0
- package/gen/schemas/$WorkerPing.d.ts +31 -0
- package/gen/schemas/$WorkerPing.js +34 -0
- package/gen/schemas/$Workspace.d.ts +19 -0
- package/gen/schemas/$Workspace.js +22 -0
- package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
- package/gen/schemas/$WorkspaceInvite.js +19 -0
- package/gen/services/FlowService.d.ts +24 -23
- package/gen/services/FlowService.js +14 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -19
- package/gen/services/ScriptService.js +0 -14
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +85 -16
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +11 -13
- package/sql.d.ts +89 -0
- package/sql.js +817 -0
- package/stores.d.ts +0 -1
- package/stores.js +0 -6
- package/utils.d.ts +12 -5
- package/utils.js +55 -9
- package/components/RadioButtonV2.svelte +0 -33
- package/components/RadioButtonV2.svelte.d.ts +0 -20
|
@@ -5,6 +5,7 @@ import IconedResourceType from './IconedResourceType.svelte';
|
|
|
5
5
|
let resources = [];
|
|
6
6
|
export let value;
|
|
7
7
|
export let notPickable = false;
|
|
8
|
+
export let nonePickable = false;
|
|
8
9
|
async function loadResources() {
|
|
9
10
|
resources = await ResourceService.listResourceTypeNames({ workspace: $workspaceStore });
|
|
10
11
|
}
|
|
@@ -17,9 +18,24 @@ $: {
|
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
20
|
<div class="grid sm:grid-cols-2 md:grid-cols-3 gap-x-2 gap-y-1 items-center mb-2">
|
|
21
|
+
{#if nonePickable}
|
|
22
|
+
<button
|
|
23
|
+
class="px-4 h-8 text-center {undefined == value
|
|
24
|
+
? 'item-button-selected'
|
|
25
|
+
: notPickable
|
|
26
|
+
? 'item-button-disabled'
|
|
27
|
+
: 'item-button'}"
|
|
28
|
+
on:click={() => {
|
|
29
|
+
value = undefined
|
|
30
|
+
dispatch('click')
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
None
|
|
34
|
+
</button>
|
|
35
|
+
{/if}
|
|
20
36
|
{#each resources as r}
|
|
21
37
|
<button
|
|
22
|
-
class="px-4 h-8 {r == value
|
|
38
|
+
class="px-4 h-8 text-center {r == value
|
|
23
39
|
? 'item-button-selected'
|
|
24
40
|
: notPickable
|
|
25
41
|
? 'item-button-disabled'
|
|
@@ -35,34 +51,6 @@ $: {
|
|
|
35
51
|
</div>
|
|
36
52
|
|
|
37
53
|
<style>
|
|
38
|
-
.item-button {
|
|
39
|
-
padding-top: 0.25rem;
|
|
40
|
-
padding-bottom: 0.25rem;
|
|
41
|
-
border-width: 1px;
|
|
42
|
-
border-radius: 0.125rem
|
|
43
|
-
}
|
|
44
|
-
.item-button-selected {
|
|
45
|
-
padding-top: 0.25rem;
|
|
46
|
-
padding-bottom: 0.25rem;
|
|
47
|
-
border-width: 1px;
|
|
48
|
-
--tw-border-opacity: 1;
|
|
49
|
-
border-color: rgb(59 130 246 / var(--tw-border-opacity));
|
|
50
|
-
--tw-bg-opacity: 1;
|
|
51
|
-
background-color: rgb(239 246 255 / var(--tw-bg-opacity));
|
|
52
|
-
border-radius: 0.125rem
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.item-button-disabled {
|
|
56
|
-
padding-top: 0.25rem;
|
|
57
|
-
padding-bottom: 0.25rem;
|
|
58
|
-
border-width: 1px;
|
|
59
|
-
--tw-bg-opacity: 1;
|
|
60
|
-
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
|
61
|
-
--tw-text-opacity: 1;
|
|
62
|
-
color: rgb(209 213 219 / var(--tw-text-opacity));
|
|
63
|
-
border-radius: 0.125rem
|
|
64
|
-
}
|
|
65
|
-
|
|
66
54
|
.selected:hover {
|
|
67
55
|
border-radius: 0.375rem;
|
|
68
56
|
border-width: 1px;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>import { page } from '$app/stores';
|
|
2
|
-
import { getToday } from '../utils';
|
|
2
|
+
import { decodeState, getToday } from '../utils';
|
|
3
3
|
import { slide } from 'svelte/transition';
|
|
4
4
|
import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
|
|
5
5
|
import Icon from 'svelte-awesome';
|
|
6
|
-
import Tooltip from './Tooltip.svelte';
|
|
7
6
|
import SvelteMarkdown from 'svelte-markdown';
|
|
8
7
|
import SchemaForm from './SchemaForm.svelte';
|
|
8
|
+
import Tooltip from './Tooltip.svelte';
|
|
9
9
|
export let runnable;
|
|
10
10
|
export let runAction;
|
|
11
11
|
export let buttonText = 'Run';
|
|
@@ -15,7 +15,7 @@ export let args = {};
|
|
|
15
15
|
let isValid = true;
|
|
16
16
|
let queryArgs = $page.url.searchParams.get('args');
|
|
17
17
|
if (queryArgs) {
|
|
18
|
-
const parsed =
|
|
18
|
+
const parsed = decodeState(queryArgs);
|
|
19
19
|
Object.entries(parsed).forEach(([k, v]) => {
|
|
20
20
|
if (v == '<function call>') {
|
|
21
21
|
parsed[k] = undefined;
|
|
@@ -52,17 +52,16 @@ let scheduledForStr;
|
|
|
52
52
|
{#if runnable?.schema}
|
|
53
53
|
{#if detailed}
|
|
54
54
|
<h2>
|
|
55
|
-
Arguments
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Arguments
|
|
56
|
+
<Tooltip>
|
|
57
|
+
The optional fields, if left blank, will use the placeholder value as default.
|
|
58
|
+
</Tooltip>
|
|
58
59
|
</h2>
|
|
59
60
|
{/if}
|
|
60
61
|
{#if !runnable.schema.properties || Object.keys(runnable.schema.properties).length === 0}
|
|
61
|
-
<div class="text-sm">No arguments</div>
|
|
62
|
+
<div class="text-sm p-4">No arguments</div>
|
|
62
63
|
{:else}
|
|
63
|
-
<div
|
|
64
|
-
class="bg-gray-50 border border shadow-md shadow-blue-100 shadow-inner rounded border-gray-300 p-6"
|
|
65
|
-
>
|
|
64
|
+
<div class="bg-gray-50 border shadow-blue-100 shadow-inner rounded border-gray-300 p-6">
|
|
66
65
|
<SchemaForm schema={runnable.schema} bind:isValid bind:args />
|
|
67
66
|
</div>
|
|
68
67
|
{/if}
|
|
@@ -89,8 +88,10 @@ let scheduledForStr;
|
|
|
89
88
|
class="default-button-secondary mx-2 mb-1"
|
|
90
89
|
on:click={() => {
|
|
91
90
|
scheduledForStr = undefined
|
|
92
|
-
}}
|
|
91
|
+
}}
|
|
93
92
|
>
|
|
93
|
+
Clear
|
|
94
|
+
</button>
|
|
94
95
|
</div>
|
|
95
96
|
</div>
|
|
96
97
|
</div>
|
|
@@ -105,10 +106,8 @@ let scheduledForStr;
|
|
|
105
106
|
>
|
|
106
107
|
{#if schedulable}
|
|
107
108
|
<div>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
scale={0.5}
|
|
111
|
-
/>
|
|
109
|
+
Schedule to run later
|
|
110
|
+
<Icon data={viewOptions ? faChevronUp : faChevronDown} scale={0.5} />
|
|
112
111
|
</div>
|
|
113
112
|
{/if}
|
|
114
113
|
</button>
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { emptySchema, sendUserToast } from '../utils';
|
|
2
|
+
import { faPen, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { Button } from 'flowbite-svelte';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
5
|
+
import Icon from 'svelte-awesome';
|
|
2
6
|
import Editor from './Editor.svelte';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
7
|
+
import SchemaEditorProperty from './SchemaEditorProperty.svelte';
|
|
8
|
+
import SchemaModal, { DEFAULT_PROPERTY, schemaToModal } from './SchemaModal.svelte';
|
|
5
9
|
import TableCustom from './TableCustom.svelte';
|
|
10
|
+
import Toggle from './Toggle.svelte';
|
|
11
|
+
import Tooltip from './Tooltip.svelte';
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
6
13
|
export let schema = emptySchema();
|
|
7
14
|
let schemaModal;
|
|
8
15
|
let schemaString = '';
|
|
@@ -28,6 +35,18 @@ export function getSchema() {
|
|
|
28
35
|
throw Error(`Error: input is not a valid schema: ${err}`);
|
|
29
36
|
}
|
|
30
37
|
}
|
|
38
|
+
function modalToSchema(schema) {
|
|
39
|
+
return {
|
|
40
|
+
type: schema.selectedType,
|
|
41
|
+
description: schema.description,
|
|
42
|
+
pattern: schema.pattern,
|
|
43
|
+
default: schema.default,
|
|
44
|
+
enum: schema.enum_,
|
|
45
|
+
items: schema.items,
|
|
46
|
+
contentEncoding: schema.contentEncoding,
|
|
47
|
+
format: schema.format
|
|
48
|
+
};
|
|
49
|
+
}
|
|
31
50
|
function handleAddOrEditArgument() {
|
|
32
51
|
// If editing the arg's name, oldName containing the old argument name must be provided
|
|
33
52
|
argError = '';
|
|
@@ -58,14 +77,15 @@ function handleAddOrEditArgument() {
|
|
|
58
77
|
}
|
|
59
78
|
schema = schema;
|
|
60
79
|
schemaString = JSON.stringify(schema, null, '\t');
|
|
80
|
+
dispatch('change', schema);
|
|
61
81
|
}
|
|
62
82
|
function startEditArgument(argName) {
|
|
63
83
|
argError = '';
|
|
64
84
|
if (Object.keys(schema.properties).includes(argName)) {
|
|
65
|
-
schemaModal.openModal();
|
|
66
85
|
editing = true;
|
|
67
86
|
modalProperty = schemaToModal(schema.properties[argName], argName, schema.required.includes(argName));
|
|
68
87
|
oldArgName = argName;
|
|
88
|
+
schemaModal.openModal();
|
|
69
89
|
}
|
|
70
90
|
else {
|
|
71
91
|
sendUserToast(`This argument does not exist and can't be edited`, true);
|
|
@@ -75,8 +95,13 @@ function handleDeleteArgument(argName) {
|
|
|
75
95
|
try {
|
|
76
96
|
if (Object.keys(schema.properties).includes(argName)) {
|
|
77
97
|
delete schema.properties[argName];
|
|
98
|
+
const requiredIndex = schema.required.findIndex((arg) => arg === argName);
|
|
99
|
+
if (requiredIndex > -1) {
|
|
100
|
+
schema.required = schema.required.slice(requiredIndex, 1);
|
|
101
|
+
}
|
|
78
102
|
schema = schema;
|
|
79
103
|
schemaString = JSON.stringify(schema, null, '\t');
|
|
104
|
+
dispatch('change', schema);
|
|
80
105
|
}
|
|
81
106
|
else {
|
|
82
107
|
throw Error('Argument not found!');
|
|
@@ -101,93 +126,84 @@ function switchTab() {
|
|
|
101
126
|
</script>
|
|
102
127
|
|
|
103
128
|
<div class="flex flex-col">
|
|
104
|
-
<div class="
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
schemaModal.openModal()
|
|
130
|
-
}}>Add argument</button
|
|
131
|
-
>
|
|
129
|
+
<div class="flex justify-between">
|
|
130
|
+
<Button
|
|
131
|
+
on:click={() => {
|
|
132
|
+
modalProperty = Object.assign({}, DEFAULT_PROPERTY)
|
|
133
|
+
schemaModal.openModal()
|
|
134
|
+
}}
|
|
135
|
+
class="blue-button"
|
|
136
|
+
>
|
|
137
|
+
<Icon data={faPlus} class="mr-1" />
|
|
138
|
+
Add argument
|
|
139
|
+
</Button>
|
|
140
|
+
|
|
141
|
+
<div class="flex items-center">
|
|
142
|
+
<Toggle
|
|
143
|
+
on:change={() => switchTab()}
|
|
144
|
+
options={{
|
|
145
|
+
right: 'Json Schema Editor'
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
<div class="ml-2">
|
|
149
|
+
<Tooltip>
|
|
150
|
+
Arguments can be edited either using the wizard, or by editing their json-schema
|
|
151
|
+
<a href="https://docs.windmill.dev/docs/reference/script_arguments_reference">docs</a>
|
|
152
|
+
</Tooltip>
|
|
153
|
+
</div>
|
|
132
154
|
</div>
|
|
133
155
|
</div>
|
|
156
|
+
|
|
134
157
|
<!--json schema or table view-->
|
|
135
|
-
<div class="
|
|
158
|
+
<div class="h-full overflow-y-auto">
|
|
136
159
|
{#if !viewJsonSchema}
|
|
137
160
|
<div class="h-full">
|
|
138
161
|
{#if schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
|
|
139
|
-
<TableCustom
|
|
140
|
-
<tr slot="header-row"
|
|
141
|
-
<th>
|
|
142
|
-
<th>
|
|
143
|
-
<th>
|
|
144
|
-
<th>
|
|
145
|
-
<th>
|
|
162
|
+
<TableCustom>
|
|
163
|
+
<tr slot="header-row">
|
|
164
|
+
<th>Name</th>
|
|
165
|
+
<th>Type</th>
|
|
166
|
+
<th>Description</th>
|
|
167
|
+
<th>Default</th>
|
|
168
|
+
<th>Required</th>
|
|
169
|
+
<th />
|
|
146
170
|
</tr>
|
|
147
171
|
<tbody slot="body">
|
|
148
172
|
{#each Object.entries(schema.properties) as [name, property] (name)}
|
|
149
173
|
<tr>
|
|
150
|
-
<td>{name}</td>
|
|
151
|
-
<td
|
|
152
|
-
|
|
153
|
-
>
|
|
174
|
+
<td class="font-bold">{name}</td>
|
|
175
|
+
<td>
|
|
176
|
+
<SchemaEditorProperty {property} />
|
|
177
|
+
</td>
|
|
154
178
|
<td>{property.description}</td>
|
|
155
179
|
<td>{JSON.stringify(property.default) ?? ''}</td>
|
|
156
|
-
<td>{schema.required.includes(name) ? '
|
|
157
|
-
<td class="">
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
-
>
|
|
166
|
-
<path
|
|
167
|
-
stroke-linecap="round"
|
|
168
|
-
stroke-linejoin="round"
|
|
169
|
-
stroke-width="2"
|
|
170
|
-
d="M6 18L18 6M6 6l12 12"
|
|
171
|
-
/>
|
|
172
|
-
</svg></button
|
|
180
|
+
<td>{schema.required.includes(name) ? 'Required' : 'Optional'}</td>
|
|
181
|
+
<td class="justify-end flex">
|
|
182
|
+
<Button
|
|
183
|
+
color="red"
|
|
184
|
+
outline
|
|
185
|
+
class="mr-2"
|
|
186
|
+
size="xs"
|
|
187
|
+
on:click={() => handleDeleteArgument(name)}
|
|
173
188
|
>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}}
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
<Icon data={faTrash} class="mr-2" scale={0.8} />
|
|
190
|
+
Delete
|
|
191
|
+
</Button>
|
|
192
|
+
<Button color="alternative" size="xs" on:click={() => startEditArgument(name)}>
|
|
193
|
+
<Icon data={faPen} class="mr-2" scale={0.8} />
|
|
194
|
+
Edit
|
|
195
|
+
</Button>
|
|
196
|
+
</td>
|
|
181
197
|
</tr>
|
|
182
198
|
{/each}
|
|
183
199
|
</tbody>
|
|
184
200
|
</TableCustom>
|
|
185
201
|
{:else}
|
|
186
|
-
<div class="text-gray-700 text-xs italic">This
|
|
202
|
+
<div class="text-gray-700 text-xs italic mt-2">This schema has no arguments.</div>
|
|
187
203
|
{/if}
|
|
188
204
|
</div>
|
|
189
205
|
{:else}
|
|
190
|
-
<div>
|
|
206
|
+
<div class="border rounded mt-4 p-2">
|
|
191
207
|
<Editor
|
|
192
208
|
on:change={() => {
|
|
193
209
|
try {
|
|
@@ -197,7 +213,7 @@ function switchTab() {
|
|
|
197
213
|
}
|
|
198
214
|
}}
|
|
199
215
|
bind:code={schemaString}
|
|
200
|
-
lang=
|
|
216
|
+
lang="json"
|
|
201
217
|
class="small-editor"
|
|
202
218
|
/>
|
|
203
219
|
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>import { Badge } from 'flowbite-svelte';
|
|
2
|
+
export let property;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<Badge color="blue">{property.type?.toUpperCase() ?? 'ANY'}</Badge>
|
|
6
|
+
{#if property.format}
|
|
7
|
+
<Badge color="green">{property.format?.toUpperCase()}</Badge>
|
|
8
|
+
{/if}
|
|
9
|
+
{#if property.contentEncoding}
|
|
10
|
+
<Badge color="indigo">{property.contentEncoding?.toUpperCase()}</Badge>
|
|
11
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SchemaProperty } from '../common';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
property: SchemaProperty;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type SchemaEditorPropertyProps = typeof __propDef.props;
|
|
13
|
+
export declare type SchemaEditorPropertyEvents = typeof __propDef.events;
|
|
14
|
+
export declare type SchemaEditorPropertySlots = typeof __propDef.slots;
|
|
15
|
+
export default class SchemaEditorProperty extends SvelteComponentTyped<SchemaEditorPropertyProps, SchemaEditorPropertyEvents, SchemaEditorPropertySlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,145 +1,39 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { allTrue } from '../utils';
|
|
1
|
+
<script>import { allTrue } from '../utils';
|
|
3
2
|
import ArgInput from './ArgInput.svelte';
|
|
4
|
-
import
|
|
5
|
-
import FieldHeader from './FieldHeader.svelte';
|
|
6
|
-
import DynamicInputHelpBox from './flows/DynamicInputHelpBox.svelte';
|
|
7
|
-
import { getCodeInjectionExpr, getDefaultExpr, isCodeInjection } from './flows/utils';
|
|
8
|
-
import OverlayPropertyPicker from './propertyPicker/OverlayPropertyPicker.svelte';
|
|
9
|
-
import Toggle from './Toggle.svelte';
|
|
3
|
+
import InputTransformForm from './InputTransformForm.svelte';
|
|
10
4
|
export let inputTransform = false;
|
|
11
5
|
export let schema;
|
|
12
6
|
export let args = {};
|
|
13
7
|
export let editableSchema = false;
|
|
14
|
-
export let extraLib = 'missing extraLib';
|
|
15
8
|
export let isValid = true;
|
|
9
|
+
export let pickableProperties = undefined;
|
|
10
|
+
export let extraLib = 'missing extraLib';
|
|
16
11
|
export let i = undefined;
|
|
17
|
-
export let previousSchema = undefined;
|
|
18
12
|
let inputCheck = {};
|
|
19
13
|
$: isValid = allTrue(inputCheck) ?? false;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!arg) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (isCodeInjection(rawValue)) {
|
|
28
|
-
args[id].expr = getCodeInjectionExpr(rawValue, isRaw);
|
|
29
|
-
args[id].type = InputTransform.type.JAVASCRIPT;
|
|
30
|
-
propertiesTypes[id] = InputTransform.type.STATIC;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (args[id].type === InputTransform.type.JAVASCRIPT &&
|
|
34
|
-
propertiesTypes[id] === InputTransform.type.STATIC) {
|
|
35
|
-
args[id].type = InputTransform.type.STATIC;
|
|
36
|
-
if (inputCats[id] == 'number') {
|
|
37
|
-
args[id].value = Number(args[id].value);
|
|
38
|
-
}
|
|
14
|
+
function removeExtraKey() {
|
|
15
|
+
Object.keys(args).forEach((key) => {
|
|
16
|
+
if (!Object.keys(schema?.properties ?? {}).includes(key)) {
|
|
17
|
+
delete args[key];
|
|
39
18
|
}
|
|
40
|
-
|
|
41
|
-
propertiesTypes[id] = arg.type;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function hasOverlay(inputCat) {
|
|
46
|
-
return inputCat === 'string' || inputCat === 'number';
|
|
19
|
+
});
|
|
47
20
|
}
|
|
21
|
+
$: Object.keys(schema?.properties ?? {}).length > 0 && removeExtraKey();
|
|
48
22
|
</script>
|
|
49
23
|
|
|
50
24
|
<div class="w-full">
|
|
51
25
|
{#if Object.keys(schema?.properties ?? {}).length > 0}
|
|
52
|
-
{#each Object.keys(schema?.properties ?? {}) as argName
|
|
53
|
-
{#if inputTransform
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
itemsType={schema.properties[argName].items}
|
|
64
|
-
/>
|
|
65
|
-
{#if propertiesTypes[argName] === InputTransform.type.STATIC && args[argName].type === InputTransform.type.JAVASCRIPT}
|
|
66
|
-
<span
|
|
67
|
-
class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded ml-2"
|
|
68
|
-
>
|
|
69
|
-
{'${...}'}
|
|
70
|
-
</span>
|
|
71
|
-
{/if}
|
|
72
|
-
</div>
|
|
73
|
-
<Toggle
|
|
74
|
-
options={{
|
|
75
|
-
left: { label: '', value: InputTransform.type.STATIC },
|
|
76
|
-
right: { label: 'Raw Javascript Editor', value: InputTransform.type.JAVASCRIPT }
|
|
77
|
-
}}
|
|
78
|
-
bind:value={propertiesTypes[argName]}
|
|
79
|
-
on:change={(e) => {
|
|
80
|
-
if (e.detail === InputTransform.type.JAVASCRIPT) {
|
|
81
|
-
args[argName].expr = getDefaultExpr(i ?? -1, argName)
|
|
82
|
-
args[argName].value = undefined
|
|
83
|
-
} else {
|
|
84
|
-
args[argName].expr = undefined
|
|
85
|
-
args[argName].value = undefined
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
args[argName].type = e.detail
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
<div class="max-w-xs" />
|
|
93
|
-
|
|
94
|
-
{#if propertiesTypes[argName] === undefined || propertiesTypes[argName] === InputTransform.type.STATIC}
|
|
95
|
-
<OverlayPropertyPicker
|
|
96
|
-
{previousSchema}
|
|
97
|
-
disabled={!hasOverlay(inputCats[argName])}
|
|
98
|
-
on:select={(event) => {
|
|
99
|
-
const toAppend = `\$\{previous_result.${event.detail}}`
|
|
100
|
-
args[argName].value = `${args[argName].value ?? ''}${toAppend}`
|
|
101
|
-
setPropertyType(argName, args[argName].value, false)
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<ArgInput
|
|
105
|
-
label={argName}
|
|
106
|
-
bind:description={schema.properties[argName].description}
|
|
107
|
-
bind:value={args[argName].value}
|
|
108
|
-
type={schema.properties[argName].type}
|
|
109
|
-
required={schema.required.includes(argName)}
|
|
110
|
-
bind:pattern={schema.properties[argName].pattern}
|
|
111
|
-
bind:valid={inputCheck[argName]}
|
|
112
|
-
defaultValue={schema.properties[argName].default}
|
|
113
|
-
bind:enum_={schema.properties[argName].enum}
|
|
114
|
-
bind:format={schema.properties[argName].format}
|
|
115
|
-
contentEncoding={schema.properties[argName].contentEncoding}
|
|
116
|
-
bind:itemsType={schema.properties[argName].items}
|
|
117
|
-
displayHeader={false}
|
|
118
|
-
bind:inputCat={inputCats[argName]}
|
|
119
|
-
numberAsString={true}
|
|
120
|
-
on:input={(e) => {
|
|
121
|
-
if (hasOverlay(inputCats[argName])) {
|
|
122
|
-
setPropertyType(argName, e.detail.rawValue, e.detail.isRaw)
|
|
123
|
-
}
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
</OverlayPropertyPicker>
|
|
127
|
-
{:else if propertiesTypes[argName] === InputTransform.type.JAVASCRIPT}
|
|
128
|
-
{#if args[argName].expr != undefined}
|
|
129
|
-
<div class="border rounded p-2 mt-2 border-gray-300">
|
|
130
|
-
<Editor
|
|
131
|
-
bind:code={args[argName].expr}
|
|
132
|
-
lang="typescript"
|
|
133
|
-
class="few-lines-editor"
|
|
134
|
-
{extraLib}
|
|
135
|
-
extraLibPath="file:///node_modules/@types/windmill@{i}/index.d.ts"
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
<DynamicInputHelpBox />
|
|
139
|
-
{/if}
|
|
140
|
-
{:else}
|
|
141
|
-
<p>Not recognized arg type {args[argName].type}</p>
|
|
142
|
-
{/if}
|
|
26
|
+
{#each Object.keys(schema?.properties ?? {}) as argName}
|
|
27
|
+
{#if inputTransform}
|
|
28
|
+
<InputTransformForm
|
|
29
|
+
bind:arg={args[argName]}
|
|
30
|
+
bind:schema
|
|
31
|
+
bind:argName
|
|
32
|
+
bind:inputCheck
|
|
33
|
+
bind:pickableProperties
|
|
34
|
+
bind:extraLib
|
|
35
|
+
bind:i
|
|
36
|
+
/>
|
|
143
37
|
{:else}
|
|
144
38
|
<ArgInput
|
|
145
39
|
label={argName}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Schema } from '../common';
|
|
3
|
-
import { InputTransform } from '../gen';
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
6
5
|
inputTransform?: boolean | undefined;
|
|
7
6
|
schema: Schema;
|
|
8
|
-
args?: Record<string,
|
|
7
|
+
args?: Record<string, any> | undefined;
|
|
9
8
|
editableSchema?: boolean | undefined;
|
|
10
|
-
extraLib?: string | undefined;
|
|
11
9
|
isValid?: boolean | undefined;
|
|
10
|
+
pickableProperties?: Object | undefined;
|
|
11
|
+
extraLib?: string | undefined;
|
|
12
12
|
i?: number | undefined;
|
|
13
|
-
previousSchema?: Object | undefined;
|
|
14
13
|
};
|
|
15
14
|
events: {
|
|
16
15
|
[evt: string]: CustomEvent<any>;
|