@flowdrop/flowdrop 2.16.0 → 2.18.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/CHANGELOG.md +95 -0
- package/README.md +6 -1
- package/dist/api/enhanced-client.d.ts +3 -1
- package/dist/api/enhanced-client.js +4 -2
- package/dist/commands/executor.js +9 -0
- package/dist/commands/storeIntegration.svelte.js +6 -0
- package/dist/commands/types.d.ts +8 -0
- package/dist/components/App.svelte +414 -105
- package/dist/components/App.svelte.d.ts +31 -0
- package/dist/components/CanvasToolbar.svelte +40 -3
- package/dist/components/CanvasToolbar.svelte.d.ts +5 -1
- package/dist/components/ConnectPortPicker.svelte +8 -4
- package/dist/components/DoctorMenu.svelte +208 -126
- package/dist/components/FlowDropZone.svelte +7 -1
- package/dist/components/FlowDropZone.svelte.d.ts +5 -0
- package/dist/components/ImpactConfirm.svelte +554 -0
- package/dist/components/ImpactConfirm.svelte.d.ts +22 -0
- package/dist/components/Input.svelte +8 -2
- package/dist/components/LockBanner.svelte +76 -0
- package/dist/components/LockBanner.svelte.d.ts +14 -0
- package/dist/components/LockFence.svelte +33 -0
- package/dist/components/LockFence.svelte.d.ts +19 -0
- package/dist/components/Navbar.svelte +77 -9
- package/dist/components/Navbar.svelte.d.ts +10 -0
- package/dist/components/NodeSidebar.svelte +36 -15
- package/dist/components/NodeSidebar.svelte.d.ts +2 -0
- package/dist/components/NodeSwapPicker.svelte +4 -14
- package/dist/components/RunBar.svelte +50 -3
- package/dist/components/RunBar.svelte.d.ts +5 -0
- package/dist/components/RunInputsDialog.svelte +198 -0
- package/dist/components/RunInputsDialog.svelte.d.ts +34 -0
- package/dist/components/Textarea.svelte +7 -1
- package/dist/components/WorkflowCompareDialog.svelte +177 -0
- package/dist/components/WorkflowCompareDialog.svelte.d.ts +10 -0
- package/dist/components/WorkflowEditor.svelte +120 -15
- package/dist/components/WorkflowEditor.svelte.d.ts +6 -0
- package/dist/components/WorkflowInterfaceEditor.svelte +17 -4
- package/dist/components/WorkflowInterfaceEntryCard.svelte +40 -7
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +2 -0
- package/dist/components/WorkflowPlaygroundSettings.svelte +9 -1
- package/dist/components/form/FieldFactory.svelte +13 -6
- package/dist/components/form/FormArray.svelte +0 -1
- package/dist/components/form/FormArrayRows.svelte +4 -4
- package/dist/components/form/FormCodeEditor.svelte +18 -2
- package/dist/components/form/FormMarkdownEditor.svelte +22 -8
- package/dist/components/form/FormTemplateEditor.svelte +17 -1
- package/dist/components/form/readOnly.d.ts +13 -0
- package/dist/components/form/readOnly.js +18 -0
- package/dist/components/nodes/CaptionNode.svelte +1 -0
- package/dist/components/nodes/NodeCard.svelte +2 -2
- package/dist/components/primitives/Checkbox.svelte +5 -1
- package/dist/components/primitives/Select.svelte +6 -1
- package/dist/components/primitives/Switch.svelte +5 -1
- package/dist/components/toast/DismissibleToast.svelte +25 -6
- package/dist/components/toast/DismissibleToast.svelte.d.ts +3 -0
- package/dist/config/endpoints.d.ts +7 -0
- package/dist/config/endpoints.js +2 -1
- package/dist/editor/connectCandidates.d.ts +3 -0
- package/dist/editor/connectCandidates.js +14 -5
- package/dist/editor/index.d.ts +2 -1
- package/dist/editor/index.js +1 -1
- package/dist/helpers/workflowEditorHelper.d.ts +15 -0
- package/dist/helpers/workflowEditorHelper.js +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/messages/defaults.d.ts +145 -0
- package/dist/messages/defaults.js +139 -1
- package/dist/openapi/v1/openapi.yaml +492 -0
- package/dist/registry/nodeComponentRegistry.d.ts +5 -0
- package/dist/schemas/v1/workflow.schema.json +2 -0
- package/dist/services/draftStorage.d.ts +24 -10
- package/dist/services/draftStorage.js +60 -35
- package/dist/services/globalSave.d.ts +45 -10
- package/dist/services/globalSave.js +296 -32
- package/dist/services/impactGate.d.ts +38 -0
- package/dist/services/impactGate.js +72 -0
- package/dist/services/impactService.d.ts +45 -0
- package/dist/services/impactService.js +157 -0
- package/dist/services/runsService.d.ts +9 -0
- package/dist/services/runsService.js +13 -0
- package/dist/services/toastQueue.d.ts +9 -0
- package/dist/services/toastService.d.ts +4 -0
- package/dist/services/toastService.js +9 -3
- package/dist/services/workflowLaunchService.d.ts +6 -0
- package/dist/services/workflowLaunchService.js +5 -1
- package/dist/settings/index.d.ts +2 -2
- package/dist/settings/index.js +1 -1
- package/dist/stores/doctorStore.svelte.d.ts +24 -1
- package/dist/stores/doctorStore.svelte.js +105 -2
- package/dist/stores/historyStore.svelte.d.ts +12 -2
- package/dist/stores/historyStore.svelte.js +25 -2
- package/dist/stores/instanceContainer.svelte.d.ts +23 -0
- package/dist/stores/instanceContainer.svelte.js +32 -2
- package/dist/stores/lockStore.svelte.d.ts +39 -0
- package/dist/stores/lockStore.svelte.js +109 -0
- package/dist/stores/runController.svelte.d.ts +2 -0
- package/dist/stores/runController.svelte.js +27 -11
- package/dist/stores/saveConflictStore.svelte.d.ts +62 -0
- package/dist/stores/saveConflictStore.svelte.js +169 -0
- package/dist/stores/workflowStore.svelte.d.ts +14 -4
- package/dist/stores/workflowStore.svelte.js +55 -18
- package/dist/styles/base.css +6 -0
- package/dist/styles/toast.css +10 -1
- package/dist/svelte-app.d.ts +33 -0
- package/dist/svelte-app.js +178 -22
- package/dist/types/doctor.d.ts +3 -1
- package/dist/types/events.d.ts +37 -0
- package/dist/types/events.js +2 -0
- package/dist/types/impact.d.ts +77 -0
- package/dist/types/impact.js +7 -0
- package/dist/types/lock.d.ts +35 -0
- package/dist/types/lock.js +13 -0
- package/dist/types/navbar.d.ts +6 -0
- package/dist/types/settings.d.ts +31 -0
- package/dist/types/settings.js +132 -0
- package/dist/utils/draftRestore.d.ts +27 -0
- package/dist/utils/draftRestore.js +36 -0
- package/dist/utils/interfaceTags.js +4 -1
- package/dist/utils/links.d.ts +29 -0
- package/dist/utils/links.js +63 -0
- package/dist/utils/nodeSearch.d.ts +10 -0
- package/dist/utils/nodeSearch.js +37 -0
- package/dist/utils/runOffer.d.ts +21 -0
- package/dist/utils/runOffer.js +13 -0
- package/dist/utils/workflowCompare.d.ts +35 -0
- package/dist/utils/workflowCompare.js +84 -0
- package/dist/utils/workflowInterface.d.ts +26 -1
- package/dist/utils/workflowInterface.js +91 -11
- package/dist/webmcp/runtime.js +16 -3
- package/dist/webmcp/types.d.ts +11 -1
- package/package.json +3 -2
|
@@ -11,6 +11,7 @@ import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
|
11
11
|
import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
|
|
12
12
|
import type { EditorPlaygroundConfig } from '../types/playground.js';
|
|
13
13
|
import type { EditorMode } from '../stores/editorModeStore.svelte.js';
|
|
14
|
+
import type { EditorLock } from '../types/lock.js';
|
|
14
15
|
import type { MessagesOverride } from '../messages/index.js';
|
|
15
16
|
/**
|
|
16
17
|
* Configuration props for runtime customization
|
|
@@ -79,6 +80,25 @@ interface Props {
|
|
|
79
80
|
* @default 'edit'
|
|
80
81
|
*/
|
|
81
82
|
editorMode?: EditorMode;
|
|
83
|
+
/**
|
|
84
|
+
* Lock the editor: the workflow becomes read-only and a banner above the
|
|
85
|
+
* canvas lists the `reasons` and offers the `actions` (buttons the host
|
|
86
|
+
* answers through `onLockAction`). While locked, nothing can change the
|
|
87
|
+
* workflow (canvas, config panels, console, shortcuts, undo) and Save is
|
|
88
|
+
* disabled (a host's own Save action stays enabled; pressing it saves nothing
|
|
89
|
+
* and says the editor is locked); selecting, panning, zooming and inspecting
|
|
90
|
+
* still work. `null`
|
|
91
|
+
* removes the lock. Seeds `instance.lock`, which holds it afterwards
|
|
92
|
+
* (`instance.lock.set(...)`); passing a different value later sets it
|
|
93
|
+
* again, passing the same one does not. Unset, nothing changes.
|
|
94
|
+
*/
|
|
95
|
+
lock?: EditorLock | null;
|
|
96
|
+
/**
|
|
97
|
+
* Called with the action's `id` when a person presses a button on the lock
|
|
98
|
+
* banner. The host decides what it does; an "Edit" action is answered by
|
|
99
|
+
* removing the lock.
|
|
100
|
+
*/
|
|
101
|
+
onLockAction?: (id: string) => void;
|
|
82
102
|
/**
|
|
83
103
|
* Called when the Edit | Test mode changes after mount (the canvas toolbar switch,
|
|
84
104
|
* the T shortcut, the run pill's "Open", `instance.editorMode.set`). Not called for the
|
|
@@ -98,6 +118,8 @@ interface Props {
|
|
|
98
118
|
refreshTrigger?: number;
|
|
99
119
|
/** Custom navbar title */
|
|
100
120
|
navbarTitle?: string;
|
|
121
|
+
/** Heading level of the navbar title: 1 renders it as the page's H1 (default 2) */
|
|
122
|
+
navbarTitleLevel?: 1 | 2;
|
|
101
123
|
/** Custom navbar actions */
|
|
102
124
|
navbarActions?: NavbarAction[];
|
|
103
125
|
/** White-label logo for the navbar (replaces the FlowDrop wordmark) */
|
|
@@ -124,6 +146,15 @@ interface Props {
|
|
|
124
146
|
onBeforeSave?: FlowDropEventHandlers['onBeforeSave'];
|
|
125
147
|
/** Called after a successful save. */
|
|
126
148
|
onAfterSave?: FlowDropEventHandlers['onAfterSave'];
|
|
149
|
+
/** Called after a refused save was saved as a copy; replaces following the copy's editor URL. */
|
|
150
|
+
onSavedAsCopy?: FlowDropEventHandlers['onSavedAsCopy'];
|
|
151
|
+
/**
|
|
152
|
+
* Called when the unsaved edits are gone for good: just before the editor
|
|
153
|
+
* follows a saved copy's editor URL (after the workflow is marked saved), or
|
|
154
|
+
* after "Discard my changes" loaded the saved version. The mount API uses it
|
|
155
|
+
* to drop the stored draft.
|
|
156
|
+
*/
|
|
157
|
+
onDiscardDraft?: () => void;
|
|
127
158
|
/** Called when a save fails. */
|
|
128
159
|
onSaveError?: FlowDropEventHandlers['onSaveError'];
|
|
129
160
|
/** Called on any API error — return true to suppress the default toast. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list and the run pill.
|
|
3
|
+
The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list, the Run button and the run pill.
|
|
4
4
|
|
|
5
5
|
Each group draws only when its prop is given. The switch needs `onEditorModeChange`;
|
|
6
6
|
the Runs list needs `showRuns` (the host turns it on in Test mode); the pill shows while the instance has a run.
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
import { getInstance } from '../stores/getInstance.svelte.js';
|
|
17
17
|
import Toolbar from './primitives/Toolbar.svelte';
|
|
18
18
|
import Segmented from './primitives/Segmented.svelte';
|
|
19
|
+
import Icon from '@iconify/svelte';
|
|
20
|
+
import Button from './primitives/Button.svelte';
|
|
19
21
|
import RunBar from './RunBar.svelte';
|
|
20
22
|
import RunsMenu from './RunsMenu.svelte';
|
|
23
|
+
import { expandAdminUrl } from '../utils/runsList.js';
|
|
21
24
|
|
|
22
25
|
interface Props {
|
|
23
26
|
/** Current editor mode. */
|
|
@@ -28,6 +31,10 @@
|
|
|
28
31
|
onOpenTest?: () => void;
|
|
29
32
|
/** Take a failed run to the Assistant (the pill's "Ask the Assistant"). */
|
|
30
33
|
onAskAssistant?: (runId: string) => void;
|
|
34
|
+
/** Start the workflow. The Run button is drawn in Edit mode only, and only when this is set. */
|
|
35
|
+
onRun?: () => void;
|
|
36
|
+
/** A run is being started (saving, or waiting for the server): the button spins and blocks. */
|
|
37
|
+
runBusy?: boolean;
|
|
31
38
|
/** Show the run pill while a run exists. @default true */
|
|
32
39
|
showRun?: boolean;
|
|
33
40
|
/** Show the Runs list (Test mode's past runs). The host decides when. @default false */
|
|
@@ -41,6 +48,8 @@
|
|
|
41
48
|
onEditorModeChange,
|
|
42
49
|
onOpenTest,
|
|
43
50
|
onAskAssistant,
|
|
51
|
+
onRun,
|
|
52
|
+
runBusy = false,
|
|
44
53
|
showRun = true,
|
|
45
54
|
showRuns = false,
|
|
46
55
|
adminLinks
|
|
@@ -56,7 +65,15 @@
|
|
|
56
65
|
]);
|
|
57
66
|
|
|
58
67
|
// Drawn when it has controls; a pill-only host gets the toolbar while a run exists.
|
|
59
|
-
const
|
|
68
|
+
const runMsgs = $derived(getMsgs().runButton);
|
|
69
|
+
const runOffered = $derived(!!onRun && editorMode === 'edit' && !fd.runs.isLive);
|
|
70
|
+
const runLink = $derived(
|
|
71
|
+
expandAdminUrl(adminLinks?.run, {
|
|
72
|
+
workflowId: fd.workflow.current?.id,
|
|
73
|
+
pipelineId: fd.runs.activeRun?.runId ?? undefined
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
const drawn = $derived(!!onEditorModeChange || !!onRun || (showRun && !!fd.runs.activeRun));
|
|
60
77
|
</script>
|
|
61
78
|
|
|
62
79
|
{#if drawn}
|
|
@@ -75,8 +92,28 @@
|
|
|
75
92
|
{#if showRuns}
|
|
76
93
|
<RunsMenu {adminLinks} />
|
|
77
94
|
{/if}
|
|
95
|
+
{#if runOffered}
|
|
96
|
+
<Button
|
|
97
|
+
variant="secondary"
|
|
98
|
+
size="md"
|
|
99
|
+
data-testid="canvas-run"
|
|
100
|
+
title={runMsgs.title}
|
|
101
|
+
loading={runBusy}
|
|
102
|
+
onclick={() => onRun?.()}
|
|
103
|
+
>
|
|
104
|
+
{#snippet leadingIcon()}
|
|
105
|
+
<Icon icon="mdi:play" aria-hidden="true" />
|
|
106
|
+
{/snippet}
|
|
107
|
+
{runMsgs.label}
|
|
108
|
+
</Button>
|
|
109
|
+
{/if}
|
|
78
110
|
{#if showRun}
|
|
79
|
-
<RunBar
|
|
111
|
+
<RunBar
|
|
112
|
+
mode={editorMode}
|
|
113
|
+
{onAskAssistant}
|
|
114
|
+
onOpen={onOpenTest}
|
|
115
|
+
runLink={runLink ?? undefined}
|
|
116
|
+
/>
|
|
80
117
|
{/if}
|
|
81
118
|
</Toolbar>
|
|
82
119
|
</div>
|
|
@@ -8,6 +8,10 @@ interface Props {
|
|
|
8
8
|
onOpenTest?: () => void;
|
|
9
9
|
/** Take a failed run to the Assistant (the pill's "Ask the Assistant"). */
|
|
10
10
|
onAskAssistant?: (runId: string) => void;
|
|
11
|
+
/** Start the workflow. The Run button is drawn in Edit mode only, and only when this is set. */
|
|
12
|
+
onRun?: () => void;
|
|
13
|
+
/** A run is being started (saving, or waiting for the server): the button spins and blocks. */
|
|
14
|
+
runBusy?: boolean;
|
|
11
15
|
/** Show the run pill while a run exists. @default true */
|
|
12
16
|
showRun?: boolean;
|
|
13
17
|
/** Show the Runs list (Test mode's past runs). The host decides when. @default false */
|
|
@@ -19,7 +23,7 @@ interface Props {
|
|
|
19
23
|
};
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
|
-
* The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list and the run pill.
|
|
26
|
+
* The floating toolbar in the top-left corner of the canvas: the Edit | Test switch, the Runs list, the Run button and the run pill.
|
|
23
27
|
*
|
|
24
28
|
* Each group draws only when its prop is given. The switch needs `onEditorModeChange`;
|
|
25
29
|
* the Runs list needs `showRuns` (the host turns it on in Test mode); the pill shows while the instance has a run.
|
|
@@ -37,8 +37,14 @@
|
|
|
37
37
|
|
|
38
38
|
const { portName, fromInput, groups, checker, x, y, onselect, onclose }: Props = $props();
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Element that had focus when the picker opened; focus returns there when it closes.
|
|
42
|
+
* Read when the component is created: the list takes focus as it mounts, before the popover attachment runs.
|
|
43
|
+
*/
|
|
44
|
+
let previouslyFocused: HTMLElement | null =
|
|
45
|
+
typeof document !== 'undefined' && document.activeElement instanceof HTMLElement
|
|
46
|
+
? document.activeElement
|
|
47
|
+
: null;
|
|
42
48
|
|
|
43
49
|
function restoreFocus(): void {
|
|
44
50
|
if (previouslyFocused && previouslyFocused.isConnected) {
|
|
@@ -53,8 +59,6 @@
|
|
|
53
59
|
|
|
54
60
|
/** Opening, once: remember the focus, show the popover, wire the dismissals a manual popover does not do itself. */
|
|
55
61
|
const open: Attachment<HTMLDivElement> = (el) => {
|
|
56
|
-
previouslyFocused =
|
|
57
|
-
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
58
62
|
// Optional: jsdom has no Popover API.
|
|
59
63
|
el.showPopover?.();
|
|
60
64
|
// The list asks for focus when it mounts, but a manual popover is not
|
|
@@ -35,7 +35,12 @@
|
|
|
35
35
|
const msgs = $derived(getMsgs().doctor);
|
|
36
36
|
|
|
37
37
|
const problems = $derived(fd.doctor.problems);
|
|
38
|
-
const
|
|
38
|
+
const status = $derived(fd.doctor.status);
|
|
39
|
+
/** A check that is still running after 600 ms: quick checks stay invisible. */
|
|
40
|
+
let showChecking = $state(false);
|
|
41
|
+
const hasProblems = $derived(problems.length > 0);
|
|
42
|
+
const failed = $derived(status === 'error');
|
|
43
|
+
const visible = $derived(fd.doctor.supported && (hasProblems || showChecking || failed));
|
|
39
44
|
const worst = $derived<DoctorSeverity>(
|
|
40
45
|
problems.some((p) => p.severity === 'error')
|
|
41
46
|
? 'error'
|
|
@@ -64,6 +69,15 @@
|
|
|
64
69
|
if (returnFocus) rootEl?.querySelector<HTMLElement>('.fd-doctor__trigger')?.focus();
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
$effect(() => {
|
|
73
|
+
if (status !== 'checking') {
|
|
74
|
+
showChecking = false;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const timer = setTimeout(() => (showChecking = true), 600);
|
|
78
|
+
return () => clearTimeout(timer);
|
|
79
|
+
});
|
|
80
|
+
|
|
67
81
|
// The last problem was fixed: nothing left to show.
|
|
68
82
|
$effect(() => {
|
|
69
83
|
if (!visible && untrack(() => open)) close(false);
|
|
@@ -135,148 +149,187 @@
|
|
|
135
149
|
: msgs.notice[notice.kind];
|
|
136
150
|
}
|
|
137
151
|
|
|
152
|
+
const liveText = $derived(
|
|
153
|
+
!hasProblems && showChecking ? msgs.checking : !hasProblems && failed ? msgs.unavailable : ''
|
|
154
|
+
);
|
|
138
155
|
const notice = $derived(noticeText());
|
|
139
156
|
const busy = $derived(fd.doctor.applyingId !== null);
|
|
140
157
|
</script>
|
|
141
158
|
|
|
142
|
-
{#
|
|
143
|
-
<
|
|
159
|
+
{#snippet unavailableStatus()}
|
|
160
|
+
<span class="fd-doctor__status" data-testid="doctor-unavailable" title={msgs.unavailableTitle}>
|
|
161
|
+
{msgs.unavailable}
|
|
144
162
|
<Button
|
|
145
163
|
variant="ghost"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
aria-expanded={open}
|
|
150
|
-
aria-controls={open ? popoverId : undefined}
|
|
151
|
-
title={msgs.triggerTitle}
|
|
152
|
-
data-testid="doctor-trigger"
|
|
153
|
-
data-severity={worst}
|
|
154
|
-
onclick={() => (open ? close(false) : (open = true))}
|
|
164
|
+
size="sm"
|
|
165
|
+
data-testid="doctor-retry"
|
|
166
|
+
onclick={() => void fd.doctor.diagnoseNow()}
|
|
155
167
|
>
|
|
156
|
-
{
|
|
157
|
-
{msgs.trigger({ count: problems.length })}
|
|
168
|
+
{msgs.retry}
|
|
158
169
|
</Button>
|
|
170
|
+
</span>
|
|
171
|
+
{/snippet}
|
|
172
|
+
|
|
173
|
+
<!-- Always mounted, so a change of its text is announced even when the indicator appears with it. -->
|
|
174
|
+
<span class="fd-doctor__live" role="status" aria-live="polite">{liveText}</span>
|
|
159
175
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
{#if visible}
|
|
177
|
+
<div class="fd-doctor" bind:this={rootEl} onkeydown={onKeydown} role="presentation">
|
|
178
|
+
{#if !hasProblems && showChecking}
|
|
179
|
+
<span class="fd-doctor__status" data-testid="doctor-checking" aria-hidden="true">
|
|
180
|
+
<Icon icon="mdi:loading" class="fd-doctor__spinner" />
|
|
181
|
+
{msgs.checking}
|
|
182
|
+
</span>
|
|
183
|
+
{:else if !hasProblems && failed}
|
|
184
|
+
{@render unavailableStatus()}
|
|
185
|
+
{/if}
|
|
186
|
+
{#if hasProblems}
|
|
187
|
+
<Button
|
|
188
|
+
variant="ghost"
|
|
189
|
+
class="fd-doctor__trigger fd-doctor__trigger--{worst} {open
|
|
190
|
+
? 'fd-doctor__trigger--open'
|
|
191
|
+
: ''}"
|
|
192
|
+
aria-expanded={open}
|
|
193
|
+
aria-controls={open ? popoverId : undefined}
|
|
194
|
+
title={msgs.triggerTitle}
|
|
195
|
+
data-testid="doctor-trigger"
|
|
196
|
+
data-severity={worst}
|
|
197
|
+
onclick={() => (open ? close(false) : (open = true))}
|
|
167
198
|
>
|
|
168
|
-
{#
|
|
169
|
-
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
variant="secondary"
|
|
223
|
-
size="sm"
|
|
224
|
-
disabled={busy}
|
|
225
|
-
loading={fd.doctor.applyingId === problem.id}
|
|
226
|
-
title={remedy.description}
|
|
227
|
-
data-testid="doctor-remedy"
|
|
228
|
-
data-remedy={remedy.id}
|
|
229
|
-
onclick={() => choose(problem, remedy)}
|
|
230
|
-
>
|
|
231
|
-
{remedy.label}
|
|
232
|
-
</Button>
|
|
233
|
-
{/each}
|
|
234
|
-
</div>
|
|
235
|
-
{/if}
|
|
236
|
-
{#if asking && askedRemedy}
|
|
237
|
-
{@const choices = choicesOf(askedRemedy)}
|
|
238
|
-
<div class="fd-doctor__ask" data-testid="doctor-ask">
|
|
239
|
-
{#if choices}
|
|
240
|
-
<Select
|
|
241
|
-
size="sm"
|
|
242
|
-
options={choices}
|
|
243
|
-
value={asking.choice}
|
|
244
|
-
placeholder={msgs.choosePlaceholder}
|
|
245
|
-
aria-label={msgs.chooseLabel}
|
|
246
|
-
data-testid="doctor-choice"
|
|
247
|
-
onValueChange={(value) => {
|
|
248
|
-
if (pending) pending = { ...pending, choice: value };
|
|
249
|
-
}}
|
|
250
|
-
/>
|
|
251
|
-
{/if}
|
|
252
|
-
{#if askedRemedy.destructive}
|
|
253
|
-
<span class="fd-doctor__confirm">{msgs.confirm}</span>
|
|
254
|
-
{/if}
|
|
255
|
-
<span class="fd-doctor__ask-actions">
|
|
256
|
-
<Button
|
|
257
|
-
variant={askedRemedy.destructive ? 'danger' : 'primary'}
|
|
258
|
-
size="sm"
|
|
259
|
-
disabled={busy || (!!choices && !asking.choice)}
|
|
260
|
-
data-testid="doctor-confirm"
|
|
261
|
-
onclick={() => void run(problem, askedRemedy, asking.choice)}
|
|
262
|
-
>
|
|
263
|
-
{msgs.confirmApply}
|
|
264
|
-
</Button>
|
|
199
|
+
{#snippet leadingIcon()}
|
|
200
|
+
{#if showChecking}
|
|
201
|
+
<Icon icon="mdi:loading" class="fd-doctor__spinner" />
|
|
202
|
+
{:else}
|
|
203
|
+
<Icon icon={ICONS[worst]} />
|
|
204
|
+
{/if}
|
|
205
|
+
{/snippet}
|
|
206
|
+
{msgs.trigger({ count: problems.length })}
|
|
207
|
+
</Button>
|
|
208
|
+
{#if failed}
|
|
209
|
+
{@render unavailableStatus()}
|
|
210
|
+
{/if}
|
|
211
|
+
|
|
212
|
+
{#if open}
|
|
213
|
+
<div
|
|
214
|
+
class="fd-doctor__popover"
|
|
215
|
+
id={popoverId}
|
|
216
|
+
role="region"
|
|
217
|
+
aria-label={msgs.title}
|
|
218
|
+
data-testid="doctor-popover"
|
|
219
|
+
>
|
|
220
|
+
{#if notice}
|
|
221
|
+
<div class="fd-doctor__notice" data-testid="doctor-notice">
|
|
222
|
+
<Notice
|
|
223
|
+
tone={fd.doctor.notice?.kind === 'failed' ? 'error' : 'info'}
|
|
224
|
+
ondismiss={() => fd.doctor.dismissNotice()}
|
|
225
|
+
dismissLabel={msgs.dismissNotice}
|
|
226
|
+
>
|
|
227
|
+
{notice}
|
|
228
|
+
</Notice>
|
|
229
|
+
</div>
|
|
230
|
+
{/if}
|
|
231
|
+
<ul class="fd-doctor__list" aria-label={msgs.listLabel}>
|
|
232
|
+
{#each problems as problem (problem.id)}
|
|
233
|
+
{@const name = nodeName(problem)}
|
|
234
|
+
{@const asking = pending?.problemId === problem.id ? pending : null}
|
|
235
|
+
{@const askedRemedy = asking
|
|
236
|
+
? problem.remedies.find((r) => r.id === asking.remedyId)
|
|
237
|
+
: undefined}
|
|
238
|
+
{@const single =
|
|
239
|
+
canApply &&
|
|
240
|
+
problem.remedies.length === 1 &&
|
|
241
|
+
!asking &&
|
|
242
|
+
!choicesOf(problem.remedies[0])}
|
|
243
|
+
<li
|
|
244
|
+
class="fd-doctor__row fd-doctor__row--{problem.severity}"
|
|
245
|
+
data-testid="doctor-problem"
|
|
246
|
+
data-code={problem.code}
|
|
247
|
+
data-severity={problem.severity}
|
|
248
|
+
>
|
|
249
|
+
<span class="fd-doctor__dot" role="img" aria-label={msgs.severity[problem.severity]}
|
|
250
|
+
></span>
|
|
251
|
+
<div class="fd-doctor__text">
|
|
252
|
+
{#if name && problem.node}
|
|
265
253
|
<Button
|
|
266
254
|
variant="ghost"
|
|
267
255
|
size="sm"
|
|
268
|
-
|
|
269
|
-
|
|
256
|
+
class="fd-doctor__node"
|
|
257
|
+
title={msgs.selectNode({ name })}
|
|
258
|
+
data-testid="doctor-node-link"
|
|
259
|
+
onclick={() => fd.doctor.focusNode(problem.node!)}
|
|
270
260
|
>
|
|
271
|
-
{
|
|
261
|
+
{name}
|
|
272
262
|
</Button>
|
|
263
|
+
{:else}
|
|
264
|
+
<span class="fd-doctor__node-plain">{msgs.workflowWide}</span>
|
|
265
|
+
{/if}
|
|
266
|
+
<span class="fd-doctor__message">
|
|
267
|
+
{problem.message}
|
|
273
268
|
</span>
|
|
274
269
|
</div>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
270
|
+
{#if canApply && problem.remedies.length > 0 && !asking}
|
|
271
|
+
<div class="fd-doctor__actions" class:fd-doctor__actions--side={single}>
|
|
272
|
+
{#each problem.remedies as remedy (remedy.id)}
|
|
273
|
+
<Button
|
|
274
|
+
variant="secondary"
|
|
275
|
+
size="sm"
|
|
276
|
+
disabled={busy}
|
|
277
|
+
loading={fd.doctor.applyingId === problem.id}
|
|
278
|
+
title={remedy.description}
|
|
279
|
+
data-testid="doctor-remedy"
|
|
280
|
+
data-remedy={remedy.id}
|
|
281
|
+
onclick={() => choose(problem, remedy)}
|
|
282
|
+
>
|
|
283
|
+
{remedy.label}
|
|
284
|
+
</Button>
|
|
285
|
+
{/each}
|
|
286
|
+
</div>
|
|
287
|
+
{/if}
|
|
288
|
+
{#if asking && askedRemedy}
|
|
289
|
+
{@const choices = choicesOf(askedRemedy)}
|
|
290
|
+
<div class="fd-doctor__ask" data-testid="doctor-ask">
|
|
291
|
+
{#if choices}
|
|
292
|
+
<Select
|
|
293
|
+
size="sm"
|
|
294
|
+
options={choices}
|
|
295
|
+
value={asking.choice}
|
|
296
|
+
placeholder={msgs.choosePlaceholder}
|
|
297
|
+
aria-label={msgs.chooseLabel}
|
|
298
|
+
data-testid="doctor-choice"
|
|
299
|
+
onValueChange={(value) => {
|
|
300
|
+
if (pending) pending = { ...pending, choice: value };
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
303
|
+
{/if}
|
|
304
|
+
{#if askedRemedy.destructive}
|
|
305
|
+
<span class="fd-doctor__confirm">{msgs.confirm}</span>
|
|
306
|
+
{/if}
|
|
307
|
+
<span class="fd-doctor__ask-actions">
|
|
308
|
+
<Button
|
|
309
|
+
variant={askedRemedy.destructive ? 'danger' : 'primary'}
|
|
310
|
+
size="sm"
|
|
311
|
+
disabled={busy || (!!choices && !asking.choice)}
|
|
312
|
+
data-testid="doctor-confirm"
|
|
313
|
+
onclick={() => void run(problem, askedRemedy, asking.choice)}
|
|
314
|
+
>
|
|
315
|
+
{msgs.confirmApply}
|
|
316
|
+
</Button>
|
|
317
|
+
<Button
|
|
318
|
+
variant="ghost"
|
|
319
|
+
size="sm"
|
|
320
|
+
data-testid="doctor-cancel"
|
|
321
|
+
onclick={() => (pending = null)}
|
|
322
|
+
>
|
|
323
|
+
{msgs.confirmCancel}
|
|
324
|
+
</Button>
|
|
325
|
+
</span>
|
|
326
|
+
</div>
|
|
327
|
+
{/if}
|
|
328
|
+
</li>
|
|
329
|
+
{/each}
|
|
330
|
+
</ul>
|
|
331
|
+
</div>
|
|
332
|
+
{/if}
|
|
280
333
|
{/if}
|
|
281
334
|
</div>
|
|
282
335
|
{/if}
|
|
@@ -304,6 +357,35 @@
|
|
|
304
357
|
color: var(--_c);
|
|
305
358
|
}
|
|
306
359
|
|
|
360
|
+
.fd-doctor__live {
|
|
361
|
+
position: absolute;
|
|
362
|
+
width: 1px;
|
|
363
|
+
height: 1px;
|
|
364
|
+
overflow: hidden;
|
|
365
|
+
clip-path: inset(50%);
|
|
366
|
+
white-space: nowrap;
|
|
367
|
+
}
|
|
368
|
+
.fd-doctor__status {
|
|
369
|
+
display: inline-flex;
|
|
370
|
+
align-items: center;
|
|
371
|
+
gap: var(--fd-space-xs);
|
|
372
|
+
color: var(--fd-muted-foreground);
|
|
373
|
+
font-size: var(--fd-text-sm);
|
|
374
|
+
}
|
|
375
|
+
.fd-doctor :global(.fd-doctor__spinner) {
|
|
376
|
+
animation: fd-doctor-spin 1s linear infinite;
|
|
377
|
+
}
|
|
378
|
+
@keyframes fd-doctor-spin {
|
|
379
|
+
to {
|
|
380
|
+
transform: rotate(360deg);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
@media (prefers-reduced-motion: reduce) {
|
|
384
|
+
.fd-doctor :global(.fd-doctor__spinner) {
|
|
385
|
+
animation: none;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
307
389
|
.fd-doctor__popover {
|
|
308
390
|
position: absolute;
|
|
309
391
|
top: calc(100% + var(--fd-space-xs));
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* ignored.
|
|
20
20
|
*/
|
|
21
21
|
toFlowPosition: (point: { x: number; y: number }) => { x: number; y: number } | null;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a drop may change the workflow. When false, drops are swallowed
|
|
24
|
+
* (so the browser does not open a dropped file) and nothing is reported.
|
|
25
|
+
*/
|
|
26
|
+
editable?: boolean;
|
|
22
27
|
children: Snippet;
|
|
23
28
|
}
|
|
24
29
|
|
|
@@ -30,7 +35,7 @@
|
|
|
30
35
|
function handleDragOver(e: DragEvent): void {
|
|
31
36
|
e.preventDefault();
|
|
32
37
|
if (e.dataTransfer) {
|
|
33
|
-
e.dataTransfer.dropEffect = 'copy';
|
|
38
|
+
e.dataTransfer.dropEffect = props.editable === false ? 'none' : 'copy';
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -43,6 +48,7 @@
|
|
|
43
48
|
*/
|
|
44
49
|
function handleDrop(e: DragEvent): void {
|
|
45
50
|
e.preventDefault();
|
|
51
|
+
if (props.editable === false) return;
|
|
46
52
|
|
|
47
53
|
// Check if the drop contains files (e.g. a workflow JSON file from the OS)
|
|
48
54
|
const files = e.dataTransfer?.files;
|
|
@@ -18,6 +18,11 @@ interface Props {
|
|
|
18
18
|
x: number;
|
|
19
19
|
y: number;
|
|
20
20
|
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a drop may change the workflow. When false, drops are swallowed
|
|
23
|
+
* (so the browser does not open a dropped file) and nothing is reported.
|
|
24
|
+
*/
|
|
25
|
+
editable?: boolean;
|
|
21
26
|
children: Snippet;
|
|
22
27
|
}
|
|
23
28
|
declare const FlowDropZone: import("svelte").Component<Props, {}, "">;
|