windmill-components 1.382.1 → 1.382.7
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/package/base.d.ts +1 -1
- package/package/base.js +1 -1
- package/package/components/EditorBar.svelte +48 -38
- package/package/components/EditorBar.svelte.d.ts +2 -0
- package/package/components/FlowBuilder.svelte +15 -12
- package/package/components/FlowBuilder.svelte.d.ts +2 -2
- package/package/components/FlowStatusViewer.svelte +7 -1
- package/package/components/FlowStatusViewer.svelte.d.ts +3 -0
- package/package/components/FlowStatusViewerInner.svelte +12 -5
- package/package/components/FlowViewer.svelte +6 -46
- package/package/components/FlowViewer.svelte.d.ts +1 -0
- package/package/components/FlowViewerInner.svelte +109 -0
- package/package/components/FlowViewerInner.svelte.d.ts +22 -0
- package/package/components/ScriptBuilder.svelte +48 -40
- package/package/components/ScriptBuilder.svelte.d.ts +3 -0
- package/package/components/ScriptEditor.svelte +3 -1
- package/package/components/ScriptEditor.svelte.d.ts +2 -0
- package/package/components/apps/components/display/AppText.svelte +8 -3
- package/package/components/apps/components/inputs/AppSelect.svelte +45 -29
- package/package/components/apps/editor/component/components.d.ts +6 -0
- package/package/components/apps/editor/component/components.js +6 -0
- package/package/components/custom_ui.d.ts +35 -1
- package/package/components/details/DetailPageDetailPanel.svelte +4 -38
- package/package/components/details/WebhooksPanel.svelte +3 -3
- package/package/components/flows/content/FlowModuleComponent.svelte +8 -2
- package/package/components/flows/content/FlowModuleEarlyStop.svelte +193 -66
- package/package/components/flows/content/FlowModuleHeader.svelte +1 -1
- package/package/components/flows/content/FlowSettings.svelte +26 -15
- package/package/components/flows/flowExplorer.js +3 -0
- package/package/components/flows/map/MapItem.svelte +1 -1
- package/package/components/flows/propPicker/PropPickerWrapper.svelte +2 -0
- package/package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +1 -0
- package/package/components/flows/types.d.ts +2 -0
- package/package/components/graph/model.d.ts +3 -0
- package/package/components/propertyPicker/PropPickerResult.svelte +6 -1
- package/package/components/propertyPicker/PropPickerResult.svelte.d.ts +1 -0
- package/package/components/sidebar/changelogs.js +5 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +12 -0
- package/package/gen/schemas.gen.js +12 -0
- package/package/gen/services.gen.d.ts +4 -3
- package/package/gen/services.gen.js +7 -5
- package/package/gen/types.gen.d.ts +16 -8
- package/package.json +1 -1
package/package/base.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare let base: string;
|
package/package/base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export let base = import.meta.env.VITE_BASE_URL ?? '';
|
|
@@ -43,6 +43,7 @@ export let diffEditor = undefined;
|
|
|
43
43
|
export let args;
|
|
44
44
|
export let noHistory = false;
|
|
45
45
|
export let saveToWorkspace = false;
|
|
46
|
+
export let customUi = {};
|
|
46
47
|
let contextualVariablePicker;
|
|
47
48
|
let variablePicker;
|
|
48
49
|
let resourcePicker;
|
|
@@ -284,6 +285,7 @@ let historyBrowserDrawerOpen = false;
|
|
|
284
285
|
{/if}
|
|
285
286
|
</DrawerContent>
|
|
286
287
|
</Drawer>
|
|
288
|
+
|
|
287
289
|
<ItemPicker
|
|
288
290
|
bind:this={contextualVariablePicker}
|
|
289
291
|
pickCallback={(path, name) => {
|
|
@@ -484,7 +486,7 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
484
486
|
class="rounded-full w-2 h-2 mx-2 {validCode ? 'bg-green-300' : 'bg-red-300'}"
|
|
485
487
|
/>
|
|
486
488
|
<div class="flex items-center gap-0.5">
|
|
487
|
-
{#if showContextVarPicker}
|
|
489
|
+
{#if showContextVarPicker && customUi?.contextVar != false}
|
|
488
490
|
<Button
|
|
489
491
|
title="Add context variable"
|
|
490
492
|
color="light"
|
|
@@ -497,7 +499,7 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
497
499
|
>+Context Var
|
|
498
500
|
</Button>
|
|
499
501
|
{/if}
|
|
500
|
-
{#if showVarPicker}
|
|
502
|
+
{#if showVarPicker && customUi?.variable != false}
|
|
501
503
|
<Button
|
|
502
504
|
title="Add variable"
|
|
503
505
|
color="light"
|
|
@@ -527,7 +529,7 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
527
529
|
</Button>
|
|
528
530
|
{/if}
|
|
529
531
|
|
|
530
|
-
{#if showResourceTypePicker}
|
|
532
|
+
{#if showResourceTypePicker && customUi?.type != false}
|
|
531
533
|
<Button
|
|
532
534
|
title="Add resource type"
|
|
533
535
|
btnClasses="!font-medium text-tertiary"
|
|
@@ -555,37 +557,41 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
555
557
|
Reset
|
|
556
558
|
</Button>
|
|
557
559
|
|
|
558
|
-
{#if
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
<span class="-my-1">
|
|
575
|
-
{#if lang == 'deno'}
|
|
576
|
-
(<span class={websocketAlive.deno ? 'green' : 'text-red-700'}>Deno</span>)
|
|
577
|
-
{:else if lang == 'go'}
|
|
578
|
-
(<span class={websocketAlive.go ? 'green' : 'text-red-700'}>Go</span>)
|
|
579
|
-
{:else if lang == 'python3'}
|
|
580
|
-
(<span class={websocketAlive.pyright ? 'green' : 'text-red-700'}>Pyright</span>
|
|
581
|
-
<span class={websocketAlive.ruff ? 'green' : 'text-red-700'}>Ruff</span>)
|
|
582
|
-
{:else if lang == 'bash'}
|
|
583
|
-
(<span class={websocketAlive.shellcheck ? 'green' : 'text-red-700'}>Shellcheck</span>)
|
|
560
|
+
{#if customUi?.assistants != false}
|
|
561
|
+
{#if lang == 'deno' || lang == 'python3' || lang == 'go' || lang == 'bash'}
|
|
562
|
+
<Button
|
|
563
|
+
btnClasses="!font-medium text-tertiary"
|
|
564
|
+
size="xs"
|
|
565
|
+
spacingSize="md"
|
|
566
|
+
color="light"
|
|
567
|
+
on:click={() => editor?.reloadWebsocket()}
|
|
568
|
+
startIcon={{
|
|
569
|
+
icon: RotateCw,
|
|
570
|
+
classes: websocketAlive[lang] == false ? 'animate-spin' : ''
|
|
571
|
+
}}
|
|
572
|
+
title="Reload assistants"
|
|
573
|
+
>
|
|
574
|
+
{#if !iconOnly}
|
|
575
|
+
Assistants
|
|
584
576
|
{/if}
|
|
585
|
-
|
|
586
|
-
|
|
577
|
+
<span class="-my-1">
|
|
578
|
+
{#if lang == 'deno'}
|
|
579
|
+
(<span class={websocketAlive.deno ? 'green' : 'text-red-700'}>Deno</span>)
|
|
580
|
+
{:else if lang == 'go'}
|
|
581
|
+
(<span class={websocketAlive.go ? 'green' : 'text-red-700'}>Go</span>)
|
|
582
|
+
{:else if lang == 'python3'}
|
|
583
|
+
(<span class={websocketAlive.pyright ? 'green' : 'text-red-700'}>Pyright</span>
|
|
584
|
+
<span class={websocketAlive.ruff ? 'green' : 'text-red-700'}>Ruff</span>)
|
|
585
|
+
{:else if lang == 'bash'}
|
|
586
|
+
(<span class={websocketAlive.shellcheck ? 'green' : 'text-red-700'}>Shellcheck</span
|
|
587
|
+
>)
|
|
588
|
+
{/if}
|
|
589
|
+
</span>
|
|
590
|
+
</Button>
|
|
591
|
+
{/if}
|
|
587
592
|
{/if}
|
|
588
|
-
|
|
593
|
+
|
|
594
|
+
{#if collabMode && customUi?.multiplayer != false}
|
|
589
595
|
<div class="flex items-center px-3">
|
|
590
596
|
<Toggle
|
|
591
597
|
options={{ right: '' }}
|
|
@@ -619,11 +625,15 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
619
625
|
</div>
|
|
620
626
|
{/if}
|
|
621
627
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
628
|
+
{#if customUi?.autoformatting != false}
|
|
629
|
+
<FormatOnSave />
|
|
630
|
+
{/if}
|
|
631
|
+
{#if customUi?.aiGen != false}
|
|
632
|
+
<ScriptGen {editor} {diffEditor} {lang} {iconOnly} {args} />
|
|
633
|
+
{/if}
|
|
634
|
+
{#if customUi?.aiFix != false}
|
|
635
|
+
<CodeCompletionStatus />
|
|
636
|
+
{/if}
|
|
627
637
|
</div>
|
|
628
638
|
</div>
|
|
629
639
|
|
|
@@ -642,7 +652,7 @@ $res = json_decode(curl_exec($ch));`)
|
|
|
642
652
|
History
|
|
643
653
|
</Button>
|
|
644
654
|
{/if}
|
|
645
|
-
{#if SCRIPT_EDITOR_SHOW_EXPLORE_OTHER_SCRIPTS}
|
|
655
|
+
{#if SCRIPT_EDITOR_SHOW_EXPLORE_OTHER_SCRIPTS && customUi?.library != false}
|
|
646
656
|
<Button
|
|
647
657
|
btnClasses="!font-medium text-tertiary"
|
|
648
658
|
size="xs"
|
|
@@ -3,6 +3,7 @@ export declare const EDITOR_BAR_WIDTH_THRESHOLD = 1044;
|
|
|
3
3
|
import type Editor from './Editor.svelte';
|
|
4
4
|
import type { SupportedLanguage } from '../common';
|
|
5
5
|
import type DiffEditor from './DiffEditor.svelte';
|
|
6
|
+
import type { EditorBarUi } from './custom_ui';
|
|
6
7
|
declare const __propDef: {
|
|
7
8
|
props: {
|
|
8
9
|
lang: SupportedLanguage | 'bunnative' | undefined;
|
|
@@ -28,6 +29,7 @@ declare const __propDef: {
|
|
|
28
29
|
args: Record<string, any>;
|
|
29
30
|
noHistory?: boolean | undefined;
|
|
30
31
|
saveToWorkspace?: boolean | undefined;
|
|
32
|
+
customUi?: EditorBarUi | undefined;
|
|
31
33
|
};
|
|
32
34
|
events: {
|
|
33
35
|
toggleCollabMode: CustomEvent<any>;
|
|
@@ -330,7 +330,8 @@ setContext('FlowEditorContext', {
|
|
|
330
330
|
testStepStore,
|
|
331
331
|
saveDraft,
|
|
332
332
|
initialPath,
|
|
333
|
-
flowInputsStore: writable({})
|
|
333
|
+
flowInputsStore: writable({}),
|
|
334
|
+
customUi
|
|
334
335
|
});
|
|
335
336
|
async function loadSchedule() {
|
|
336
337
|
loadFlowSchedule(initialPath, $workspaceStore)
|
|
@@ -403,17 +404,19 @@ function generateIds() {
|
|
|
403
404
|
];
|
|
404
405
|
}
|
|
405
406
|
const dropdownItems = [];
|
|
406
|
-
if (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
407
|
+
if (customUi.topBar?.extraDeployOptions != false) {
|
|
408
|
+
if (savedFlow?.draft_only === false || savedFlow?.draft_only === undefined) {
|
|
409
|
+
dropdownItems.push({
|
|
410
|
+
label: 'Exit & see details',
|
|
411
|
+
onClick: () => dispatch('details', $pathStore)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (!newFlow) {
|
|
415
|
+
dropdownItems.push({
|
|
416
|
+
label: 'Fork',
|
|
417
|
+
onClick: () => window.open(`/flows/add?template=${initialPath}`)
|
|
418
|
+
});
|
|
419
|
+
}
|
|
417
420
|
}
|
|
418
421
|
let flowCopilotContext = {
|
|
419
422
|
drawerStore: writable(undefined),
|
|
@@ -3,7 +3,7 @@ import { type Flow, type OpenFlow } from '../gen';
|
|
|
3
3
|
import { type Writable } from 'svelte/store';
|
|
4
4
|
import type { FlowState } from './flows/flowState';
|
|
5
5
|
import type DiffDrawer from './DiffDrawer.svelte';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FlowBuilderWhitelabelCustomUi } from './custom_ui';
|
|
7
7
|
declare const __propDef: {
|
|
8
8
|
props: {
|
|
9
9
|
initialPath?: string | undefined;
|
|
@@ -18,7 +18,7 @@ declare const __propDef: {
|
|
|
18
18
|
draft?: Flow | undefined;
|
|
19
19
|
}) | undefined;
|
|
20
20
|
diffDrawer?: DiffDrawer | undefined;
|
|
21
|
-
customUi?:
|
|
21
|
+
customUi?: FlowBuilderWhitelabelCustomUi | undefined;
|
|
22
22
|
computeUnlockedSteps?: ((flow: Flow) => {
|
|
23
23
|
[k: string]: string;
|
|
24
24
|
}) | undefined;
|
|
@@ -8,6 +8,9 @@ export let workspaceId = undefined;
|
|
|
8
8
|
export let flowStateStore = writable({});
|
|
9
9
|
export let selectedJobStep = undefined;
|
|
10
10
|
export let hideFlowResult = false;
|
|
11
|
+
export let hideTimeline = false;
|
|
12
|
+
export let hideDownloadInGraph = false;
|
|
13
|
+
export let hideNodeDefinition = false;
|
|
11
14
|
export let isOwner = false;
|
|
12
15
|
export let wideResults = false;
|
|
13
16
|
let lastJobId = jobId;
|
|
@@ -16,7 +19,10 @@ let suspendStatus = writable({});
|
|
|
16
19
|
setContext('FlowStatusViewer', {
|
|
17
20
|
flowStateStore,
|
|
18
21
|
suspendStatus,
|
|
19
|
-
retryStatus
|
|
22
|
+
retryStatus,
|
|
23
|
+
hideDownloadInGraph,
|
|
24
|
+
hideNodeDefinition,
|
|
25
|
+
hideTimeline
|
|
20
26
|
});
|
|
21
27
|
function loadOwner(path) {
|
|
22
28
|
isOwner = loadIsOwner(path, $userStore, workspaceId ?? $workspaceStore);
|
|
@@ -8,6 +8,9 @@ declare const __propDef: {
|
|
|
8
8
|
flowStateStore?: Writable<FlowState> | undefined;
|
|
9
9
|
selectedJobStep?: string | undefined;
|
|
10
10
|
hideFlowResult?: boolean | undefined;
|
|
11
|
+
hideTimeline?: boolean | undefined;
|
|
12
|
+
hideDownloadInGraph?: boolean | undefined;
|
|
13
|
+
hideNodeDefinition?: boolean | undefined;
|
|
11
14
|
isOwner?: boolean | undefined;
|
|
12
15
|
wideResults?: boolean | undefined;
|
|
13
16
|
};
|
|
@@ -22,7 +22,7 @@ import Alert from './common/alert/Alert.svelte';
|
|
|
22
22
|
import FlowGraphViewerStep from './FlowGraphViewerStep.svelte';
|
|
23
23
|
import FlowGraphV2 from './graph/FlowGraphV2.svelte';
|
|
24
24
|
const dispatch = createEventDispatcher();
|
|
25
|
-
let { flowStateStore, retryStatus, suspendStatus } = getContext('FlowStatusViewer');
|
|
25
|
+
let { flowStateStore, retryStatus, suspendStatus, hideDownloadInGraph, hideTimeline, hideNodeDefinition } = getContext('FlowStatusViewer');
|
|
26
26
|
export let jobId;
|
|
27
27
|
export let workspaceId = undefined;
|
|
28
28
|
export let flowJobIds = undefined;
|
|
@@ -654,7 +654,7 @@ let wrapperHeight = 0;
|
|
|
654
654
|
{/if}
|
|
655
655
|
{/each}
|
|
656
656
|
</div>
|
|
657
|
-
{:else if innerModules.length > 0}
|
|
657
|
+
{:else if innerModules.length > 0 && (job.raw_flow?.modules.length ?? 0) > 0}
|
|
658
658
|
<ul class="w-full">
|
|
659
659
|
<h3 class="text-md leading-6 font-bold text-primary border-b mb-4 py-2">
|
|
660
660
|
Step-by-step
|
|
@@ -774,6 +774,8 @@ let wrapperHeight = 0;
|
|
|
774
774
|
</li>
|
|
775
775
|
{/each}
|
|
776
776
|
</ul>
|
|
777
|
+
{:else}
|
|
778
|
+
<div class="p-2 text-tertiary text-sm italic">Empty flow</div>
|
|
777
779
|
{/if}
|
|
778
780
|
</div>
|
|
779
781
|
</div>
|
|
@@ -800,7 +802,7 @@ let wrapperHeight = 0;
|
|
|
800
802
|
</div>
|
|
801
803
|
|
|
802
804
|
<FlowGraphV2
|
|
803
|
-
download
|
|
805
|
+
download={!hideDownloadInGraph}
|
|
804
806
|
minHeight={wrapperHeight}
|
|
805
807
|
success={jobId != undefined && isSuccess(job?.['success'])}
|
|
806
808
|
flowModuleStates={$localModuleStates}
|
|
@@ -840,9 +842,14 @@ let wrapperHeight = 0;
|
|
|
840
842
|
class="border-l border-tertiary-inverse pt-1 overflow-auto min-h-[700px] flex flex-col z-0 h-full"
|
|
841
843
|
>
|
|
842
844
|
<Tabs bind:selected={rightColumnSelect}>
|
|
843
|
-
|
|
845
|
+
{#if !hideTimeline}
|
|
846
|
+
<Tab value="timeline"><span class="font-semibold text-md">Timeline</span></Tab>
|
|
847
|
+
{/if}
|
|
844
848
|
<Tab value="node_status"><span class="font-semibold">Node status</span></Tab>
|
|
845
|
-
|
|
849
|
+
{#if !hideNodeDefinition}
|
|
850
|
+
<Tab value="node_definition"><span class="font-semibold">Node definition</span></Tab
|
|
851
|
+
>
|
|
852
|
+
{/if}
|
|
846
853
|
{#if Object.keys(job?.flow_status?.user_states ?? {}).length > 0}
|
|
847
854
|
<Tab value="user_states"><span class="font-semibold">User States</span></Tab>
|
|
848
855
|
{/if}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import json from 'svelte-highlight/languages/json';
|
|
3
|
-
import { Tab, Tabs, TabContent, Button } from './common';
|
|
1
|
+
<script>import { Tab, Tabs, TabContent } from './common';
|
|
4
2
|
import SchemaViewer from './SchemaViewer.svelte';
|
|
5
3
|
import FieldHeader from './FieldHeader.svelte';
|
|
6
|
-
import { copyToClipboard } from '../utils';
|
|
7
4
|
import FlowGraphViewer from './FlowGraphViewer.svelte';
|
|
8
|
-
import { Clipboard } from 'lucide-svelte';
|
|
9
|
-
import YAML from 'yaml';
|
|
10
|
-
import { yaml } from 'svelte-highlight/languages';
|
|
11
5
|
import HighlightTheme from './HighlightTheme.svelte';
|
|
6
|
+
import FlowViewerInner from './FlowViewerInner.svelte';
|
|
12
7
|
export let flow;
|
|
13
8
|
export let initialOpen = undefined;
|
|
14
9
|
export let noSide = false;
|
|
15
|
-
$: flowFiltered = {
|
|
16
|
-
summary: flow.summary,
|
|
17
|
-
description: flow.description,
|
|
18
|
-
value: flow.value,
|
|
19
|
-
schema: flow.schema
|
|
20
|
-
};
|
|
21
10
|
export let noGraph = false;
|
|
22
11
|
export let tab = noGraph ? 'schema' : 'ui';
|
|
23
12
|
export let noSummary = false;
|
|
24
|
-
let
|
|
13
|
+
export let noGraphDownload = false;
|
|
25
14
|
let open = {};
|
|
26
15
|
if (initialOpen) {
|
|
27
16
|
open[initialOpen] = true;
|
|
@@ -73,40 +62,11 @@ function toAny(x) {
|
|
|
73
62
|
<div class="text-secondary text-xs italic mb-4">No inputs</div>
|
|
74
63
|
{/if}
|
|
75
64
|
|
|
76
|
-
<FlowGraphViewer download {noSide} {flow} overflowAuto />
|
|
65
|
+
<FlowGraphViewer download={!noGraphDownload} {noSide} {flow} overflowAuto />
|
|
77
66
|
</div>
|
|
78
67
|
</TabContent>
|
|
79
|
-
<TabContent value="raw"
|
|
80
|
-
|
|
81
|
-
<Tab value="yaml">YAML</Tab>
|
|
82
|
-
<Tab value="json">JSON</Tab>
|
|
83
|
-
<svelte:fragment slot="content">
|
|
84
|
-
<div class="relative pt-2">
|
|
85
|
-
<Button
|
|
86
|
-
on:click={() =>
|
|
87
|
-
copyToClipboard(
|
|
88
|
-
rawType === 'yaml'
|
|
89
|
-
? YAML.stringify(flowFiltered)
|
|
90
|
-
: JSON.stringify(flowFiltered, null, 4)
|
|
91
|
-
)}
|
|
92
|
-
color="light"
|
|
93
|
-
variant="border"
|
|
94
|
-
size="xs"
|
|
95
|
-
startIcon={{ icon: Clipboard }}
|
|
96
|
-
btnClasses="absolute top-2 right-2 w-min"
|
|
97
|
-
>
|
|
98
|
-
Copy content
|
|
99
|
-
</Button>
|
|
100
|
-
<Highlight
|
|
101
|
-
class="overflow-auto px-1"
|
|
102
|
-
language={rawType === 'yaml' ? yaml : json}
|
|
103
|
-
code={rawType === 'yaml'
|
|
104
|
-
? YAML.stringify(flowFiltered)
|
|
105
|
-
: JSON.stringify(flowFiltered, null, 4)}
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
108
|
-
</svelte:fragment>
|
|
109
|
-
</Tabs>
|
|
68
|
+
<TabContent value="raw">
|
|
69
|
+
<FlowViewerInner {flow} />
|
|
110
70
|
</TabContent>
|
|
111
71
|
<TabContent value="schema">
|
|
112
72
|
<div class="my-4" />
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script>import Highlight from 'svelte-highlight';
|
|
2
|
+
import json from 'svelte-highlight/languages/json';
|
|
3
|
+
import { Tab, Tabs, Button } from './common';
|
|
4
|
+
import { copyToClipboard } from '../utils';
|
|
5
|
+
import { ArrowDown, Clipboard } from 'lucide-svelte';
|
|
6
|
+
import YAML from 'yaml';
|
|
7
|
+
import { yaml } from 'svelte-highlight/languages';
|
|
8
|
+
import HighlightTheme from './HighlightTheme.svelte';
|
|
9
|
+
export let flow;
|
|
10
|
+
$: flowFiltered = {
|
|
11
|
+
summary: flow.summary,
|
|
12
|
+
description: flow.description,
|
|
13
|
+
value: flow.value,
|
|
14
|
+
schema: flow.schema
|
|
15
|
+
};
|
|
16
|
+
let rawType = 'yaml';
|
|
17
|
+
function trimStringToLines(inputString, maxLines = 100) {
|
|
18
|
+
const lines = inputString?.split('\n') ?? [];
|
|
19
|
+
const linesToKeep = lines.slice(0, maxLines);
|
|
20
|
+
return linesToKeep.join('\n');
|
|
21
|
+
}
|
|
22
|
+
let code = '';
|
|
23
|
+
function computeCode() {
|
|
24
|
+
const str = rawType === 'json' ? JSON.stringify(flowFiltered, null, 4) : YAML.stringify(flowFiltered);
|
|
25
|
+
const numberOfLines = str.split('\n').length;
|
|
26
|
+
if (numberOfLines > maxLines) {
|
|
27
|
+
shouldDisplayLoadMore = true;
|
|
28
|
+
}
|
|
29
|
+
code = str;
|
|
30
|
+
}
|
|
31
|
+
let shouldDisplayLoadMore = false;
|
|
32
|
+
$: flowFiltered && rawType && computeCode();
|
|
33
|
+
let maxLines = 100;
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<HighlightTheme />
|
|
37
|
+
|
|
38
|
+
<div>
|
|
39
|
+
<Tabs
|
|
40
|
+
bind:selected={rawType}
|
|
41
|
+
on:selected={() => {
|
|
42
|
+
maxLines = 100
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Tab value="yaml">YAML</Tab>
|
|
46
|
+
<Tab value="json">JSON</Tab>
|
|
47
|
+
<svelte:fragment slot="content">
|
|
48
|
+
<div class="relative pt-2">
|
|
49
|
+
<Button
|
|
50
|
+
on:click={() =>
|
|
51
|
+
copyToClipboard(
|
|
52
|
+
rawType === 'yaml'
|
|
53
|
+
? YAML.stringify(flowFiltered)
|
|
54
|
+
: JSON.stringify(flowFiltered, null, 4)
|
|
55
|
+
)}
|
|
56
|
+
color="light"
|
|
57
|
+
variant="border"
|
|
58
|
+
size="xs"
|
|
59
|
+
startIcon={{ icon: Clipboard }}
|
|
60
|
+
btnClasses="absolute top-2 right-2 w-min"
|
|
61
|
+
>
|
|
62
|
+
Copy content
|
|
63
|
+
</Button>
|
|
64
|
+
|
|
65
|
+
<div class={shouldDisplayLoadMore ? 'code-container' : ''}>
|
|
66
|
+
<Highlight
|
|
67
|
+
class="overflow-auto px-1"
|
|
68
|
+
language={rawType === 'yaml' ? yaml : json}
|
|
69
|
+
code={trimStringToLines(code, maxLines)}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
{#if shouldDisplayLoadMore}
|
|
73
|
+
<Button
|
|
74
|
+
on:click={() => {
|
|
75
|
+
maxLines += 500
|
|
76
|
+
|
|
77
|
+
// If the code is less than the max lines, we don't need to show the button
|
|
78
|
+
if (maxLines >= code?.split('\n').length) {
|
|
79
|
+
shouldDisplayLoadMore = false
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
82
|
+
color="light"
|
|
83
|
+
size="xs"
|
|
84
|
+
btnClasses="mb-2 mx-2"
|
|
85
|
+
startIcon={{ icon: ArrowDown }}
|
|
86
|
+
>
|
|
87
|
+
Show more
|
|
88
|
+
</Button>
|
|
89
|
+
{/if}
|
|
90
|
+
</div>
|
|
91
|
+
</svelte:fragment>
|
|
92
|
+
</Tabs>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
.code-container {
|
|
97
|
+
position: relative;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
}
|
|
100
|
+
.code-container::after {
|
|
101
|
+
content: '';
|
|
102
|
+
position: absolute;
|
|
103
|
+
bottom: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
right: 0;
|
|
106
|
+
height: 100px;
|
|
107
|
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgb(var(--color-surface)));
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { FlowValue } from '../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
flow: {
|
|
6
|
+
summary: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
value: FlowValue;
|
|
9
|
+
schema?: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type FlowViewerInnerProps = typeof __propDef.props;
|
|
18
|
+
export type FlowViewerInnerEvents = typeof __propDef.events;
|
|
19
|
+
export type FlowViewerInnerSlots = typeof __propDef.slots;
|
|
20
|
+
export default class FlowViewerInner extends SvelteComponent<FlowViewerInnerProps, FlowViewerInnerEvents, FlowViewerInnerSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -38,15 +38,18 @@ export let template = 'script';
|
|
|
38
38
|
export let initialArgs = {};
|
|
39
39
|
export let lockedLanguage = false;
|
|
40
40
|
export let showMeta = false;
|
|
41
|
+
export let neverShowMeta = false;
|
|
41
42
|
export let diffDrawer = undefined;
|
|
42
43
|
export let savedScript = undefined;
|
|
43
44
|
export let searchParams = new URLSearchParams();
|
|
44
45
|
export let disableHistoryChange = false;
|
|
45
46
|
export let replaceStateFn = (url) => window.history.replaceState(null, '', url);
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
export let customUi = {};
|
|
48
|
+
let metadataOpen = !neverShowMeta &&
|
|
49
|
+
(showMeta ||
|
|
50
|
+
(initialPath == '' &&
|
|
51
|
+
searchParams.get('state') == undefined &&
|
|
52
|
+
searchParams.get('collab') == undefined));
|
|
50
53
|
let editor = undefined;
|
|
51
54
|
let scriptEditor = undefined;
|
|
52
55
|
let scheduleStore = writable({
|
|
@@ -344,7 +347,7 @@ async function saveDraft(forceSave = false) {
|
|
|
344
347
|
loadingDraft = false;
|
|
345
348
|
}
|
|
346
349
|
function computeDropdownItems(initialPath) {
|
|
347
|
-
let dropdownItems = initialPath != ''
|
|
350
|
+
let dropdownItems = initialPath != '' && customUi?.topBar?.extraDeployOptions != false
|
|
348
351
|
? [
|
|
349
352
|
{
|
|
350
353
|
label: 'Deploy & Stay here',
|
|
@@ -965,32 +968,34 @@ function langToLanguage(lang) {
|
|
|
965
968
|
{$scheduleStore.cron ?? ''}
|
|
966
969
|
</Button>
|
|
967
970
|
{/if}
|
|
968
|
-
|
|
969
|
-
<div>
|
|
970
|
-
<
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
<Badge
|
|
976
|
-
color="gray"
|
|
977
|
-
class="center-center !bg-surface-secondary !text-tertiary !h-[28px] !w-[70px] rounded-none hover:!bg-surface-hover transition-all"
|
|
971
|
+
{#if customUi?.topBar?.path != false}
|
|
972
|
+
<div class="flex justify-start w-full border rounded-md overflow-hidden">
|
|
973
|
+
<div>
|
|
974
|
+
<button
|
|
975
|
+
on:click={async () => {
|
|
976
|
+
metadataOpen = true
|
|
977
|
+
}}
|
|
978
978
|
>
|
|
979
|
-
<
|
|
980
|
-
|
|
981
|
-
|
|
979
|
+
<Badge
|
|
980
|
+
color="gray"
|
|
981
|
+
class="center-center !bg-surface-secondary !text-tertiary !h-[28px] !w-[70px] rounded-none hover:!bg-surface-hover transition-all"
|
|
982
|
+
>
|
|
983
|
+
<Pen size={12} class="mr-2" /> Path
|
|
984
|
+
</Badge>
|
|
985
|
+
</button>
|
|
986
|
+
</div>
|
|
987
|
+
<input
|
|
988
|
+
type="text"
|
|
989
|
+
readonly
|
|
990
|
+
value={script.path}
|
|
991
|
+
size={script.path?.length || 50}
|
|
992
|
+
class="font-mono !text-xs !min-w-[96px] !max-w-[300px] !w-full !h-[28px] !my-0 !py-0 !border-l-0 !rounded-l-none !border-0 !shadow-none"
|
|
993
|
+
on:focus={({ currentTarget }) => {
|
|
994
|
+
currentTarget.select()
|
|
995
|
+
}}
|
|
996
|
+
/>
|
|
982
997
|
</div>
|
|
983
|
-
|
|
984
|
-
type="text"
|
|
985
|
-
readonly
|
|
986
|
-
value={script.path}
|
|
987
|
-
size={script.path?.length || 50}
|
|
988
|
-
class="font-mono !text-xs !min-w-[96px] !max-w-[300px] !w-full !h-[28px] !my-0 !py-0 !border-l-0 !rounded-l-none !border-0 !shadow-none"
|
|
989
|
-
on:focus={({ currentTarget }) => {
|
|
990
|
-
currentTarget.select()
|
|
991
|
-
}}
|
|
992
|
-
/>
|
|
993
|
-
</div>
|
|
998
|
+
{/if}
|
|
994
999
|
</div>
|
|
995
1000
|
|
|
996
1001
|
{#if $enterpriseLicense && initialPath != ''}
|
|
@@ -1021,17 +1026,19 @@ function langToLanguage(lang) {
|
|
|
1021
1026
|
<span class="hidden lg:flex"> Diff </span>
|
|
1022
1027
|
</div>
|
|
1023
1028
|
</Button>
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1029
|
+
{#if customUi?.topBar?.settings != false}
|
|
1030
|
+
<Button
|
|
1031
|
+
color="light"
|
|
1032
|
+
variant="border"
|
|
1033
|
+
size="xs"
|
|
1034
|
+
on:click={() => {
|
|
1035
|
+
metadataOpen = true
|
|
1036
|
+
}}
|
|
1037
|
+
startIcon={{ icon: Settings }}
|
|
1038
|
+
>
|
|
1039
|
+
<span class="hidden lg:flex"> Settings </span>
|
|
1040
|
+
</Button>
|
|
1041
|
+
{/if}
|
|
1035
1042
|
<Button
|
|
1036
1043
|
loading={loadingDraft}
|
|
1037
1044
|
size="xs"
|
|
@@ -1085,6 +1092,7 @@ function langToLanguage(lang) {
|
|
|
1085
1092
|
</div>
|
|
1086
1093
|
|
|
1087
1094
|
<ScriptEditor
|
|
1095
|
+
{customUi}
|
|
1088
1096
|
collabMode
|
|
1089
1097
|
edit={initialPath != ''}
|
|
1090
1098
|
on:format={() => {
|