@burdenoff/fluidgrids-fe-sdk 2026.1028.2 → 2026.1028.4
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/dist/{ExecutionDetailPage-HABRXBRK.js → ExecutionDetailPage-MYBCDBV7.js} +2 -2
- package/dist/{WorkflowBuilder-UB2UBM67.js → WorkflowBuilder-2UHPYNQI.js} +3 -3
- package/dist/{chunk-ZWLEOEIP.js → chunk-CPEIOFYR.js} +2 -396
- package/dist/{chunk-DOND37UH.js → chunk-DB23N7KO.js} +1 -1
- package/dist/chunk-JAKWVVVQ.js +549 -0
- package/dist/{chunk-227PQY53.js → chunk-JH6YDVT5.js} +193 -303
- package/dist/{chunk-JUAR3ALN.js → chunk-SRZITTB2.js} +1 -1
- package/dist/{chunk-I2AS4KDG.js → chunk-ZF55RVJ3.js} +1 -1
- package/dist/executions.js +2 -2
- package/dist/index.js +12 -12
- package/dist/templates.js +3 -3
- package/dist/workflow-builder.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-MODO24HY.js +0 -129
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import { useEntityTags, useTagEntity, useUntagEntity } from './chunk-QGXA2USP.js';
|
|
2
|
+
import { throwIfResultError } from './chunk-5LKZ4PNK.js';
|
|
3
|
+
import { getFluidGridsConfig } from './chunk-CY6KX4RG.js';
|
|
4
|
+
import { WorkflowProposalDocument, ProposeRunFixDocument, ProposeWorkflowChangeDocument, ApplyWorkflowProposalDocument, RejectWorkflowProposalDocument, CancelWorkflowProposalDocument } from './chunk-JBLYBD2B.js';
|
|
5
|
+
import { useTr } from './chunk-UULVIT25.js';
|
|
6
|
+
import { getFluidGridsClient } from './chunk-NTWG3CJX.js';
|
|
7
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
8
|
+
import { TagBadge, TagsWidget } from '@burdenoff/fe-libs/tag';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
import { Icon } from '@iconify/react';
|
|
11
|
+
import { Badge, Button } from '@burdenoff/fe-libs/ui';
|
|
12
|
+
|
|
13
|
+
function toTagItem(assignment) {
|
|
14
|
+
return {
|
|
15
|
+
id: assignment.tagId,
|
|
16
|
+
key: assignment.tagInfo?.key ?? assignment.tagId,
|
|
17
|
+
label: assignment.tagInfo?.label ?? assignment.tagInfo?.key ?? "Tag",
|
|
18
|
+
color: assignment.tagInfo?.color ?? null
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function EntityTagPicker({
|
|
22
|
+
entityType,
|
|
23
|
+
entityId,
|
|
24
|
+
onDraftChange,
|
|
25
|
+
readOnly = false,
|
|
26
|
+
onChange,
|
|
27
|
+
className
|
|
28
|
+
}) {
|
|
29
|
+
const draftMode = !entityId;
|
|
30
|
+
const { workspaceId } = getFluidGridsConfig();
|
|
31
|
+
const { tags: assignments, refetch } = useEntityTags(entityType, entityId);
|
|
32
|
+
const tagEntity = useTagEntity();
|
|
33
|
+
const untagEntity = useUntagEntity();
|
|
34
|
+
const [current, setCurrent] = useState([]);
|
|
35
|
+
const currentRef = useRef([]);
|
|
36
|
+
const assignmentKey = assignments.map((a) => a.tagId).join("|");
|
|
37
|
+
const syncedKey = useRef(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (draftMode || syncedKey.current === assignmentKey) return;
|
|
40
|
+
syncedKey.current = assignmentKey;
|
|
41
|
+
const synced = assignments.map(toTagItem);
|
|
42
|
+
currentRef.current = synced;
|
|
43
|
+
setCurrent(synced);
|
|
44
|
+
}, [assignmentKey, assignments, draftMode]);
|
|
45
|
+
const handleAdd = useCallback(
|
|
46
|
+
async (tag) => {
|
|
47
|
+
if (currentRef.current.some((t) => t.id === tag.id)) return;
|
|
48
|
+
const next = [...currentRef.current, tag];
|
|
49
|
+
currentRef.current = next;
|
|
50
|
+
setCurrent(next);
|
|
51
|
+
if (draftMode) {
|
|
52
|
+
onDraftChange?.(next.map((t) => t.id));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await tagEntity(entityType, entityId, tag.id);
|
|
57
|
+
await refetch();
|
|
58
|
+
onChange?.();
|
|
59
|
+
} catch {
|
|
60
|
+
const rolledBack = currentRef.current.filter((t) => t.id !== tag.id);
|
|
61
|
+
currentRef.current = rolledBack;
|
|
62
|
+
setCurrent(rolledBack);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[
|
|
66
|
+
draftMode,
|
|
67
|
+
entityId,
|
|
68
|
+
entityType,
|
|
69
|
+
onChange,
|
|
70
|
+
onDraftChange,
|
|
71
|
+
refetch,
|
|
72
|
+
tagEntity
|
|
73
|
+
]
|
|
74
|
+
);
|
|
75
|
+
const handleRemove = useCallback(
|
|
76
|
+
async (tagId) => {
|
|
77
|
+
const removed = currentRef.current.find((t) => t.id === tagId);
|
|
78
|
+
const next = currentRef.current.filter((t) => t.id !== tagId);
|
|
79
|
+
currentRef.current = next;
|
|
80
|
+
setCurrent(next);
|
|
81
|
+
if (draftMode) {
|
|
82
|
+
onDraftChange?.(next.map((t) => t.id));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
await untagEntity(entityType, entityId, tagId);
|
|
87
|
+
await refetch();
|
|
88
|
+
onChange?.();
|
|
89
|
+
} catch {
|
|
90
|
+
if (removed) {
|
|
91
|
+
const rolledBack = [...currentRef.current, removed];
|
|
92
|
+
currentRef.current = rolledBack;
|
|
93
|
+
setCurrent(rolledBack);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
[
|
|
98
|
+
draftMode,
|
|
99
|
+
entityId,
|
|
100
|
+
entityType,
|
|
101
|
+
onChange,
|
|
102
|
+
onDraftChange,
|
|
103
|
+
refetch,
|
|
104
|
+
untagEntity
|
|
105
|
+
]
|
|
106
|
+
);
|
|
107
|
+
if (readOnly) {
|
|
108
|
+
if (current.length === 0) return null;
|
|
109
|
+
return /* @__PURE__ */ jsx("div", { className: `flex flex-wrap items-center gap-1 ${className ?? ""}`, children: current.map((tag) => /* @__PURE__ */ jsx(
|
|
110
|
+
TagBadge,
|
|
111
|
+
{
|
|
112
|
+
id: tag.id,
|
|
113
|
+
label: tag.label,
|
|
114
|
+
color: tag.color ?? void 0,
|
|
115
|
+
size: "sm"
|
|
116
|
+
},
|
|
117
|
+
tag.id
|
|
118
|
+
)) });
|
|
119
|
+
}
|
|
120
|
+
return /* @__PURE__ */ jsx(
|
|
121
|
+
TagsWidget,
|
|
122
|
+
{
|
|
123
|
+
entityType,
|
|
124
|
+
entityId: entityId ?? "",
|
|
125
|
+
workspaceId: workspaceId || void 0,
|
|
126
|
+
tags: current,
|
|
127
|
+
onAdd: handleAdd,
|
|
128
|
+
onRemove: handleRemove,
|
|
129
|
+
syncGraphNotifications: !draftMode,
|
|
130
|
+
className
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
var PROPOSAL_POLL_INTERVAL_MS = 3e3;
|
|
135
|
+
var PROPOSAL_MAX_WAIT_MS = 6 * 60 * 1e3;
|
|
136
|
+
function messageOf(error) {
|
|
137
|
+
return error instanceof Error ? error.message : String(error);
|
|
138
|
+
}
|
|
139
|
+
function isProposalRunning(status) {
|
|
140
|
+
return status === "PROCESSING";
|
|
141
|
+
}
|
|
142
|
+
function useWorkflowProposal() {
|
|
143
|
+
const [proposal, setProposal] = useState(null);
|
|
144
|
+
const [isWorking, setIsWorking] = useState(false);
|
|
145
|
+
const [isDeciding, setIsDeciding] = useState(false);
|
|
146
|
+
const [error, setError] = useState(null);
|
|
147
|
+
const [timedOut, setTimedOut] = useState(false);
|
|
148
|
+
const runRef = useRef(0);
|
|
149
|
+
const timerRef = useRef(null);
|
|
150
|
+
const clearTimer = useCallback(() => {
|
|
151
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
152
|
+
timerRef.current = null;
|
|
153
|
+
}, []);
|
|
154
|
+
useEffect(
|
|
155
|
+
() => () => {
|
|
156
|
+
runRef.current++;
|
|
157
|
+
clearTimer();
|
|
158
|
+
},
|
|
159
|
+
[clearTimer]
|
|
160
|
+
);
|
|
161
|
+
const reset = useCallback(() => {
|
|
162
|
+
runRef.current++;
|
|
163
|
+
clearTimer();
|
|
164
|
+
setProposal(null);
|
|
165
|
+
setIsWorking(false);
|
|
166
|
+
setIsDeciding(false);
|
|
167
|
+
setError(null);
|
|
168
|
+
setTimedOut(false);
|
|
169
|
+
}, [clearTimer]);
|
|
170
|
+
const poll = useCallback(
|
|
171
|
+
async (run, id, startedAt) => {
|
|
172
|
+
if (run !== runRef.current) return;
|
|
173
|
+
try {
|
|
174
|
+
const result = throwIfResultError(
|
|
175
|
+
await getFluidGridsClient().query({
|
|
176
|
+
query: WorkflowProposalDocument,
|
|
177
|
+
variables: { id },
|
|
178
|
+
fetchPolicy: "network-only"
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
if (run !== runRef.current) return;
|
|
182
|
+
const next = result.data?.workflowProposal ?? null;
|
|
183
|
+
if (next) setProposal(next);
|
|
184
|
+
const status = next ? String(next.status) : void 0;
|
|
185
|
+
if (isProposalRunning(status)) {
|
|
186
|
+
if (Date.now() - startedAt < PROPOSAL_MAX_WAIT_MS) {
|
|
187
|
+
timerRef.current = setTimeout(
|
|
188
|
+
() => void poll(run, id, startedAt),
|
|
189
|
+
PROPOSAL_POLL_INTERVAL_MS
|
|
190
|
+
);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
setTimedOut(true);
|
|
194
|
+
}
|
|
195
|
+
setIsWorking(false);
|
|
196
|
+
} catch (pollError) {
|
|
197
|
+
if (run !== runRef.current) return;
|
|
198
|
+
setError(messageOf(pollError));
|
|
199
|
+
setIsWorking(false);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
[]
|
|
203
|
+
);
|
|
204
|
+
const start = useCallback(
|
|
205
|
+
async (input) => {
|
|
206
|
+
const run = ++runRef.current;
|
|
207
|
+
clearTimer();
|
|
208
|
+
setProposal(null);
|
|
209
|
+
setError(null);
|
|
210
|
+
setTimedOut(false);
|
|
211
|
+
setIsWorking(true);
|
|
212
|
+
try {
|
|
213
|
+
const client = getFluidGridsClient();
|
|
214
|
+
let started;
|
|
215
|
+
if (input.kind === "runFix") {
|
|
216
|
+
const result = throwIfResultError(
|
|
217
|
+
await client.mutate({
|
|
218
|
+
mutation: ProposeRunFixDocument,
|
|
219
|
+
variables: {
|
|
220
|
+
input: {
|
|
221
|
+
runId: input.runId,
|
|
222
|
+
...input.prompt ? { prompt: input.prompt } : {}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
);
|
|
227
|
+
started = result.data?.proposeRunFix;
|
|
228
|
+
} else {
|
|
229
|
+
const result = throwIfResultError(
|
|
230
|
+
await client.mutate({
|
|
231
|
+
mutation: ProposeWorkflowChangeDocument,
|
|
232
|
+
variables: {
|
|
233
|
+
input: {
|
|
234
|
+
prompt: input.prompt,
|
|
235
|
+
...input.workflowKey ? { workflowKey: input.workflowKey } : {},
|
|
236
|
+
...input.baseVersion ? { baseVersion: input.baseVersion } : {},
|
|
237
|
+
...input.template ? { template: input.template } : {}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
);
|
|
242
|
+
started = result.data?.proposeWorkflowChange;
|
|
243
|
+
}
|
|
244
|
+
if (!started?.id) throw new Error("The proposal did not start");
|
|
245
|
+
if (run !== runRef.current) return;
|
|
246
|
+
setProposal(started);
|
|
247
|
+
const id = started.id;
|
|
248
|
+
timerRef.current = setTimeout(
|
|
249
|
+
() => void poll(run, id, Date.now()),
|
|
250
|
+
PROPOSAL_POLL_INTERVAL_MS
|
|
251
|
+
);
|
|
252
|
+
} catch (startError) {
|
|
253
|
+
if (run !== runRef.current) return;
|
|
254
|
+
setError(messageOf(startError));
|
|
255
|
+
setIsWorking(false);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
[clearTimer, poll]
|
|
259
|
+
);
|
|
260
|
+
const decide = useCallback(
|
|
261
|
+
async (action) => {
|
|
262
|
+
const id = proposal?.id;
|
|
263
|
+
if (!id) return null;
|
|
264
|
+
const run = runRef.current;
|
|
265
|
+
setIsDeciding(true);
|
|
266
|
+
setError(null);
|
|
267
|
+
try {
|
|
268
|
+
const client = getFluidGridsClient();
|
|
269
|
+
let next;
|
|
270
|
+
if (action === "apply") {
|
|
271
|
+
const result = throwIfResultError(
|
|
272
|
+
await client.mutate({ mutation: ApplyWorkflowProposalDocument, variables: { id } })
|
|
273
|
+
);
|
|
274
|
+
next = result.data?.applyWorkflowProposal;
|
|
275
|
+
} else if (action === "reject") {
|
|
276
|
+
const result = throwIfResultError(
|
|
277
|
+
await client.mutate({ mutation: RejectWorkflowProposalDocument, variables: { id } })
|
|
278
|
+
);
|
|
279
|
+
next = result.data?.rejectWorkflowProposal;
|
|
280
|
+
} else {
|
|
281
|
+
clearTimer();
|
|
282
|
+
const result = throwIfResultError(
|
|
283
|
+
await client.mutate({ mutation: CancelWorkflowProposalDocument, variables: { id } })
|
|
284
|
+
);
|
|
285
|
+
next = result.data?.cancelWorkflowProposal;
|
|
286
|
+
setIsWorking(false);
|
|
287
|
+
}
|
|
288
|
+
if (run === runRef.current && next) setProposal(next);
|
|
289
|
+
return next ?? null;
|
|
290
|
+
} catch (decideError) {
|
|
291
|
+
if (run === runRef.current) setError(messageOf(decideError));
|
|
292
|
+
return null;
|
|
293
|
+
} finally {
|
|
294
|
+
if (run === runRef.current) setIsDeciding(false);
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
[clearTimer, proposal?.id]
|
|
298
|
+
);
|
|
299
|
+
const apply = useCallback(() => decide("apply"), [decide]);
|
|
300
|
+
const reject = useCallback(async () => {
|
|
301
|
+
await decide("reject");
|
|
302
|
+
}, [decide]);
|
|
303
|
+
const cancel = useCallback(async () => {
|
|
304
|
+
await decide("cancel");
|
|
305
|
+
}, [decide]);
|
|
306
|
+
return {
|
|
307
|
+
proposal,
|
|
308
|
+
isWorking,
|
|
309
|
+
isDeciding,
|
|
310
|
+
error,
|
|
311
|
+
timedOut,
|
|
312
|
+
start,
|
|
313
|
+
apply,
|
|
314
|
+
reject,
|
|
315
|
+
cancel,
|
|
316
|
+
reset
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
var STATUS_TONE = {
|
|
320
|
+
PROCESSING: "secondary",
|
|
321
|
+
PROPOSED: "default",
|
|
322
|
+
APPLIED: "default",
|
|
323
|
+
REJECTED: "outline",
|
|
324
|
+
STALE: "outline",
|
|
325
|
+
CANCELLED: "outline",
|
|
326
|
+
FAILED: "destructive"
|
|
327
|
+
};
|
|
328
|
+
function edgeLabel(edge) {
|
|
329
|
+
const from = edge.sourceHandle ? `${edge.source} (${edge.sourceHandle})` : edge.source;
|
|
330
|
+
return `${from} \u2192 ${edge.target}`;
|
|
331
|
+
}
|
|
332
|
+
function ChangeList({
|
|
333
|
+
title,
|
|
334
|
+
icon,
|
|
335
|
+
items,
|
|
336
|
+
testId
|
|
337
|
+
}) {
|
|
338
|
+
if (items.length === 0) return null;
|
|
339
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": testId, children: [
|
|
340
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-secondary", children: [
|
|
341
|
+
/* @__PURE__ */ jsx(Icon, { icon, width: 14 }),
|
|
342
|
+
title,
|
|
343
|
+
" (",
|
|
344
|
+
items.length,
|
|
345
|
+
")"
|
|
346
|
+
] }),
|
|
347
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-1 space-y-0.5 text-sm text-text-primary", children: items.map((item) => /* @__PURE__ */ jsx("li", { className: "truncate", children: item }, item)) })
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
function nodeLine(node, withFields) {
|
|
351
|
+
const base = `${node.label} \xB7 ${node.type}`;
|
|
352
|
+
return withFields && node.fields.length > 0 ? `${base} \u2014 ${node.fields.join(", ")}` : base;
|
|
353
|
+
}
|
|
354
|
+
function WorkflowProposalCard({
|
|
355
|
+
proposal,
|
|
356
|
+
isDeciding = false,
|
|
357
|
+
onOpenWorkflow,
|
|
358
|
+
onApply,
|
|
359
|
+
onReject,
|
|
360
|
+
onCancel,
|
|
361
|
+
onRevert
|
|
362
|
+
}) {
|
|
363
|
+
const tr = useTr();
|
|
364
|
+
const status = String(proposal.status);
|
|
365
|
+
const diff = proposal.diff;
|
|
366
|
+
const warnings = proposal.validation?.warnings ?? [];
|
|
367
|
+
const errors = proposal.validation?.valid === false ? proposal.validation.errors : [];
|
|
368
|
+
const revertTarget = proposal.baseVersion && proposal.workflowKey && proposal.appliedWorkflowKey === proposal.workflowKey ? { workflowKey: proposal.workflowKey, version: proposal.baseVersion } : null;
|
|
369
|
+
return /* @__PURE__ */ jsxs(
|
|
370
|
+
"section",
|
|
371
|
+
{
|
|
372
|
+
className: "rounded-lg border border-border-secondary bg-background-secondary p-4",
|
|
373
|
+
"data-testid": "workflow-proposal-card",
|
|
374
|
+
"data-status": status,
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-wrap items-center gap-2", children: [
|
|
377
|
+
/* @__PURE__ */ jsx(
|
|
378
|
+
Icon,
|
|
379
|
+
{
|
|
380
|
+
icon: "mdi:creation-outline",
|
|
381
|
+
width: 18,
|
|
382
|
+
className: "text-text-secondary"
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-text-primary", children: proposal.name ?? tr("fluidgrids.ai.proposal.title", "AI proposal") }),
|
|
386
|
+
/* @__PURE__ */ jsx(
|
|
387
|
+
Badge,
|
|
388
|
+
{
|
|
389
|
+
variant: STATUS_TONE[status] ?? "outline",
|
|
390
|
+
"data-testid": "workflow-proposal-status",
|
|
391
|
+
children: status
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
proposal.baseVersion && /* @__PURE__ */ jsx("span", { className: "text-xs text-text-secondary", children: tr(
|
|
395
|
+
"fluidgrids.ai.proposal.against",
|
|
396
|
+
"against version {{version}}",
|
|
397
|
+
{
|
|
398
|
+
version: proposal.baseVersion
|
|
399
|
+
}
|
|
400
|
+
) })
|
|
401
|
+
] }),
|
|
402
|
+
status === "PROCESSING" && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2 text-sm text-text-secondary", children: [
|
|
403
|
+
/* @__PURE__ */ jsx(Icon, { icon: "mdi:loading", width: 16, className: "animate-spin" }),
|
|
404
|
+
tr("fluidgrids.ai.proposal.working", "Working ({{stage}})\u2026", {
|
|
405
|
+
stage: proposal.progress?.stage ?? "prompting"
|
|
406
|
+
}),
|
|
407
|
+
onCancel && /* @__PURE__ */ jsx(
|
|
408
|
+
Button,
|
|
409
|
+
{
|
|
410
|
+
size: "sm",
|
|
411
|
+
variant: "ghost",
|
|
412
|
+
onClick: onCancel,
|
|
413
|
+
disabled: isDeciding,
|
|
414
|
+
children: tr("fluidgrids.ai.proposal.cancel", "Cancel")
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
] }),
|
|
418
|
+
proposal.explanation && /* @__PURE__ */ jsx(
|
|
419
|
+
"p",
|
|
420
|
+
{
|
|
421
|
+
className: "mt-3 text-sm text-text-primary",
|
|
422
|
+
"data-testid": "workflow-proposal-explanation",
|
|
423
|
+
children: proposal.explanation
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
proposal.message && status !== "PROPOSED" && status !== "PROCESSING" && status !== "APPLIED" && /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-text-secondary", children: proposal.message }),
|
|
427
|
+
diff && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2", "data-testid": "workflow-proposal-diff", children: [
|
|
428
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-text-primary", children: diff.summary }),
|
|
429
|
+
/* @__PURE__ */ jsx(
|
|
430
|
+
ChangeList,
|
|
431
|
+
{
|
|
432
|
+
testId: "workflow-proposal-added",
|
|
433
|
+
icon: "mdi:plus-circle-outline",
|
|
434
|
+
title: tr("fluidgrids.ai.proposal.added", "Added nodes"),
|
|
435
|
+
items: diff.addedNodes.map((node) => nodeLine(node, false))
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
/* @__PURE__ */ jsx(
|
|
439
|
+
ChangeList,
|
|
440
|
+
{
|
|
441
|
+
testId: "workflow-proposal-changed",
|
|
442
|
+
icon: "mdi:pencil-circle-outline",
|
|
443
|
+
title: tr("fluidgrids.ai.proposal.changed", "Changed nodes"),
|
|
444
|
+
items: diff.changedNodes.map((node) => nodeLine(node, true))
|
|
445
|
+
}
|
|
446
|
+
),
|
|
447
|
+
/* @__PURE__ */ jsx(
|
|
448
|
+
ChangeList,
|
|
449
|
+
{
|
|
450
|
+
testId: "workflow-proposal-removed",
|
|
451
|
+
icon: "mdi:minus-circle-outline",
|
|
452
|
+
title: tr("fluidgrids.ai.proposal.removed", "Removed nodes"),
|
|
453
|
+
items: diff.removedNodes.map((node) => nodeLine(node, false))
|
|
454
|
+
}
|
|
455
|
+
),
|
|
456
|
+
/* @__PURE__ */ jsx(
|
|
457
|
+
ChangeList,
|
|
458
|
+
{
|
|
459
|
+
testId: "workflow-proposal-edges",
|
|
460
|
+
icon: "mdi:vector-line",
|
|
461
|
+
title: tr(
|
|
462
|
+
"fluidgrids.ai.proposal.connections",
|
|
463
|
+
"Connection changes"
|
|
464
|
+
),
|
|
465
|
+
items: [
|
|
466
|
+
...diff.addedEdges.map((edge) => `+ ${edgeLabel(edge)}`),
|
|
467
|
+
...diff.removedEdges.map((edge) => `\u2212 ${edgeLabel(edge)}`)
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
] }),
|
|
472
|
+
errors.length > 0 && /* @__PURE__ */ jsx("ul", { className: "mt-3 space-y-1 text-sm text-[var(--color-status-error-text)]", children: errors.map((message) => /* @__PURE__ */ jsx("li", { children: message }, message)) }),
|
|
473
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-3", "data-testid": "workflow-proposal-warnings", children: [
|
|
474
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium uppercase tracking-wide text-text-secondary", children: tr("fluidgrids.ai.proposal.todo", "Still to set up") }),
|
|
475
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-1 space-y-0.5 text-sm text-text-secondary", children: warnings.map((warning) => /* @__PURE__ */ jsx("li", { children: warning }, warning)) })
|
|
476
|
+
] }),
|
|
477
|
+
status === "PROPOSED" && (onApply || onReject) && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
|
|
478
|
+
onApply && /* @__PURE__ */ jsx(
|
|
479
|
+
Button,
|
|
480
|
+
{
|
|
481
|
+
size: "sm",
|
|
482
|
+
onClick: onApply,
|
|
483
|
+
disabled: isDeciding,
|
|
484
|
+
"data-testid": "workflow-proposal-apply",
|
|
485
|
+
children: proposal.baseVersion ? tr(
|
|
486
|
+
"fluidgrids.ai.proposal.applyVersion",
|
|
487
|
+
"Apply as a new draft version"
|
|
488
|
+
) : tr(
|
|
489
|
+
"fluidgrids.ai.proposal.applyNew",
|
|
490
|
+
"Create as a draft workflow"
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
onReject && /* @__PURE__ */ jsx(
|
|
495
|
+
Button,
|
|
496
|
+
{
|
|
497
|
+
size: "sm",
|
|
498
|
+
variant: "outline",
|
|
499
|
+
onClick: onReject,
|
|
500
|
+
disabled: isDeciding,
|
|
501
|
+
children: tr("fluidgrids.ai.proposal.reject", "Reject")
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-text-secondary", children: tr(
|
|
505
|
+
"fluidgrids.ai.proposal.neverActivates",
|
|
506
|
+
"Nothing goes live: the result is a draft you can review, run as a test and activate yourself."
|
|
507
|
+
) })
|
|
508
|
+
] }),
|
|
509
|
+
status === "APPLIED" && proposal.appliedWorkflowKey && proposal.appliedVersion && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-2", children: [
|
|
510
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
511
|
+
onOpenWorkflow && /* @__PURE__ */ jsx(
|
|
512
|
+
Button,
|
|
513
|
+
{
|
|
514
|
+
size: "sm",
|
|
515
|
+
variant: "outline",
|
|
516
|
+
"data-testid": "workflow-proposal-open",
|
|
517
|
+
onClick: () => onOpenWorkflow(
|
|
518
|
+
proposal.appliedWorkflowKey ?? "",
|
|
519
|
+
proposal.appliedVersion ?? ""
|
|
520
|
+
),
|
|
521
|
+
children: tr("fluidgrids.ai.proposal.open", "Open draft {{version}}", {
|
|
522
|
+
version: proposal.appliedVersion
|
|
523
|
+
})
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
onRevert && revertTarget && /* @__PURE__ */ jsx(
|
|
527
|
+
Button,
|
|
528
|
+
{
|
|
529
|
+
size: "sm",
|
|
530
|
+
variant: "ghost",
|
|
531
|
+
"data-testid": "workflow-proposal-revert",
|
|
532
|
+
disabled: isDeciding,
|
|
533
|
+
onClick: () => onRevert(revertTarget.workflowKey, revertTarget.version),
|
|
534
|
+
children: tr(
|
|
535
|
+
"fluidgrids.ai.proposal.revert",
|
|
536
|
+
"Revert to {{version}}",
|
|
537
|
+
{ version: revertTarget.version }
|
|
538
|
+
)
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
] }),
|
|
542
|
+
!onRevert && proposal.restoreHint && /* @__PURE__ */ jsx("p", { className: "text-xs text-text-secondary", children: proposal.restoreHint })
|
|
543
|
+
] })
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export { EntityTagPicker, WorkflowProposalCard, useWorkflowProposal };
|