windmill-components 1.35.42 → 1.36.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/AppConnect.svelte +85 -59
- package/components/ArgInput.svelte +50 -33
- package/components/ArgInput.svelte.d.ts +1 -1
- package/components/Button.svelte +15 -48
- package/components/Button.svelte.d.ts +1 -1
- package/components/CronInput.svelte +1 -1
- package/components/DisplayResult.svelte +75 -67
- package/components/Dropdown.svelte +9 -7
- package/components/Editor.svelte +187 -178
- package/components/Editor.svelte.d.ts +4 -2
- package/components/EditorBar.svelte +135 -98
- package/components/EditorBar.svelte.d.ts +2 -1
- package/components/FlowBuilder.svelte +115 -134
- package/components/FlowJobResult.svelte +4 -5
- package/components/FlowModulesViewer.svelte +89 -7
- package/components/FlowModulesViewer.svelte.d.ts +1 -0
- package/components/FlowPreviewContent.svelte +88 -27
- package/components/FlowPreviewContent.svelte.d.ts +1 -1
- package/components/FlowStatusViewer.svelte +39 -24
- package/components/FlowStatusViewer.svelte.d.ts +0 -1
- package/components/FlowViewer.svelte +17 -11
- package/components/GroupModal.svelte +10 -1
- package/components/HighlightCode.svelte +22 -0
- package/components/HighlightCode.svelte.d.ts +17 -0
- package/components/IconedPath.svelte +9 -7
- package/components/InputTransformForm.svelte +97 -115
- package/components/InputTransformForm.svelte.d.ts +0 -1
- package/components/InputTransformsViewer.svelte +1 -1
- package/components/InviteGlobalUser.svelte +8 -8
- package/components/InviteUser.svelte +9 -9
- package/components/ItemPicker.svelte +37 -30
- package/components/ItemPicker.svelte.d.ts +2 -1
- package/components/JobStatus.svelte +2 -1
- package/components/LogViewer.svelte +23 -0
- package/components/LogViewer.svelte.d.ts +19 -0
- package/components/ModulePreview.svelte +107 -0
- package/components/ModulePreview.svelte.d.ts +24 -0
- package/components/Path.svelte +1 -1
- package/components/RadioButton.svelte +3 -2
- package/components/ResourceEditor.svelte +22 -34
- package/components/ResourceTypePicker.svelte +23 -34
- package/components/RunForm.svelte +34 -31
- package/components/RunForm.svelte.d.ts +6 -2
- package/components/SchemaEditor.svelte +19 -11
- package/components/SchemaForm.svelte +3 -3
- package/components/SchemaForm.svelte.d.ts +1 -1
- package/components/SchemaModal.svelte +18 -7
- package/components/ScriptBuilder.svelte +99 -83
- package/components/ScriptBuilder.svelte.d.ts +2 -4
- package/components/ScriptEditor.svelte +71 -143
- package/components/ScriptEditor.svelte.d.ts +0 -5
- package/components/ScriptPicker.svelte +24 -14
- package/components/ScriptPicker.svelte.d.ts +2 -1
- package/components/ScriptSchema.svelte +8 -11
- package/components/ScriptSchema.svelte.d.ts +0 -1
- package/components/ShareModal.svelte +6 -6
- package/components/SharedBadge.svelte +5 -13
- package/components/SimpleEditor.svelte +14 -10
- package/components/StringTypeNarrowing.svelte +24 -30
- package/components/TestJobLoader.svelte +106 -0
- package/components/TestJobLoader.svelte.d.ts +26 -0
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +15 -24
- package/components/common/actionRow/ActionRow.svelte +31 -0
- package/components/common/actionRow/ActionRow.svelte.d.ts +22 -0
- package/components/common/alert/Alert.svelte +53 -0
- package/components/common/alert/Alert.svelte.d.ts +20 -0
- package/components/common/alert/model.d.ts +1 -0
- package/components/common/alert/model.js +1 -0
- package/components/common/badge/Badge.svelte +76 -0
- package/components/common/badge/Badge.svelte.d.ts +28 -0
- package/components/common/badge/model.d.ts +8 -0
- package/components/common/badge/model.js +1 -0
- package/components/common/button/Button.svelte +110 -0
- package/components/common/button/Button.svelte.d.ts +39 -0
- package/components/common/button/model.d.ts +6 -0
- package/components/common/button/model.js +1 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte +72 -0
- package/components/common/confirmationModal/ConfirmationModal.svelte.d.ts +23 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +41 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte.d.ts +14 -0
- package/components/common/confirmationModal/dirtyStore.d.ts +1 -0
- package/components/common/confirmationModal/dirtyStore.js +2 -0
- package/components/common/drawer/Drawer.svelte +3 -0
- package/components/common/drawer/Drawer.svelte.d.ts +2 -0
- package/components/common/index.d.ts +14 -0
- package/components/common/index.js +14 -0
- package/components/common/tabs/TabContent.svelte +3 -2
- package/components/common/tabs/TabContent.svelte.d.ts +1 -0
- package/components/common/tabs/Tabs.svelte +8 -1
- package/components/common/tabs/Tabs.svelte.d.ts +2 -0
- package/components/common/toggleButton/ToggleButton.svelte +20 -0
- package/components/common/toggleButton/ToggleButton.svelte.d.ts +19 -0
- package/components/common/toggleButton/ToggleButtonGroup.svelte +33 -0
- package/components/common/toggleButton/ToggleButtonGroup.svelte.d.ts +24 -0
- package/components/flows/FlowEditor.svelte +30 -0
- package/components/{FlowEditor.svelte.d.ts → flows/FlowEditor.svelte.d.ts} +1 -6
- package/components/flows/common/FlowCard.svelte +9 -0
- package/components/flows/common/FlowCard.svelte.d.ts +21 -0
- package/components/flows/common/FlowCardHeader.svelte +39 -0
- package/components/flows/common/FlowCardHeader.svelte.d.ts +20 -0
- package/components/flows/content/CopyFirstStepSchema.svelte +13 -0
- package/components/flows/{CopyFirstStepSchema.svelte.d.ts → content/CopyFirstStepSchema.svelte.d.ts} +0 -0
- package/components/flows/{DynamicInputHelpBox.svelte → content/DynamicInputHelpBox.svelte} +0 -0
- package/components/flows/{DynamicInputHelpBox.svelte.d.ts → content/DynamicInputHelpBox.svelte.d.ts} +0 -0
- package/components/flows/content/FlowEditorPanel.svelte +25 -0
- package/components/flows/content/FlowEditorPanel.svelte.d.ts +16 -0
- package/components/flows/content/FlowFailureModule.svelte +15 -0
- package/components/flows/content/FlowFailureModule.svelte.d.ts +14 -0
- package/components/flows/content/FlowInput.svelte +26 -0
- package/components/flows/{FlowInput.svelte.d.ts → content/FlowInput.svelte.d.ts} +0 -0
- package/components/flows/content/FlowInputs.svelte +91 -0
- package/components/flows/{FlowInputs.svelte.d.ts → content/FlowInputs.svelte.d.ts} +1 -0
- package/components/flows/content/FlowLoop.svelte +168 -0
- package/components/flows/content/FlowLoop.svelte.d.ts +18 -0
- package/components/flows/content/FlowLoopWrapper.svelte +9 -0
- package/components/flows/content/FlowLoopWrapper.svelte.d.ts +14 -0
- package/components/flows/content/FlowModule.svelte +211 -0
- package/components/flows/content/FlowModule.svelte.d.ts +29 -0
- package/components/flows/content/FlowModuleEarlyStop.svelte +76 -0
- package/components/flows/content/FlowModuleEarlyStop.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleHeader.svelte +157 -0
- package/components/flows/{FlowModuleHeader.svelte.d.ts → content/FlowModuleHeader.svelte.d.ts} +5 -3
- package/components/flows/content/FlowModuleScript.svelte +21 -0
- package/components/flows/content/FlowModuleScript.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleSuspend.svelte +27 -0
- package/components/flows/content/FlowModuleSuspend.svelte.d.ts +17 -0
- package/components/flows/content/FlowModuleWrapper.svelte +45 -0
- package/components/flows/content/FlowModuleWrapper.svelte.d.ts +14 -0
- package/components/flows/content/FlowRetries.svelte +80 -0
- package/components/flows/content/FlowRetries.svelte.d.ts +17 -0
- package/components/flows/content/FlowSchedules.svelte +18 -0
- package/components/flows/content/FlowSchedules.svelte.d.ts +14 -0
- package/components/flows/content/FlowSettings.svelte +78 -0
- package/components/flows/{FlowSettings.svelte.d.ts → content/FlowSettings.svelte.d.ts} +2 -6
- package/components/flows/content/RemoveStepConfirmationModal.svelte +32 -0
- package/components/flows/content/RemoveStepConfirmationModal.svelte.d.ts +19 -0
- package/components/flows/flowState.d.ts +8 -7
- package/components/flows/flowState.js +25 -46
- package/components/flows/flowStateUtils.d.ts +16 -14
- package/components/flows/flowStateUtils.js +81 -73
- package/components/flows/flowStore.js +7 -4
- package/components/flows/header/FlowImportExportMenu.svelte +55 -0
- package/components/flows/header/FlowImportExportMenu.svelte.d.ts +14 -0
- package/components/flows/header/FlowPreviewButtons.svelte +57 -0
- package/components/flows/header/FlowPreviewButtons.svelte.d.ts +14 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte +60 -0
- package/components/flows/map/FlowErrorHandlerItem.svelte.d.ts +14 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte +80 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +32 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte +241 -0
- package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +20 -0
- package/components/flows/pickers/PickHubScript.svelte +5 -3
- package/components/flows/pickers/PickHubScript.svelte.d.ts +2 -1
- package/components/flows/pickers/PickScript.svelte +4 -12
- package/components/flows/pickers/PickScript.svelte.d.ts +1 -1
- package/components/flows/propPicker/PropPickerWrapper.svelte +44 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +33 -0
- package/components/flows/scheduleUtils.d.ts +0 -1
- package/components/flows/scheduleUtils.js +0 -1
- package/components/flows/types.d.ts +8 -0
- package/components/flows/types.js +1 -0
- package/components/flows/utils.d.ts +3 -1
- package/components/flows/utils.js +26 -10
- package/components/icons/AirtableIcon.svelte +1 -1
- package/components/icons/DiscordIcon.svelte +1 -1
- package/components/icons/GCloudIcon.svelte +1 -1
- package/components/icons/GItlabIcon.svelte +1 -1
- package/components/icons/GSheetsIcon.svelte +1 -1
- package/components/icons/GcalIcon.svelte +1 -1
- package/components/icons/GdriveIcon.svelte +1 -1
- package/components/icons/GithubIcon.svelte +1 -1
- package/components/icons/GmailIcon.svelte +1 -1
- package/components/icons/HatIcon.svelte +19 -0
- package/components/icons/HatIcon.svelte.d.ts +16 -0
- package/components/icons/MastodonIcon.svelte +1 -1
- package/components/icons/MatrixIcon.svelte +1 -1
- package/components/icons/PostgresIcon.svelte +1 -1
- package/components/icons/S3Icon.svelte +1 -1
- package/components/icons/Slack.svelte +1 -1
- package/components/icons/TogglIcon.svelte +8 -46
- package/components/jobs/JobDetail.svelte +1 -1
- package/components/landing/FlowGettingStarted.svelte +22 -68
- package/components/landing/FlowLandingBox.svelte +1 -1
- package/components/landing/RessourceGettingStarted.svelte +7 -37
- package/components/landing/ScriptBox.svelte +33 -60
- package/components/landing/ScriptGettingStarted.svelte +23 -69
- package/components/propertyPicker/ObjectViewer.svelte +18 -12
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/PropPicker.svelte +108 -11
- package/components/propertyPicker/WarningMessage.svelte +2 -15
- package/components/script_editor/LogPanel.svelte +108 -119
- package/components/script_editor/LogPanel.svelte.d.ts +2 -0
- package/components/sidebar/SidebarContent.svelte +2 -2
- package/editorUtils.d.ts +3 -0
- package/editorUtils.js +1 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +1 -0
- package/gen/models/CompletedJob.d.ts +2 -1
- package/gen/models/CompletedJob.js +1 -0
- package/gen/models/FlowModule.d.ts +3 -0
- package/gen/models/FlowStatus.d.ts +3 -0
- package/gen/models/FlowStatusModule.d.ts +1 -1
- package/gen/models/Preview.d.ts +2 -1
- package/gen/models/Preview.js +1 -0
- package/gen/models/QueuedJob.d.ts +2 -1
- package/gen/models/QueuedJob.js +1 -0
- package/gen/models/RawScript.d.ts +2 -1
- package/gen/models/RawScript.js +1 -0
- package/gen/models/Retry.d.ts +11 -0
- package/gen/models/Retry.js +4 -0
- package/gen/models/Script.d.ts +9 -2
- package/gen/models/Script.js +8 -0
- package/gen/services/JobService.d.ts +40 -0
- package/gen/services/JobService.js +70 -0
- package/gen/services/ScriptService.d.ts +14 -3
- package/gen/services/ScriptService.js +13 -0
- package/infer.d.ts +1 -1
- package/infer.js +6 -1
- package/package.json +71 -38
- package/script_helpers.d.ts +8 -2
- package/script_helpers.js +88 -16
- package/stores.d.ts +1 -1
- package/utils.d.ts +8 -6
- package/utils.js +57 -21
- package/components/FlowEditor.svelte +0 -55
- package/components/FlowPreview.svelte +0 -107
- package/components/FlowPreview.svelte.d.ts +0 -23
- package/components/ModuleStep.svelte +0 -131
- package/components/ModuleStep.svelte.d.ts +0 -25
- package/components/flows/CopyFirstStepSchema.svelte +0 -13
- package/components/flows/FlowBox.svelte +0 -16
- package/components/flows/FlowBox.svelte.d.ts +0 -23
- package/components/flows/FlowBoxHeader.svelte +0 -16
- package/components/flows/FlowBoxHeader.svelte.d.ts +0 -21
- package/components/flows/FlowInput.svelte +0 -22
- package/components/flows/FlowInputs.svelte +0 -65
- package/components/flows/FlowModuleHeader.svelte +0 -109
- package/components/flows/FlowSettings.svelte +0 -165
- package/components/flows/FlowTimeline.svelte +0 -169
- package/components/flows/FlowTimeline.svelte.d.ts +0 -21
- package/components/flows/stepOpenedStore.d.ts +0 -1
- package/components/flows/stepOpenedStore.js +0 -6
- package/components/propertyPicker/OverlayPropertyPicker.svelte +0 -69
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +0 -24
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
<script>import { ScriptService, FlowService } from '../gen';
|
|
2
|
-
import Icon from 'svelte-awesome';
|
|
1
|
+
<script>import { ScriptService, FlowService, Script } from '../gen';
|
|
3
2
|
import { faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
4
3
|
import { hubScripts, workspaceStore } from '../stores';
|
|
5
4
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -10,11 +9,12 @@ import typescript from 'svelte-highlight/languages/typescript';
|
|
|
10
9
|
import python from 'svelte-highlight/languages/python';
|
|
11
10
|
import { getScriptByPath } from '../utils';
|
|
12
11
|
import RadioButton from './RadioButton.svelte';
|
|
12
|
+
import { Button } from './common';
|
|
13
13
|
export let scriptPath = undefined;
|
|
14
14
|
export let allowFlow = false;
|
|
15
15
|
export let allowHub = false;
|
|
16
16
|
export let itemKind = allowHub ? 'hub' : 'script';
|
|
17
|
-
export let
|
|
17
|
+
export let kind = Script.kind.SCRIPT;
|
|
18
18
|
let items = [];
|
|
19
19
|
let itemPicker;
|
|
20
20
|
let modalViewer;
|
|
@@ -29,7 +29,7 @@ async function loadItems() {
|
|
|
29
29
|
items = await FlowService.listFlows({ workspace: $workspaceStore });
|
|
30
30
|
}
|
|
31
31
|
else if (itemKind == 'script') {
|
|
32
|
-
items = await ScriptService.listScripts({ workspace: $workspaceStore,
|
|
32
|
+
items = await ScriptService.listScripts({ workspace: $workspaceStore, kind });
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
items = $hubScripts ?? [];
|
|
@@ -56,27 +56,37 @@ $: {
|
|
|
56
56
|
}}
|
|
57
57
|
/>
|
|
58
58
|
|
|
59
|
-
<div class="flex flex-row items-center
|
|
60
|
-
<div class="w-80">
|
|
59
|
+
<div class="flex flex-row flex-wrap items-center gap-4">
|
|
60
|
+
<div class="w-80 -mb-2">
|
|
61
61
|
{#if options.length > 1}
|
|
62
62
|
<RadioButton bind:value={itemKind} {options} />
|
|
63
63
|
{/if}
|
|
64
64
|
</div>
|
|
65
65
|
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
<div class="flex items-center grow gap-4">
|
|
67
|
+
<input type="text" value={scriptPath ?? 'No path chosen yet'} disabled />
|
|
68
|
+
<Button
|
|
69
|
+
size="sm"
|
|
70
|
+
endIcon={{ icon: faSearch }}
|
|
71
|
+
btnClasses="mx-auto whitespace-nowrap"
|
|
72
|
+
on:click={() => itemPicker.openModal()}
|
|
73
|
+
>
|
|
74
|
+
Pick a {itemKind} path
|
|
75
|
+
</Button>
|
|
76
|
+
</div>
|
|
77
|
+
{#if scriptPath !== undefined && scriptPath !== ''}
|
|
78
|
+
<Button
|
|
79
|
+
color="light"
|
|
80
|
+
size="xs"
|
|
73
81
|
on:click={async () => {
|
|
74
82
|
const { language, content } = await getScriptByPath(scriptPath ?? '')
|
|
75
83
|
code = content
|
|
76
84
|
lang = language
|
|
77
85
|
modalViewer.openModal()
|
|
78
|
-
}}
|
|
86
|
+
}}
|
|
79
87
|
>
|
|
88
|
+
Show code
|
|
89
|
+
</Button>
|
|
80
90
|
{/if}
|
|
81
91
|
</div>
|
|
82
92
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { Script } from '../gen';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
scriptPath?: string | undefined;
|
|
5
6
|
allowFlow?: boolean | undefined;
|
|
6
7
|
allowHub?: boolean | undefined;
|
|
7
8
|
itemKind?: "flow" | "script" | "hub" | undefined;
|
|
8
|
-
|
|
9
|
+
kind?: Script.kind | undefined;
|
|
9
10
|
};
|
|
10
11
|
events: {
|
|
11
12
|
select: CustomEvent<any>;
|
|
@@ -9,7 +9,6 @@ import SvelteMarkdown from 'svelte-markdown';
|
|
|
9
9
|
export let schema;
|
|
10
10
|
export let summary;
|
|
11
11
|
export let description;
|
|
12
|
-
export let synchronizedHeader = true;
|
|
13
12
|
export function setSchema(newSchema) {
|
|
14
13
|
schema = newSchema;
|
|
15
14
|
}
|
|
@@ -47,16 +46,14 @@ export function setSchema(newSchema) {
|
|
|
47
46
|
</div>
|
|
48
47
|
</div>
|
|
49
48
|
</div>
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</div>
|
|
59
|
-
{/if}
|
|
49
|
+
<div class="bg-blue-100 border-l-4 border-blue-600 text-blue-700 p-4 m-4" role="alert">
|
|
50
|
+
<p class="font-bold">Synchronized with main signature</p>
|
|
51
|
+
<p>
|
|
52
|
+
Argument names, being required or not, and default values are derived from the main
|
|
53
|
+
signature of step 2 and cannot be edited directly. Change the main signature to edit
|
|
54
|
+
them.
|
|
55
|
+
</p>
|
|
56
|
+
</div>
|
|
60
57
|
<SchemaForm {schema} editableSchema={true} />
|
|
61
58
|
</TabContent>
|
|
62
59
|
<TabContent value="jsonschema">
|
|
@@ -6,6 +6,7 @@ import { GroupService, UserService } from '../gen';
|
|
|
6
6
|
import { createEventDispatcher } from 'svelte';
|
|
7
7
|
import AutoComplete from 'simple-svelte-autocomplete';
|
|
8
8
|
import { workspaceStore } from '../stores';
|
|
9
|
+
import { Button } from './common';
|
|
9
10
|
const dispatch = createEventDispatcher();
|
|
10
11
|
export let kind;
|
|
11
12
|
export let path = '';
|
|
@@ -101,10 +102,9 @@ async function addAcl(owner, write) {
|
|
|
101
102
|
<span class="text-sm text-gray-700">Editor</span>
|
|
102
103
|
<input class="block mt-4" type="checkbox" bind:checked={write} />
|
|
103
104
|
</label>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
>
|
|
105
|
+
<Button size="sm" btnClasses="ml-2" on:click={() => addAcl(newOwner, write)}>
|
|
106
|
+
Add permission
|
|
107
|
+
</Button>
|
|
108
108
|
</div>
|
|
109
109
|
<TableCustom>
|
|
110
110
|
<tr slot="header-row">
|
|
@@ -118,8 +118,8 @@ async function addAcl(owner, write) {
|
|
|
118
118
|
<td>{owner}</td>
|
|
119
119
|
<td>{write}</td>
|
|
120
120
|
<td
|
|
121
|
-
><
|
|
122
|
-
>Delete</
|
|
121
|
+
><Button variant="border" color="blue" size="sm" on:click={() => deleteAcl(owner)}
|
|
122
|
+
>Delete</Button
|
|
123
123
|
></td
|
|
124
124
|
>
|
|
125
125
|
</tr>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script>import { userStore } from '../stores';
|
|
2
2
|
import { faPeopleGroup } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import
|
|
4
|
-
import Badge from './Badge.svelte';
|
|
3
|
+
import Badge from './common/badge/Badge.svelte';
|
|
5
4
|
export let extraPerms = {};
|
|
6
5
|
export let canWrite;
|
|
7
6
|
let kind = undefined;
|
|
@@ -47,15 +46,8 @@ $: {
|
|
|
47
46
|
}
|
|
48
47
|
</script>
|
|
49
48
|
|
|
50
|
-
{#if kind
|
|
51
|
-
<
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
<Icon data={faPeopleGroup} scale={0.7} />
|
|
55
|
-
read</Badge
|
|
56
|
-
>
|
|
57
|
-
{:else if kind == 'write'}
|
|
58
|
-
<Badge tooltip={reason}><Icon data={faPeopleGroup} scale={0.7} /></Badge>
|
|
59
|
-
{/if}
|
|
60
|
-
</span>
|
|
49
|
+
{#if kind === 'read' || kind === 'write'}
|
|
50
|
+
<Badge icon={{ data: faPeopleGroup }} capitalize color="blue">
|
|
51
|
+
{kind}
|
|
52
|
+
</Badge>
|
|
61
53
|
{/if}
|
|
@@ -15,6 +15,7 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
|
15
15
|
<script>import { browser, dev } from '$app/env';
|
|
16
16
|
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
17
17
|
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
18
|
+
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
18
19
|
import { buildWorkerDefinition } from 'monaco-editor-workers';
|
|
19
20
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
20
21
|
import { createHash, editorConfig, langToExt, updateOptions } from '../editorUtils';
|
|
@@ -42,6 +43,9 @@ if (browser) {
|
|
|
42
43
|
if (label === 'json') {
|
|
43
44
|
return new jsonWorker();
|
|
44
45
|
}
|
|
46
|
+
else if (label === 'typescript' || label === 'javascript') {
|
|
47
|
+
return new tsWorker();
|
|
48
|
+
}
|
|
45
49
|
else {
|
|
46
50
|
return new editorWorker();
|
|
47
51
|
}
|
|
@@ -69,6 +73,7 @@ function format() {
|
|
|
69
73
|
editor.getAction('editor.action.formatDocument').run();
|
|
70
74
|
if (formatAction) {
|
|
71
75
|
formatAction();
|
|
76
|
+
code = getCode();
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
}
|
|
@@ -76,16 +81,6 @@ async function loadMonaco() {
|
|
|
76
81
|
const model = monaco.editor.createModel(code, lang, monaco.Uri.parse(uri));
|
|
77
82
|
model.updateOptions(updateOptions);
|
|
78
83
|
editor = monaco.editor.create(divEl, editorConfig(model, code, lang, automaticLayout));
|
|
79
|
-
if (shouldBindKey) {
|
|
80
|
-
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, function () {
|
|
81
|
-
format();
|
|
82
|
-
});
|
|
83
|
-
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, function () {
|
|
84
|
-
if (cmdEnterAction) {
|
|
85
|
-
cmdEnterAction();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
84
|
let timeoutModel = undefined;
|
|
90
85
|
editor.onDidChangeModelContent((event) => {
|
|
91
86
|
timeoutModel && clearTimeout(timeoutModel);
|
|
@@ -95,9 +90,18 @@ async function loadMonaco() {
|
|
|
95
90
|
dispatch('change');
|
|
96
91
|
});
|
|
97
92
|
editor.onDidFocusEditorText(() => {
|
|
93
|
+
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, function () {
|
|
94
|
+
code = getCode();
|
|
95
|
+
shouldBindKey && format && format();
|
|
96
|
+
});
|
|
97
|
+
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, function () {
|
|
98
|
+
code = getCode();
|
|
99
|
+
shouldBindKey && cmdEnterAction && cmdEnterAction();
|
|
100
|
+
});
|
|
98
101
|
dispatch('focus');
|
|
99
102
|
});
|
|
100
103
|
editor.onDidBlurEditorText(() => {
|
|
104
|
+
code = getCode();
|
|
101
105
|
dispatch('blur');
|
|
102
106
|
});
|
|
103
107
|
if (lang == 'javascript' && extraLib != '' && extraLibPath != '') {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import RadioButton from './RadioButton.svelte';
|
|
2
2
|
import ResourceTypePicker from './ResourceTypePicker.svelte';
|
|
3
|
+
import { Button } from './common';
|
|
3
4
|
export let pattern;
|
|
4
5
|
export let enum_;
|
|
5
6
|
export let format;
|
|
@@ -23,6 +24,15 @@ $: format =
|
|
|
23
24
|
kind == 'resource' ? (resource != undefined ? `resource-${resource}` : 'resource') : undefined;
|
|
24
25
|
$: pattern = patternStr == '' ? undefined : patternStr;
|
|
25
26
|
$: contentEncoding = kind == 'base64' ? 'base64' : undefined;
|
|
27
|
+
function add() {
|
|
28
|
+
enum_ = enum_ ? enum_.concat('') : [''];
|
|
29
|
+
}
|
|
30
|
+
function remove(item) {
|
|
31
|
+
enum_ = (enum_ || []).filter((el) => el !== item);
|
|
32
|
+
if (enum_.length == 0) {
|
|
33
|
+
enum_ = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
26
36
|
</script>
|
|
27
37
|
|
|
28
38
|
<RadioButton
|
|
@@ -49,47 +59,31 @@ $: contentEncoding = kind == 'base64' ? 'base64' : undefined;
|
|
|
49
59
|
placeholder="^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$"
|
|
50
60
|
bind:value={patternStr}
|
|
51
61
|
/>
|
|
52
|
-
<
|
|
53
|
-
|
|
62
|
+
<Button
|
|
63
|
+
variant="border"
|
|
64
|
+
color="blue"
|
|
65
|
+
size="sm"
|
|
66
|
+
btnClasses="mx-2 mb-1"
|
|
54
67
|
on:click={() => {
|
|
55
68
|
patternStr = ''
|
|
56
|
-
}}>clear</
|
|
69
|
+
}}>clear</Button
|
|
57
70
|
>
|
|
58
71
|
</div>
|
|
59
72
|
</label>
|
|
60
73
|
{:else if kind == 'enum'}
|
|
61
|
-
<label for="input" class="mb-2 text-gray-700 text-xs"
|
|
62
|
-
|
|
63
|
-
{#each enum_
|
|
74
|
+
<label for="input" class="mb-2 text-gray-700 text-xs">
|
|
75
|
+
Enums
|
|
76
|
+
{#each enum_ || [] as e}
|
|
64
77
|
<div class="flex flex-row max-w-md">
|
|
65
78
|
<input id="input" type="text" bind:value={e} />
|
|
66
|
-
<
|
|
67
|
-
class="default-button mx-6"
|
|
68
|
-
on:click={() => {
|
|
69
|
-
enum_ = (enum_ ?? []).filter((el) => el != e)
|
|
70
|
-
if (enum_.length == 0) {
|
|
71
|
-
enum_ = undefined
|
|
72
|
-
}
|
|
73
|
-
}}>-</button
|
|
74
|
-
>
|
|
79
|
+
<Button size="sm" btnClasses="ml-6" on:click={() => remove(e)}>-</Button>
|
|
75
80
|
</div>
|
|
76
81
|
{/each}
|
|
77
82
|
<div class="flex flex-row my-1">
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
enum_ = []
|
|
83
|
-
}
|
|
84
|
-
enum_ = enum_.concat('')
|
|
85
|
-
}}>+</button
|
|
86
|
-
>
|
|
87
|
-
<button
|
|
88
|
-
class="default-button-secondary ml-2"
|
|
89
|
-
on:click={() => {
|
|
90
|
-
enum_ = undefined
|
|
91
|
-
}}>clear</button
|
|
92
|
-
>
|
|
83
|
+
<Button size="sm" on:click={add}>+</Button>
|
|
84
|
+
<Button variant="border" size="sm" btnClasses="ml-2" on:click={() => (enum_ = undefined)}>
|
|
85
|
+
Clear
|
|
86
|
+
</Button>
|
|
93
87
|
</div>
|
|
94
88
|
</label>
|
|
95
89
|
{:else if kind == 'resource'}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script>import { Job, JobService } from '../gen';
|
|
2
|
+
import { workspaceStore } from '../stores';
|
|
3
|
+
import { onDestroy } from 'svelte';
|
|
4
|
+
import { createEventDispatcher } from 'svelte';
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
export let isLoading = false;
|
|
7
|
+
export let job = undefined;
|
|
8
|
+
let intervalId;
|
|
9
|
+
let syncIteration = 0;
|
|
10
|
+
let ITERATIONS_BEFORE_SLOW_REFRESH = 100;
|
|
11
|
+
export async function runPreview(path, code, lang, args) {
|
|
12
|
+
try {
|
|
13
|
+
if (intervalId) {
|
|
14
|
+
clearInterval(intervalId);
|
|
15
|
+
}
|
|
16
|
+
if (isLoading && job) {
|
|
17
|
+
JobService.cancelQueuedJob({
|
|
18
|
+
workspace: $workspaceStore,
|
|
19
|
+
id: job.id,
|
|
20
|
+
requestBody: {}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
isLoading = true;
|
|
24
|
+
const testId = await JobService.runScriptPreview({
|
|
25
|
+
workspace: $workspaceStore,
|
|
26
|
+
requestBody: {
|
|
27
|
+
path,
|
|
28
|
+
content: code,
|
|
29
|
+
args,
|
|
30
|
+
language: lang
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
await watchJob(testId);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
isLoading = false;
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function cancelJob() {
|
|
41
|
+
await JobService.cancelQueuedJob({
|
|
42
|
+
workspace: $workspaceStore ?? '',
|
|
43
|
+
id: job?.id ?? '',
|
|
44
|
+
requestBody: {}
|
|
45
|
+
});
|
|
46
|
+
console.log('cancelled');
|
|
47
|
+
}
|
|
48
|
+
export async function watchJob(testId) {
|
|
49
|
+
console.log('watch jobs');
|
|
50
|
+
job = undefined;
|
|
51
|
+
syncIteration = 0;
|
|
52
|
+
const isCompleted = await loadTestJob(testId);
|
|
53
|
+
if (!isCompleted) {
|
|
54
|
+
isLoading = true;
|
|
55
|
+
intervalId = setInterval(() => {
|
|
56
|
+
syncer(testId);
|
|
57
|
+
}, 500);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function loadTestJob(id) {
|
|
61
|
+
let isCompleted = false;
|
|
62
|
+
try {
|
|
63
|
+
if (job && `running` in job) {
|
|
64
|
+
let previewJobUpdates = await JobService.getJobUpdates({
|
|
65
|
+
workspace: $workspaceStore,
|
|
66
|
+
id,
|
|
67
|
+
running: job.running,
|
|
68
|
+
logOffset: job.logs?.length ?? 0
|
|
69
|
+
});
|
|
70
|
+
if (previewJobUpdates.new_logs) {
|
|
71
|
+
job.logs = (job.logs ?? '').concat(previewJobUpdates.new_logs);
|
|
72
|
+
}
|
|
73
|
+
if ((previewJobUpdates.running ?? false) || (previewJobUpdates.completed ?? false)) {
|
|
74
|
+
job = await JobService.getJob({ workspace: $workspaceStore, id });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
job = await JobService.getJob({ workspace: $workspaceStore, id });
|
|
79
|
+
}
|
|
80
|
+
if (job?.type === 'CompletedJob') {
|
|
81
|
+
//only CompletedJob has success property
|
|
82
|
+
isCompleted = true;
|
|
83
|
+
clearInterval(intervalId);
|
|
84
|
+
if (isLoading) {
|
|
85
|
+
dispatch('done', job);
|
|
86
|
+
isLoading = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.error(err);
|
|
92
|
+
}
|
|
93
|
+
return isCompleted;
|
|
94
|
+
}
|
|
95
|
+
function syncer(id) {
|
|
96
|
+
if (syncIteration == ITERATIONS_BEFORE_SLOW_REFRESH) {
|
|
97
|
+
intervalId && clearInterval(intervalId);
|
|
98
|
+
intervalId = setInterval(() => syncer(id), 2000);
|
|
99
|
+
}
|
|
100
|
+
syncIteration++;
|
|
101
|
+
loadTestJob(id);
|
|
102
|
+
}
|
|
103
|
+
onDestroy(() => {
|
|
104
|
+
intervalId && clearInterval(intervalId);
|
|
105
|
+
});
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { Job } from '../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
isLoading?: boolean | undefined;
|
|
6
|
+
job?: Job | undefined;
|
|
7
|
+
runPreview?: ((path: string | undefined, code: string, lang: 'deno' | 'go' | 'python3', args: Record<string, any>) => Promise<void>) | undefined;
|
|
8
|
+
cancelJob?: (() => Promise<void>) | undefined;
|
|
9
|
+
watchJob?: ((testId: string) => Promise<void>) | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
done: CustomEvent<any>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export declare type TestJobLoaderProps = typeof __propDef.props;
|
|
19
|
+
export declare type TestJobLoaderEvents = typeof __propDef.events;
|
|
20
|
+
export declare type TestJobLoaderSlots = typeof __propDef.slots;
|
|
21
|
+
export default class TestJobLoader extends SvelteComponentTyped<TestJobLoaderProps, TestJobLoaderEvents, TestJobLoaderSlots> {
|
|
22
|
+
get runPreview(): (path: string | undefined, code: string, lang: "python3" | "deno" | "go", args: Record<string, any>) => Promise<void>;
|
|
23
|
+
get cancelJob(): () => Promise<void>;
|
|
24
|
+
get watchJob(): (testId: string) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -49,7 +49,6 @@ function close() {
|
|
|
49
49
|
class="w-96 text-left"
|
|
50
50
|
>
|
|
51
51
|
<slot />
|
|
52
|
-
<div id="arrow" data-popper-arrow />
|
|
53
52
|
</div>
|
|
54
53
|
{/if}
|
|
55
54
|
|
|
@@ -59,8 +58,10 @@ function close() {
|
|
|
59
58
|
white-space: normal;
|
|
60
59
|
border-radius: 0.75rem;
|
|
61
60
|
--tw-bg-opacity: 1;
|
|
62
|
-
background-color: rgb(
|
|
61
|
+
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
|
63
62
|
padding: 1rem;
|
|
63
|
+
font-size: 1rem;
|
|
64
|
+
line-height: 1.5rem;
|
|
64
65
|
font-weight: 400;
|
|
65
66
|
--tw-text-opacity: 1;
|
|
66
67
|
color: rgb(209 213 219 / var(--tw-text-opacity))
|
|
@@ -8,6 +8,7 @@ import { createEventDispatcher } from 'svelte';
|
|
|
8
8
|
import { workspaceStore } from '../stores';
|
|
9
9
|
import Required from './Required.svelte';
|
|
10
10
|
import Tooltip from './Tooltip.svelte';
|
|
11
|
+
import { Button } from './common';
|
|
11
12
|
const dispatch = createEventDispatcher();
|
|
12
13
|
let path = '';
|
|
13
14
|
let variable = {
|
|
@@ -47,7 +48,7 @@ export async function editVariable(path) {
|
|
|
47
48
|
modal.openModal();
|
|
48
49
|
}
|
|
49
50
|
const MAX_VARIABLE_LENGTH = 3000;
|
|
50
|
-
$: valid = variable.value.length
|
|
51
|
+
$: valid = variable.value.length <= MAX_VARIABLE_LENGTH;
|
|
51
52
|
async function createVariable() {
|
|
52
53
|
await VariableService.createVariable({
|
|
53
54
|
workspace: $workspaceStore,
|
|
@@ -101,7 +102,8 @@ async function updateVariable() {
|
|
|
101
102
|
<div slot="content">
|
|
102
103
|
<div class="text-gray-700 text-2xs mb-6">
|
|
103
104
|
Variables have a globally unique name represented by their path. When passed to scripts, <pre
|
|
104
|
-
class="inline text-red-700 bg-gray-50 rounded round-sm">/</pre
|
|
105
|
+
class="inline text-red-700 bg-gray-50 rounded round-sm">/</pre
|
|
106
|
+
>
|
|
105
107
|
are converted to
|
|
106
108
|
<pre class="inline text-red-700 bg-gray-50 rounded round-sm">_</pre>
|
|
107
109
|
</div>
|
|
@@ -139,12 +141,12 @@ async function updateVariable() {
|
|
|
139
141
|
<Password
|
|
140
142
|
bind:password={variable.value}
|
|
141
143
|
placeholder={'******** (only fill to update value)'}
|
|
142
|
-
label={
|
|
144
|
+
label={`Secret value (${variable.value.length}/3000 characters)`}
|
|
143
145
|
/>
|
|
144
146
|
</div>
|
|
145
147
|
{:else}
|
|
146
148
|
<div>
|
|
147
|
-
<span>Variable (
|
|
149
|
+
<span>Variable value ({variable.value.length}/3000 characters)</span>
|
|
148
150
|
<AutosizedTextarea bind:value={variable.value} minRows={5} />
|
|
149
151
|
</div>
|
|
150
152
|
{/if}
|
|
@@ -155,24 +157,13 @@ async function updateVariable() {
|
|
|
155
157
|
</div>
|
|
156
158
|
</div>
|
|
157
159
|
</div>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
createVariable()
|
|
168
|
-
}
|
|
169
|
-
}}
|
|
170
|
-
disabled={!valid || pathError != ''}
|
|
171
|
-
>
|
|
172
|
-
{#if edit}
|
|
173
|
-
Save
|
|
174
|
-
{:else}
|
|
175
|
-
Add a variable
|
|
176
|
-
{/if}
|
|
177
|
-
</button>
|
|
160
|
+
<div slot="submission">
|
|
161
|
+
<Button
|
|
162
|
+
size="sm"
|
|
163
|
+
on:click={() => (edit ? updateVariable() : createVariable())}
|
|
164
|
+
disabled={!valid || pathError != ''}
|
|
165
|
+
>
|
|
166
|
+
{edit ? 'Save' : 'Add a variable'}
|
|
167
|
+
</Button>
|
|
168
|
+
</div>
|
|
178
169
|
</Modal>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>export let applyPageWidth = false;
|
|
2
|
+
export let stickToTop = false;
|
|
3
|
+
$: wide = applyPageWidth ? 'max-w-6xl mx-auto px-4 sm:px-6 md:px-8 ' : '';
|
|
4
|
+
let scrollY;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svelte:window bind:scrollY />
|
|
8
|
+
|
|
9
|
+
<div
|
|
10
|
+
class={'bg-white py-3 ' +
|
|
11
|
+
(stickToTop ? 'sticky top-0 ' + (scrollY >= 30 ? 'border-b ' : '') : '') +
|
|
12
|
+
$$props.class}
|
|
13
|
+
>
|
|
14
|
+
<div class={'w-full flex flex-wrap justify-between items-center gap-4 ' + wide}>
|
|
15
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
16
|
+
{#if $$slots.left}
|
|
17
|
+
<slot name="left" />
|
|
18
|
+
{/if}
|
|
19
|
+
</div>
|
|
20
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
21
|
+
{#if $$slots.middle}
|
|
22
|
+
<slot name="middle" />
|
|
23
|
+
{/if}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
26
|
+
{#if $$slots.right}
|
|
27
|
+
<slot name="right" />
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
applyPageWidth?: boolean | undefined;
|
|
6
|
+
stickToTop?: boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
left: {};
|
|
13
|
+
middle: {};
|
|
14
|
+
right: {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare type ActionRowProps = typeof __propDef.props;
|
|
18
|
+
export declare type ActionRowEvents = typeof __propDef.events;
|
|
19
|
+
export declare type ActionRowSlots = typeof __propDef.slots;
|
|
20
|
+
export default class ActionRow extends SvelteComponentTyped<ActionRowProps, ActionRowEvents, ActionRowSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|