windmill-components 1.36.2 → 1.37.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/DisplayResult.svelte +2 -2
- package/components/Editor.svelte +12 -3
- package/components/Editor.svelte.d.ts +1 -0
- package/components/EditorBar.svelte +5 -8
- package/components/EditorBar.svelte.d.ts +1 -0
- package/components/FlowModulesViewer.svelte +0 -2
- package/components/FlowPreviewContent.svelte +10 -11
- package/components/FlowStatusViewer.svelte +21 -6
- package/components/InputTransformForm.svelte +14 -15
- package/components/InputTransformForm.svelte.d.ts +3 -3
- package/components/ModulePreview.svelte +2 -2
- package/components/PageHeader.svelte +8 -8
- package/components/Path.svelte.d.ts +1 -1
- package/components/RunForm.svelte +0 -1
- package/components/SchemaForm.svelte +2 -2
- package/components/ScriptEditor.svelte +2 -17
- package/components/ScriptPicker.svelte.d.ts +1 -1
- package/components/SharedBadge.svelte +4 -0
- package/components/TestJobLoader.svelte +2 -3
- package/components/TestJobLoader.svelte.d.ts +1 -1
- package/components/common/badge/Badge.svelte +2 -7
- package/components/common/button/Button.svelte +5 -2
- package/components/common/button/ButtonPopup.svelte +1 -0
- package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +2 -1
- package/components/common/index.d.ts +4 -0
- package/components/common/index.js +4 -0
- package/components/common/skeleton/Skeleton.svelte +38 -0
- package/components/common/skeleton/Skeleton.svelte.d.ts +21 -0
- package/components/common/skeleton/SkeletonElement.svelte +8 -0
- package/components/common/skeleton/SkeletonElement.svelte.d.ts +17 -0
- package/components/common/skeleton/model.d.ts +21 -0
- package/components/common/skeleton/model.js +1 -0
- package/components/flows/content/FlowInput.svelte +0 -1
- package/components/flows/content/FlowLoop.svelte +1 -1
- package/components/flows/content/FlowModule.svelte +8 -2
- package/components/flows/content/FlowModuleSuspend.svelte +66 -4
- package/components/flows/content/RemoveStepConfirmationModal.svelte +0 -1
- package/components/flows/flowStateUtils.js +2 -2
- package/components/flows/header/FlowImportExportMenu.svelte +1 -1
- package/components/flows/header/FlowPreviewButtons.svelte +2 -1
- package/components/flows/map/FlowModuleSchemaMap.svelte +2 -2
- package/components/flows/propPicker/PropPickerWrapper.svelte +2 -0
- package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +1 -0
- package/components/flows/utils.d.ts +2 -0
- package/components/flows/utils.js +10 -0
- package/components/propertyPicker/PropPicker.svelte +55 -52
- package/components/propertyPicker/PropPicker.svelte.d.ts +1 -0
- package/components/script_editor/LogPanel.svelte +3 -3
- package/editorUtils.js +2 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +1 -1
- package/gen/models/Branches.d.ts +12 -0
- package/gen/models/{PathFlow.js → Branches.js} +0 -0
- package/gen/models/FlowModule.d.ts +5 -1
- package/gen/models/FlowModuleValue.d.ts +2 -2
- package/gen/models/FlowStatus.d.ts +1 -0
- package/gen/models/FlowStatusModule.d.ts +4 -0
- package/gen/services/JobService.d.ts +14 -10
- package/gen/services/JobService.js +14 -10
- package/package.json +14 -12
- package/script_helpers.d.ts +2 -2
- package/script_helpers.js +6 -2
- package/components/Tabs.svelte +0 -21
- package/components/Tabs.svelte.d.ts +0 -20
- package/gen/models/PathFlow.d.ts +0 -4
|
@@ -52,7 +52,7 @@ function inferResultKind(result) {
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<div class="inline-highlight">
|
|
55
|
-
{#if result}
|
|
55
|
+
{#if result != undefined}
|
|
56
56
|
{#if resultKind && resultKind != 'json'}
|
|
57
57
|
<div class="mb-2 text-gray-500 text-sm bg-gray-50/20">
|
|
58
58
|
as JSON <input type="checkbox" bind:checked={forceJson} /></div
|
|
@@ -117,7 +117,7 @@ function inferResultKind(result) {
|
|
|
117
117
|
>
|
|
118
118
|
</div>
|
|
119
119
|
{:else if !forceJson && resultKind == 'error'}<div
|
|
120
|
-
><pre class="text-sm text-red-500">{result.error}</pre>
|
|
120
|
+
><pre class="text-sm text-red-500 whitespace-pre-wrap">{result.error}</pre>
|
|
121
121
|
</div>
|
|
122
122
|
{:else}<Highlight
|
|
123
123
|
language={json}
|
package/components/Editor.svelte
CHANGED
|
@@ -39,7 +39,7 @@ export let hash = randomHash();
|
|
|
39
39
|
export let cmdEnterAction = undefined;
|
|
40
40
|
export let formatAction = undefined;
|
|
41
41
|
export let automaticLayout = true;
|
|
42
|
-
export let websocketAlive = { pyright: false, black: false, deno: false };
|
|
42
|
+
export let websocketAlive = { pyright: false, black: false, deno: false, go: false };
|
|
43
43
|
export let shouldBindKey = true;
|
|
44
44
|
let websockets = [];
|
|
45
45
|
let websocketInterval;
|
|
@@ -47,7 +47,7 @@ let lastWsAttempt = new Date();
|
|
|
47
47
|
let nbWsAttempt = 0;
|
|
48
48
|
let disposeMethod;
|
|
49
49
|
const dispatch = createEventDispatcher();
|
|
50
|
-
const uri = `file
|
|
50
|
+
const uri = `file:///tmp/monaco/${hash}.${langToExt(lang)}`;
|
|
51
51
|
if (browser) {
|
|
52
52
|
if (dev) {
|
|
53
53
|
buildWorkerDefinition('../../../node_modules/monaco-editor-workers/dist/workers', import.meta.url, false);
|
|
@@ -267,12 +267,20 @@ export async function reloadWebsocket() {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
+
else if (lang === 'go') {
|
|
271
|
+
connectToLanguageServer(`wss://${$page.url.host}/ws/go`, 'go', {
|
|
272
|
+
'build.allowImplicitNetworkAccess': true
|
|
273
|
+
});
|
|
274
|
+
}
|
|
270
275
|
websocketInterval && clearInterval(websocketInterval);
|
|
271
276
|
websocketInterval = setInterval(() => {
|
|
272
277
|
if (document.visibilityState == 'visible') {
|
|
273
278
|
if (!lastWsAttempt ||
|
|
274
279
|
(new Date().getTime() - lastWsAttempt.getTime() > 60000 && nbWsAttempt < 2)) {
|
|
275
|
-
if (!websocketAlive.black &&
|
|
280
|
+
if (!websocketAlive.black &&
|
|
281
|
+
!websocketAlive.deno &&
|
|
282
|
+
!websocketAlive.pyright &&
|
|
283
|
+
!websocketAlive.go) {
|
|
276
284
|
console.log('reconnecting to language servers');
|
|
277
285
|
lastWsAttempt = new Date();
|
|
278
286
|
nbWsAttempt++;
|
|
@@ -335,6 +343,7 @@ async function loadMonaco() {
|
|
|
335
343
|
if (!websocketAlive.black &&
|
|
336
344
|
!websocketAlive.deno &&
|
|
337
345
|
!websocketAlive.pyright &&
|
|
346
|
+
!websocketAlive.go &&
|
|
338
347
|
!websocketInterval) {
|
|
339
348
|
reloadWebsocket();
|
|
340
349
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<script>import { ResourceService, ScriptService, VariableService } from '../gen';
|
|
2
2
|
import { getScriptByPath, loadHubScripts, sendUserToast } from '../utils';
|
|
3
|
-
import { faCode, faCube, faDollarSign,
|
|
3
|
+
import { faCode, faCube, faDollarSign, faRotate, faRotateLeft, faWallet } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { hubScripts, workspaceStore } from '../stores';
|
|
5
|
-
import { Highlight } from 'svelte-highlight';
|
|
6
|
-
import { python, typescript } from 'svelte-highlight/languages';
|
|
7
5
|
import ItemPicker from './ItemPicker.svelte';
|
|
8
6
|
import Modal from './Modal.svelte';
|
|
9
7
|
import ResourceEditor from './ResourceEditor.svelte';
|
|
10
8
|
import VariableEditor from './VariableEditor.svelte';
|
|
11
9
|
import Button from './common/button/Button.svelte';
|
|
10
|
+
import HighlightCode from './HighlightCode.svelte';
|
|
12
11
|
export let lang;
|
|
13
12
|
export let editor;
|
|
14
13
|
export let websocketAlive;
|
|
@@ -68,11 +67,7 @@ async function loadScripts() {
|
|
|
68
67
|
<Modal bind:this={codeViewer}>
|
|
69
68
|
<div slot="title">Code</div>
|
|
70
69
|
<div slot="content">
|
|
71
|
-
{
|
|
72
|
-
<Highlight language={python} code={codeContent} />
|
|
73
|
-
{:else if codeLang == 'deno'}
|
|
74
|
-
<Highlight language={typescript} code={codeContent} />
|
|
75
|
-
{/if}
|
|
70
|
+
<HighlightCode language={codeLang} code={codeContent} />
|
|
76
71
|
</div></Modal
|
|
77
72
|
>
|
|
78
73
|
|
|
@@ -261,6 +256,8 @@ async function loadScripts() {
|
|
|
261
256
|
<span class="ml-1">
|
|
262
257
|
{#if lang == 'deno'}
|
|
263
258
|
(<span class={websocketAlive.deno ? 'text-green-600' : 'text-red-700'}>Deno</span>)
|
|
259
|
+
{:else if lang == 'go'}
|
|
260
|
+
(<span class={websocketAlive.go ? 'text-green-600' : 'text-red-700'}>Go</span>)
|
|
264
261
|
{:else if lang == 'python3'}
|
|
265
262
|
(<span class={websocketAlive.pyright ? 'text-green-600' : 'text-red-700'}>Pyright</span>
|
|
266
263
|
<span class={websocketAlive.black ? 'text-green-600' : 'text-red-700'}>Black</span>)
|
|
@@ -83,8 +83,6 @@ let open = {};
|
|
|
83
83
|
/>
|
|
84
84
|
</div>
|
|
85
85
|
{/if}
|
|
86
|
-
{:else if mod?.value?.type == 'flow'}
|
|
87
|
-
Flow at path {mod?.value?.path}
|
|
88
86
|
{:else if mod?.value?.type == 'forloopflow'}
|
|
89
87
|
For loop over all the elements of the list returned as a result of step {i}:
|
|
90
88
|
<svelte:self modules={mod.value.modules} />
|
|
@@ -25,7 +25,6 @@ function extractFlow(previewMode) {
|
|
|
25
25
|
const modules = flow.value.modules.slice(0, Number(parentIndex) + 1);
|
|
26
26
|
flow.value.modules = modules;
|
|
27
27
|
if (childIndex != undefined) {
|
|
28
|
-
console.log(modules);
|
|
29
28
|
const lastModule = modules[modules.length - 1].value;
|
|
30
29
|
if (lastModule.type === 'forloopflow') {
|
|
31
30
|
lastModule.modules = lastModule.modules.slice(0, Number(childIndex) + 1);
|
|
@@ -56,6 +55,15 @@ function onKeyDown(event) {
|
|
|
56
55
|
break;
|
|
57
56
|
}
|
|
58
57
|
}
|
|
58
|
+
function onJobsLoaded(jobResult) {
|
|
59
|
+
if (jobResult.job?.type === 'CompletedJob') {
|
|
60
|
+
isRunning = false;
|
|
61
|
+
}
|
|
62
|
+
const upToIndex = previewMode === 'upTo'
|
|
63
|
+
? selectedIdToIndexes($selectedId)[0] + 1
|
|
64
|
+
: $flowStateStore.modules.length;
|
|
65
|
+
mapJobResultsToFlowState(jobResult, upToIndex);
|
|
66
|
+
}
|
|
59
67
|
</script>
|
|
60
68
|
|
|
61
69
|
<svelte:window on:keydown={onKeyDown} />
|
|
@@ -129,16 +137,7 @@ function onKeyDown(event) {
|
|
|
129
137
|
|
|
130
138
|
<div class="h-full overflow-y-auto mb-16 grow">
|
|
131
139
|
{#if jobId}
|
|
132
|
-
<FlowStatusViewer
|
|
133
|
-
{jobId}
|
|
134
|
-
on:jobsLoaded={(e) => {
|
|
135
|
-
isRunning = false
|
|
136
|
-
const parentIndex = selectedIdToIndexes($selectedId)[0]
|
|
137
|
-
const upToIndex =
|
|
138
|
-
previewMode === 'upTo' ? Number(parentIndex) + 1 : $flowStateStore.modules.length
|
|
139
|
-
mapJobResultsToFlowState(e.detail, upToIndex)
|
|
140
|
-
}}
|
|
141
|
-
/>
|
|
140
|
+
<FlowStatusViewer {jobId} on:jobsLoaded={(e) => onJobsLoaded(e.detail)} />
|
|
142
141
|
{/if}
|
|
143
142
|
</div>
|
|
144
143
|
</div>
|
|
@@ -23,15 +23,24 @@ async function loadJobInProgress() {
|
|
|
23
23
|
workspace: $workspaceStore ?? '',
|
|
24
24
|
id: jobId ?? ''
|
|
25
25
|
});
|
|
26
|
-
jobResult
|
|
27
|
-
|
|
26
|
+
if (jobResult) {
|
|
27
|
+
jobResult.job = job;
|
|
28
|
+
jobResult = jobResult;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
jobResult = {
|
|
32
|
+
job: job,
|
|
33
|
+
innerJobs: [],
|
|
34
|
+
loopJobs: []
|
|
35
|
+
};
|
|
36
|
+
}
|
|
28
37
|
if (job?.type !== 'CompletedJob') {
|
|
29
38
|
timeout = setTimeout(() => loadJobInProgress(), 500);
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
|
-
$: jobResult &&
|
|
41
|
+
$: jobResult && dispatch('jobsLoaded', jobResult);
|
|
33
42
|
function updateJobId() {
|
|
34
|
-
if (jobId !== jobResult
|
|
43
|
+
if (jobId !== jobResult?.job?.id) {
|
|
35
44
|
loadJobInProgress();
|
|
36
45
|
}
|
|
37
46
|
}
|
|
@@ -41,7 +50,7 @@ onDestroy(() => {
|
|
|
41
50
|
});
|
|
42
51
|
</script>
|
|
43
52
|
|
|
44
|
-
{#if jobResult
|
|
53
|
+
{#if jobResult?.job}
|
|
45
54
|
<div class="flow-root w-full space-y-4">
|
|
46
55
|
{#if innerModules.length > 0}
|
|
47
56
|
<h3 class="text-md leading-6 font-bold text-gray-900 border-b pb-2">Flow result</h3>
|
|
@@ -80,7 +89,13 @@ onDestroy(() => {
|
|
|
80
89
|
/>
|
|
81
90
|
</Button>
|
|
82
91
|
<div class="border p-6" class:hidden={forloop_selected != loopJobId}>
|
|
83
|
-
<svelte:self
|
|
92
|
+
<svelte:self
|
|
93
|
+
jobId={loopJobId}
|
|
94
|
+
bind:jobResult={jobResult.loopJobs[j]}
|
|
95
|
+
on:jobsLoaded={(e) => {
|
|
96
|
+
jobResult = jobResult
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
84
99
|
</div>
|
|
85
100
|
{/each}
|
|
86
101
|
{:else if innerModules.length > 0}
|
|
@@ -12,10 +12,10 @@ export let schema;
|
|
|
12
12
|
export let arg;
|
|
13
13
|
export let argName;
|
|
14
14
|
export let extraLib = 'missing extraLib';
|
|
15
|
-
export let inputCheck;
|
|
15
|
+
export let inputCheck = true;
|
|
16
16
|
export let importPath = undefined;
|
|
17
|
-
let
|
|
18
|
-
let
|
|
17
|
+
export let monaco = undefined;
|
|
18
|
+
let inputCat = 'object';
|
|
19
19
|
let propertyType = getPropertyType(arg);
|
|
20
20
|
function getPropertyType(arg) {
|
|
21
21
|
let type = arg?.type ?? 'static';
|
|
@@ -47,8 +47,8 @@ function setPropertyType(rawValue) {
|
|
|
47
47
|
function isStaticTemplate(inputCat) {
|
|
48
48
|
return inputCat === 'string' || inputCat === 'sql';
|
|
49
49
|
}
|
|
50
|
-
function connectProperty(
|
|
51
|
-
if (isStaticTemplate(
|
|
50
|
+
function connectProperty(rawValue) {
|
|
51
|
+
if (isStaticTemplate(inputCat)) {
|
|
52
52
|
arg.value = `\$\{${rawValue}}`;
|
|
53
53
|
setPropertyType(arg.value);
|
|
54
54
|
}
|
|
@@ -88,7 +88,7 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
88
88
|
}}
|
|
89
89
|
on:change={(e) => {
|
|
90
90
|
const type = e.detail ? 'javascript' : 'static'
|
|
91
|
-
const staticTemplate = isStaticTemplate(
|
|
91
|
+
const staticTemplate = isStaticTemplate(inputCat)
|
|
92
92
|
if (type === 'javascript') {
|
|
93
93
|
arg.expr = getDefaultExpr(
|
|
94
94
|
importPath,
|
|
@@ -111,7 +111,7 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
111
111
|
<div
|
|
112
112
|
on:click={() => {
|
|
113
113
|
focusProp(argName, 'connect', (path) => {
|
|
114
|
-
connectProperty(
|
|
114
|
+
connectProperty(path)
|
|
115
115
|
})
|
|
116
116
|
}}
|
|
117
117
|
>
|
|
@@ -126,7 +126,7 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
126
126
|
{#if propertyType === undefined || !checked}
|
|
127
127
|
<ArgInput
|
|
128
128
|
on:focus={() => {
|
|
129
|
-
if (isStaticTemplate(
|
|
129
|
+
if (isStaticTemplate(inputCat)) {
|
|
130
130
|
focusProp(argName, 'append', (path) => {
|
|
131
131
|
const toAppend = `\$\{${path}}`
|
|
132
132
|
arg.value = `${arg.value ?? ''}${toAppend}`
|
|
@@ -134,7 +134,6 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
134
134
|
})
|
|
135
135
|
} else {
|
|
136
136
|
focusProp(argName, 'insert', (path) => {
|
|
137
|
-
console.log('path', path)
|
|
138
137
|
arg.expr = path
|
|
139
138
|
arg.type = 'javascript'
|
|
140
139
|
propertyType = 'javascript'
|
|
@@ -142,13 +141,13 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
142
141
|
}
|
|
143
142
|
}}
|
|
144
143
|
label={argName}
|
|
145
|
-
bind:editor={
|
|
144
|
+
bind:editor={monaco}
|
|
146
145
|
bind:description={schema.properties[argName].description}
|
|
147
146
|
bind:value={arg.value}
|
|
148
147
|
type={schema.properties[argName].type}
|
|
149
148
|
required={schema.required.includes(argName)}
|
|
150
149
|
bind:pattern={schema.properties[argName].pattern}
|
|
151
|
-
bind:valid={inputCheck
|
|
150
|
+
bind:valid={inputCheck}
|
|
152
151
|
defaultValue={schema.properties[argName].default}
|
|
153
152
|
bind:enum_={schema.properties[argName].enum}
|
|
154
153
|
bind:format={schema.properties[argName].format}
|
|
@@ -156,9 +155,9 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
156
155
|
bind:itemsType={schema.properties[argName].items}
|
|
157
156
|
properties={schema.properties[argName].properties}
|
|
158
157
|
displayHeader={false}
|
|
159
|
-
bind:inputCat
|
|
158
|
+
bind:inputCat
|
|
160
159
|
on:input={(e) => {
|
|
161
|
-
if (isStaticTemplate(
|
|
160
|
+
if (isStaticTemplate(inputCat)) {
|
|
162
161
|
setPropertyType(e.detail.rawValue)
|
|
163
162
|
}
|
|
164
163
|
}}
|
|
@@ -167,10 +166,10 @@ const { focusProp } = getContext('PropPickerWrapper');
|
|
|
167
166
|
{#if arg.expr != undefined}
|
|
168
167
|
<div class="border rounded p-2 mt-2 border-gray-300">
|
|
169
168
|
<SimpleEditor
|
|
170
|
-
bind:this={
|
|
169
|
+
bind:this={monaco}
|
|
171
170
|
on:focus={() => {
|
|
172
171
|
focusProp(argName, 'insert', (path) => {
|
|
173
|
-
|
|
172
|
+
monaco?.insertAtCursor(path)
|
|
174
173
|
})
|
|
175
174
|
}}
|
|
176
175
|
bind:code={arg.expr}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Schema } from '../common';
|
|
3
3
|
import type { InputTransform } from '../gen';
|
|
4
|
+
import SimpleEditor from './SimpleEditor.svelte';
|
|
4
5
|
declare const __propDef: {
|
|
5
6
|
props: {
|
|
6
7
|
schema: Schema;
|
|
7
8
|
arg: InputTransform | any;
|
|
8
9
|
argName: string;
|
|
9
10
|
extraLib?: string | undefined;
|
|
10
|
-
inputCheck
|
|
11
|
-
[id: string]: boolean;
|
|
12
|
-
};
|
|
11
|
+
inputCheck?: boolean | undefined;
|
|
13
12
|
importPath?: string | undefined;
|
|
13
|
+
monaco?: SimpleEditor | undefined;
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
16
16
|
[evt: string]: CustomEvent<any>;
|
|
@@ -93,10 +93,10 @@ function jobDone() {
|
|
|
93
93
|
</top>
|
|
94
94
|
<down slot="down">
|
|
95
95
|
<pre class="overflow-x-auto break-all relative h-full p-2 text-sm"
|
|
96
|
-
>{#if testJob && 'result' in testJob && testJob.result != undefined}<DisplayResult
|
|
96
|
+
>{#if testJob != undefined && 'result' in testJob && testJob.result != undefined}<DisplayResult
|
|
97
97
|
result={testJob.result}
|
|
98
98
|
/>
|
|
99
|
-
{:else if testIsLoading}Waiting for
|
|
99
|
+
{:else if testIsLoading}Waiting for result...
|
|
100
100
|
{:else}Test to see the result here
|
|
101
101
|
{/if}
|
|
102
102
|
</pre>
|
|
@@ -6,23 +6,23 @@ export let primary = true;
|
|
|
6
6
|
|
|
7
7
|
<div class="flex flex-col sm:flex-row justify-between mt-4 mb-2">
|
|
8
8
|
{#if primary}
|
|
9
|
-
<
|
|
10
|
-
{title}
|
|
9
|
+
<span class="text-xl font-bold flex items-center space-x-2">
|
|
10
|
+
<span class="mr-0.5">{title}</span>
|
|
11
11
|
{#if tooltip}
|
|
12
12
|
<Tooltip>{tooltip}</Tooltip>
|
|
13
13
|
{/if}
|
|
14
|
-
</
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
{title}
|
|
14
|
+
</span>
|
|
15
|
+
{:else}
|
|
16
|
+
<span class="text-lg font-semibold flex items-center space-x-2">
|
|
17
|
+
<span class="mr-0.5">{title}</span>
|
|
18
18
|
{#if tooltip}
|
|
19
19
|
<Tooltip>{tooltip}</Tooltip>
|
|
20
20
|
{/if}
|
|
21
|
-
</
|
|
21
|
+
</span>
|
|
22
22
|
{/if}
|
|
23
23
|
|
|
24
24
|
{#if $$slots.default}
|
|
25
|
-
<div class="my-2
|
|
25
|
+
<div class="my-2">
|
|
26
26
|
<slot />
|
|
27
27
|
</div>
|
|
28
28
|
{/if}
|
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
initialPath: string;
|
|
8
8
|
path?: string | undefined;
|
|
9
9
|
error?: string | undefined;
|
|
10
|
-
kind: "
|
|
10
|
+
kind: "script" | "resource" | "schedule" | "variable" | "flow";
|
|
11
11
|
getPath?: (() => string) | undefined;
|
|
12
12
|
reset?: (() => Promise<void>) | undefined;
|
|
13
13
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
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
|
-
import Icon from 'svelte-awesome';
|
|
6
5
|
import SvelteMarkdown from 'svelte-markdown';
|
|
7
6
|
import SchemaForm from './SchemaForm.svelte';
|
|
8
7
|
import Tooltip from './Tooltip.svelte';
|
|
@@ -34,7 +34,7 @@ $: schema?.properties && removeExtraKey();
|
|
|
34
34
|
bind:arg={args[argName]}
|
|
35
35
|
bind:schema
|
|
36
36
|
bind:argName
|
|
37
|
-
bind:inputCheck
|
|
37
|
+
bind:inputCheck={inputCheck[argName]}
|
|
38
38
|
bind:extraLib
|
|
39
39
|
bind:importPath
|
|
40
40
|
/>
|
|
@@ -58,6 +58,6 @@ $: schema?.properties && removeExtraKey();
|
|
|
58
58
|
{/if}
|
|
59
59
|
{/each}
|
|
60
60
|
{:else}
|
|
61
|
-
<p class="italic text-sm">No
|
|
61
|
+
<p class="italic text-sm">No inputs</p>
|
|
62
62
|
{/if}
|
|
63
63
|
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script>import { CompletedJob, Job, JobService } from '../gen';
|
|
2
2
|
import { userStore, workspaceStore } from '../stores';
|
|
3
3
|
import { emptySchema, scriptLangToEditorLang } from '../utils';
|
|
4
|
-
import {
|
|
5
|
-
import Icon from 'svelte-awesome';
|
|
4
|
+
import { faPlay, faRotateRight } from '@fortawesome/free-solid-svg-icons';
|
|
6
5
|
import Editor from './Editor.svelte';
|
|
7
6
|
import { inferArgs } from '../infer';
|
|
8
7
|
import SchemaForm from './SchemaForm.svelte';
|
|
@@ -13,13 +12,12 @@ import EditorBar from './EditorBar.svelte';
|
|
|
13
12
|
import Button from './common/button/Button.svelte';
|
|
14
13
|
import TestJobLoader from './TestJobLoader.svelte';
|
|
15
14
|
import { onMount } from 'svelte';
|
|
16
|
-
import UnsavedConfirmationModal from './common/confirmationModal/UnsavedConfirmationModal.svelte';
|
|
17
15
|
// Exported
|
|
18
16
|
export let schema = emptySchema();
|
|
19
17
|
export let code;
|
|
20
18
|
export let path;
|
|
21
19
|
export let lang;
|
|
22
|
-
let websocketAlive = { pyright: false, black: false, deno: false };
|
|
20
|
+
let websocketAlive = { pyright: false, black: false, deno: false, go: false };
|
|
23
21
|
// Internal state
|
|
24
22
|
let editor;
|
|
25
23
|
let testJobLoader;
|
|
@@ -144,19 +142,6 @@ onMount(() => {
|
|
|
144
142
|
Move the focus outside of the text editor to recompute the input schema from
|
|
145
143
|
main signature or press Ctrl/Cmd+S
|
|
146
144
|
</p>
|
|
147
|
-
<p class="mt-4">
|
|
148
|
-
{#if isValid}
|
|
149
|
-
<Icon data={faCheck} class="text-green-600 mr-1" scale={0.6} />
|
|
150
|
-
The current preview input matches requirements defined in arguments
|
|
151
|
-
{:else}
|
|
152
|
-
<Icon
|
|
153
|
-
data={faExclamationTriangle}
|
|
154
|
-
class="text-yellow-500 mr-1"
|
|
155
|
-
scale={0.6}
|
|
156
|
-
/>
|
|
157
|
-
The current preview input doesn't match requirements defined in arguments
|
|
158
|
-
{/if}
|
|
159
|
-
</p>
|
|
160
145
|
</div>
|
|
161
146
|
<SchemaForm {schema} bind:args bind:isValid />
|
|
162
147
|
</div>
|
|
@@ -5,7 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
scriptPath?: string | undefined;
|
|
6
6
|
allowFlow?: boolean | undefined;
|
|
7
7
|
allowHub?: boolean | undefined;
|
|
8
|
-
itemKind?: "
|
|
8
|
+
itemKind?: "script" | "flow" | "hub" | undefined;
|
|
9
9
|
kind?: Script.kind | undefined;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import { userStore } from '../stores';
|
|
2
2
|
import { faPeopleGroup } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import Badge from './common/badge/Badge.svelte';
|
|
4
|
+
import Tooltip from './Tooltip.svelte';
|
|
4
5
|
export let extraPerms = {};
|
|
5
6
|
export let canWrite;
|
|
6
7
|
let kind = undefined;
|
|
@@ -49,5 +50,8 @@ $: {
|
|
|
49
50
|
{#if kind === 'read' || kind === 'write'}
|
|
50
51
|
<Badge icon={{ data: faPeopleGroup }} capitalize color="blue">
|
|
51
52
|
{kind}
|
|
53
|
+
{#if reason}
|
|
54
|
+
<Tooltip>{reason}</Tooltip>
|
|
55
|
+
{/if}
|
|
52
56
|
</Badge>
|
|
53
57
|
{/if}
|
|
@@ -10,9 +10,7 @@ let syncIteration = 0;
|
|
|
10
10
|
let ITERATIONS_BEFORE_SLOW_REFRESH = 100;
|
|
11
11
|
export async function runPreview(path, code, lang, args) {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
clearInterval(intervalId);
|
|
15
|
-
}
|
|
13
|
+
intervalId && clearInterval(intervalId);
|
|
16
14
|
if (isLoading && job) {
|
|
17
15
|
JobService.cancelQueuedJob({
|
|
18
16
|
workspace: $workspaceStore,
|
|
@@ -47,6 +45,7 @@ export async function cancelJob() {
|
|
|
47
45
|
}
|
|
48
46
|
export async function watchJob(testId) {
|
|
49
47
|
console.log('watch jobs');
|
|
48
|
+
intervalId && clearInterval(intervalId);
|
|
50
49
|
job = undefined;
|
|
51
50
|
syncIteration = 0;
|
|
52
51
|
const isCompleted = await loadTestJob(testId);
|
|
@@ -19,7 +19,7 @@ export declare type TestJobLoaderProps = typeof __propDef.props;
|
|
|
19
19
|
export declare type TestJobLoaderEvents = typeof __propDef.events;
|
|
20
20
|
export declare type TestJobLoaderSlots = typeof __propDef.slots;
|
|
21
21
|
export default class TestJobLoader extends SvelteComponentTyped<TestJobLoaderProps, TestJobLoaderEvents, TestJobLoaderSlots> {
|
|
22
|
-
get runPreview(): (path: string | undefined, code: string, lang: "
|
|
22
|
+
get runPreview(): (path: string | undefined, code: string, lang: "go" | "python3" | "deno", args: Record<string, any>) => Promise<void>;
|
|
23
23
|
get cancelJob(): () => Promise<void>;
|
|
24
24
|
get watchJob(): (testId: string) => Promise<void>;
|
|
25
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { classNames } from '../../../utils';
|
|
2
|
-
import {
|
|
2
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import Icon from 'svelte-awesome';
|
|
4
4
|
import { ColorModifier } from './model';
|
|
5
5
|
export let color = 'gray';
|
|
@@ -65,12 +65,7 @@ const handleHide = () => (hidden = !hidden);
|
|
|
65
65
|
<Icon {...iconProps} />
|
|
66
66
|
{/if}
|
|
67
67
|
{#if dismissable}
|
|
68
|
-
<
|
|
69
|
-
{color}
|
|
70
|
-
on:click={handleHide}
|
|
71
|
-
size={large ? 'sm' : 'xs'}
|
|
72
|
-
class="ml-1.5 -mr-1.5"
|
|
73
|
-
/>
|
|
68
|
+
<Icon data={faClose} on:click={handleHide} class={classNames('mx-0.5')} />
|
|
74
69
|
{/if}
|
|
75
70
|
</svelte:element>
|
|
76
71
|
</span>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
-
import { goto } from '$app/navigation';
|
|
3
2
|
import { classNames } from '../../../utils';
|
|
4
3
|
import Icon from 'svelte-awesome';
|
|
5
4
|
import { ButtonType } from './model';
|
|
5
|
+
import { goto } from '$app/navigation';
|
|
6
6
|
export let size = 'md';
|
|
7
7
|
export let spacingSize = size;
|
|
8
8
|
export let color = 'blue';
|
|
@@ -37,6 +37,7 @@ const colorVariants = {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
$: buttonProps = {
|
|
40
|
+
id,
|
|
40
41
|
class: classNames(colorVariants[color][variant], variant === 'border' ? 'border' : '', ButtonType.FontSizeClasses[size], ButtonType.SpacingClasses[spacingSize], 'focus:ring-4 font-medium', 'rounded-md', 'flex justify-center items-center text-center whitespace-nowrap', btnClasses, disabled ? 'pointer-events-none cursor-default filter grayscale' : ''),
|
|
41
42
|
disabled,
|
|
42
43
|
href,
|
|
@@ -44,9 +45,11 @@ $: buttonProps = {
|
|
|
44
45
|
tabindex: disabled ? -1 : 0
|
|
45
46
|
};
|
|
46
47
|
function onClick(event) {
|
|
48
|
+
event.preventDefault();
|
|
47
49
|
dispatch('click', event);
|
|
48
|
-
if (href)
|
|
50
|
+
if (href) {
|
|
49
51
|
goto(href);
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
$: isSmall = size === 'xs' || size === 'sm';
|
|
52
55
|
$: startIconClass = classNames(iconOnly ? undefined : isSmall ? 'mr-1' : 'mr-2', startIcon?.classes);
|
|
@@ -7,7 +7,8 @@ $: open = Boolean(navigationState);
|
|
|
7
7
|
beforeNavigate((newNavigationState) => {
|
|
8
8
|
if (!navigationState &&
|
|
9
9
|
$dirtyStore &&
|
|
10
|
-
newNavigationState.to
|
|
10
|
+
newNavigationState.to &&
|
|
11
|
+
newNavigationState.to.pathname !== newNavigationState.from.pathname) {
|
|
11
12
|
navigationState = newNavigationState;
|
|
12
13
|
newNavigationState.cancel();
|
|
13
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as ActionRow } from './actionRow/ActionRow.svelte';
|
|
2
|
+
export { default as Alert } from './alert/Alert.svelte';
|
|
2
3
|
export { default as Badge } from './badge/Badge.svelte';
|
|
3
4
|
export { default as Button } from './button/Button.svelte';
|
|
4
5
|
export { default as ButtonPopup } from './button/ButtonPopup.svelte';
|
|
@@ -9,10 +10,13 @@ export { default as Kbd } from './kbd/Kbd.svelte';
|
|
|
9
10
|
export { default as Menu } from './menu/Menu.svelte';
|
|
10
11
|
export { default as MenuItem } from './menu/MenuItem.svelte';
|
|
11
12
|
export { default as Popup } from './popup/Popup.svelte';
|
|
13
|
+
export { default as Skeleton } from './skeleton/Skeleton.svelte';
|
|
12
14
|
export { default as Tab } from './tabs/Tab.svelte';
|
|
13
15
|
export { default as TabContent } from './tabs/TabContent.svelte';
|
|
14
16
|
export { default as Tabs } from './tabs/Tabs.svelte';
|
|
15
17
|
export { default as ToggleButton } from './toggleButton/ToggleButton.svelte';
|
|
16
18
|
export { default as ToggleButtonGroup } from './toggleButton/ToggleButtonGroup.svelte';
|
|
19
|
+
export * from './alert/model';
|
|
17
20
|
export * from './badge/model';
|
|
18
21
|
export * from './button/model';
|
|
22
|
+
export * from './skeleton/model';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as ActionRow } from './actionRow/ActionRow.svelte';
|
|
2
|
+
export { default as Alert } from './alert/Alert.svelte';
|
|
2
3
|
export { default as Badge } from './badge/Badge.svelte';
|
|
3
4
|
export { default as Button } from './button/Button.svelte';
|
|
4
5
|
export { default as ButtonPopup } from './button/ButtonPopup.svelte';
|
|
@@ -9,10 +10,13 @@ export { default as Kbd } from './kbd/Kbd.svelte';
|
|
|
9
10
|
export { default as Menu } from './menu/Menu.svelte';
|
|
10
11
|
export { default as MenuItem } from './menu/MenuItem.svelte';
|
|
11
12
|
export { default as Popup } from './popup/Popup.svelte';
|
|
13
|
+
export { default as Skeleton } from './skeleton/Skeleton.svelte';
|
|
12
14
|
export { default as Tab } from './tabs/Tab.svelte';
|
|
13
15
|
export { default as TabContent } from './tabs/TabContent.svelte';
|
|
14
16
|
export { default as Tabs } from './tabs/Tabs.svelte';
|
|
15
17
|
export { default as ToggleButton } from './toggleButton/ToggleButton.svelte';
|
|
16
18
|
export { default as ToggleButtonGroup } from './toggleButton/ToggleButtonGroup.svelte';
|
|
19
|
+
export * from './alert/model';
|
|
17
20
|
export * from './badge/model';
|
|
18
21
|
export * from './button/model';
|
|
22
|
+
export * from './skeleton/model';
|