@powerhousedao/workflow 6.2.3-dev.47 → 6.2.3-dev.48
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/browser/{editor-YRMQ2K-6.js → editor-BXxj5Do5.js} +484 -197
- package/dist/browser/editor-BXxj5Do5.js.map +1 -0
- package/dist/browser/{editor-h6Fo7DOI.js → editor-C3l2HgXA.js} +4 -4
- package/dist/browser/{editor-h6Fo7DOI.js.map → editor-C3l2HgXA.js.map} +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/{trigger-text-CmtISlSW.js → trigger-text-Dwaxi16C.js} +34 -1
- package/dist/browser/{trigger-text-CmtISlSW.js.map → trigger-text-Dwaxi16C.js.map} +1 -1
- package/dist/node/{editor-C8kHYBz1.mjs → editor-B4TEgA0j.mjs} +4 -4
- package/dist/node/{editor-C8kHYBz1.mjs.map → editor-B4TEgA0j.mjs.map} +1 -1
- package/dist/node/{editor-CFYv3eBu.mjs → editor-DKpQGzMS.mjs} +484 -197
- package/dist/node/editor-DKpQGzMS.mjs.map +1 -0
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/pieces/reactor/descriptor.json +1 -1
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{trigger-text-CaAEQV69.mjs → trigger-text-qK_Nr5Pw.mjs} +34 -1
- package/dist/node/{trigger-text-CaAEQV69.mjs.map → trigger-text-qK_Nr5Pw.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +1 -1
- package/dist/style.css +130 -25
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts +7 -0
- package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts +31 -0
- package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/chain.d.ts +3 -0
- package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts +5 -0
- package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/browser/editor-YRMQ2K-6.js.map +0 -1
- package/dist/node/editor-CFYv3eBu.mjs.map +0 -1
|
@@ -2,13 +2,52 @@ import { K as CORE_PIECE, it as triggerBlock, l as runsOfPages, nt as stepBlock,
|
|
|
2
2
|
import { y as actions } from "./module-D4UiG9ii.js";
|
|
3
3
|
import { A as runTone, C as formatDuration, D as runStats, E as formatWhen, Et as Select, It as DocumentErrorBoundary, Lt as DocumentLoadError, M as toneOf, N as workflowHealth, Nt as textInputClass, O as runStatusLabel, Pt as Icon, Rt as errorMessage, S as formatAbsolute, T as formatTrigger, _ as RUN_TONE, b as TONE_TEXT, bt as Button, g as RUN_STATUSES, h as CONNECTION_TONE, ht as useRunQuery, j as statusLabel, k as runTimeline, m as usePieceLogos, mt as useRunPagesQuery, t as BlockLogo, u as blockMeta, ut as WorkflowRuntimeProvider, v as STEP_TONE, vt as useRuntimeActions, w as formatMs, x as durationMs, y as TONE_DOT } from "./BlockSelector-Do2fNhEF.js";
|
|
4
4
|
import { r as useWorkflowDocumentsInSelectedDrive } from "./workflow-DFLQ2cFr.js";
|
|
5
|
-
import { a as StepError, f as StatusToggle, i as DataViewer, l as PublishState, o as Modal, r as describeTrigger } from "./trigger-text-
|
|
6
|
-
import { Fragment, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { a as StepError, f as StatusToggle, i as DataViewer, l as PublishState, o as Modal, r as describeTrigger } from "./trigger-text-Dwaxi16C.js";
|
|
6
|
+
import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { generateId } from "document-model";
|
|
9
9
|
import { addDocument, addFolder, deleteNode, setSelectedNode, showDeleteNodeModal, useDispatch, useDocumentSafe, useFileNodesInSelectedDrive, useNodesInSelectedDrive, usePHToast, useSelectedDrive, useSelectedNode, useSetPHAppConfig } from "@powerhousedao/reactor-browser";
|
|
10
10
|
import { addFolder as addFolder$1, moveNode, updateNode } from "@powerhousedao/shared/document-drive";
|
|
11
11
|
import { ConnectTooltip, ConnectTooltipProvider } from "@powerhousedao/design-system/connect";
|
|
12
|
+
//#region editors/workflow-studio/components/step-outline.ts
|
|
13
|
+
function stepOutline(args) {
|
|
14
|
+
const inbound = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const edge of args.edges) {
|
|
16
|
+
const list = inbound.get(edge.to) ?? [];
|
|
17
|
+
list.push(edge);
|
|
18
|
+
inbound.set(edge.to, list);
|
|
19
|
+
}
|
|
20
|
+
const decided = args.triggerId ? [args.triggerId] : [];
|
|
21
|
+
const rows = [];
|
|
22
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23
|
+
const firstDecided = (edges) => edges.reduce((first, edge) => decided.indexOf(edge.from) < decided.indexOf(first.from) ? edge : first);
|
|
24
|
+
let progressed = true;
|
|
25
|
+
while (progressed) {
|
|
26
|
+
progressed = false;
|
|
27
|
+
for (const step of args.steps) {
|
|
28
|
+
if (seen.has(step.id)) continue;
|
|
29
|
+
const edges = inbound.get(step.id) ?? [];
|
|
30
|
+
const entry = !args.triggerId && edges.length === 0;
|
|
31
|
+
if (!entry) {
|
|
32
|
+
if (edges.length === 0) continue;
|
|
33
|
+
if (!edges.every((edge) => decided.includes(edge.from))) continue;
|
|
34
|
+
}
|
|
35
|
+
seen.add(step.id);
|
|
36
|
+
decided.push(step.id);
|
|
37
|
+
const port = entry ? null : firstDecided(edges).port;
|
|
38
|
+
rows.push({
|
|
39
|
+
step,
|
|
40
|
+
port: port === "next" ? null : port
|
|
41
|
+
});
|
|
42
|
+
progressed = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
rows,
|
|
47
|
+
orphans: args.steps.filter((step) => !seen.has(step.id))
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
12
51
|
//#region editors/workflow-studio/components/chain.tsx
|
|
13
52
|
const RING$2 = {
|
|
14
53
|
ok: "ring-wf-ok",
|
|
@@ -78,6 +117,16 @@ function triggerOfKind(kind) {
|
|
|
78
117
|
name: kind
|
|
79
118
|
};
|
|
80
119
|
}
|
|
120
|
+
/** A workflow's steps in the order a run reaches them, coloured by a run. */
|
|
121
|
+
function workflowLinks(workflow, latest) {
|
|
122
|
+
const status = new Map((latest?.steps ?? []).map((step) => [step.stepKey, step.status]));
|
|
123
|
+
return stepOutline(workflow).rows.map(({ step }) => ({
|
|
124
|
+
id: step.id,
|
|
125
|
+
block: stepBlock(step),
|
|
126
|
+
label: step.name || step.key,
|
|
127
|
+
status: status.get(step.key)
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
81
130
|
/** A run's own chain: the trigger, then every step it recorded. */
|
|
82
131
|
function runLinks(run, trigger) {
|
|
83
132
|
return [{
|
|
@@ -1370,42 +1419,78 @@ function useRuns(scope, active = true) {
|
|
|
1370
1419
|
};
|
|
1371
1420
|
}
|
|
1372
1421
|
//#endregion
|
|
1373
|
-
//#region editors/workflow-studio/components/
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
if (!edges.every((edge) => decided.includes(edge.from))) continue;
|
|
1395
|
-
}
|
|
1396
|
-
seen.add(step.id);
|
|
1397
|
-
decided.push(step.id);
|
|
1398
|
-
const port = entry ? null : firstDecided(edges).port;
|
|
1399
|
-
rows.push({
|
|
1400
|
-
step,
|
|
1401
|
-
port: port === "next" ? null : port
|
|
1422
|
+
//#region editors/workflow-studio/components/ScrollFade.tsx
|
|
1423
|
+
const FADE = 40;
|
|
1424
|
+
function fadeMask(start, end) {
|
|
1425
|
+
if (!start && !end) return void 0;
|
|
1426
|
+
return `linear-gradient(to right, ${start ? `transparent, black ${FADE}px` : "black"}, ${end ? `black calc(100% - ${FADE}px), transparent` : "black"})`;
|
|
1427
|
+
}
|
|
1428
|
+
function ScrollFade(props) {
|
|
1429
|
+
const ref = useRef(null);
|
|
1430
|
+
const [edges, setEdges] = useState({
|
|
1431
|
+
start: false,
|
|
1432
|
+
end: false
|
|
1433
|
+
});
|
|
1434
|
+
useEffect(() => {
|
|
1435
|
+
const element = ref.current;
|
|
1436
|
+
if (!element) return;
|
|
1437
|
+
const measure = () => {
|
|
1438
|
+
const start = element.scrollLeft > 1;
|
|
1439
|
+
const end = element.scrollLeft + element.clientWidth < element.scrollWidth - 1;
|
|
1440
|
+
setEdges((prev) => prev.start === start && prev.end === end ? prev : {
|
|
1441
|
+
start,
|
|
1442
|
+
end
|
|
1402
1443
|
});
|
|
1403
|
-
|
|
1404
|
-
|
|
1444
|
+
};
|
|
1445
|
+
measure();
|
|
1446
|
+
const resize = new ResizeObserver(measure);
|
|
1447
|
+
resize.observe(element);
|
|
1448
|
+
if (element.firstElementChild) resize.observe(element.firstElementChild);
|
|
1449
|
+
element.addEventListener("scroll", measure, { passive: true });
|
|
1450
|
+
return () => {
|
|
1451
|
+
resize.disconnect();
|
|
1452
|
+
element.removeEventListener("scroll", measure);
|
|
1453
|
+
};
|
|
1454
|
+
}, []);
|
|
1455
|
+
const mask = fadeMask(edges.start, edges.end);
|
|
1456
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1457
|
+
ref,
|
|
1458
|
+
className: `block ${props.clip ? "overflow-hidden" : "overflow-x-auto"} ${props.className ?? ""}`,
|
|
1459
|
+
style: {
|
|
1460
|
+
maskImage: mask,
|
|
1461
|
+
WebkitMaskImage: mask
|
|
1462
|
+
},
|
|
1463
|
+
children: props.children
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
//#endregion
|
|
1467
|
+
//#region editors/workflow-studio/components/use-collapsed.ts
|
|
1468
|
+
const KEY = "workflow-studio:collapsed";
|
|
1469
|
+
function read() {
|
|
1470
|
+
try {
|
|
1471
|
+
const parsed = JSON.parse(localStorage.getItem(KEY) ?? "[]");
|
|
1472
|
+
return new Set(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string") : []);
|
|
1473
|
+
} catch {
|
|
1474
|
+
return /* @__PURE__ */ new Set();
|
|
1405
1475
|
}
|
|
1476
|
+
}
|
|
1477
|
+
function write(ids) {
|
|
1478
|
+
try {
|
|
1479
|
+
localStorage.setItem(KEY, JSON.stringify([...ids]));
|
|
1480
|
+
} catch {}
|
|
1481
|
+
}
|
|
1482
|
+
function useCollapsed() {
|
|
1483
|
+
const [collapsed, setCollapsed] = useState(read);
|
|
1406
1484
|
return {
|
|
1407
|
-
|
|
1408
|
-
|
|
1485
|
+
isCollapsed: (id) => collapsed.has(id),
|
|
1486
|
+
toggle: useCallback((id) => {
|
|
1487
|
+
setCollapsed((previous) => {
|
|
1488
|
+
const next = new Set(previous);
|
|
1489
|
+
if (!next.delete(id)) next.add(id);
|
|
1490
|
+
write(next);
|
|
1491
|
+
return next;
|
|
1492
|
+
});
|
|
1493
|
+
}, [])
|
|
1409
1494
|
};
|
|
1410
1495
|
}
|
|
1411
1496
|
//#endregion
|
|
@@ -1421,16 +1506,19 @@ function graphLayout(args) {
|
|
|
1421
1506
|
}]]);
|
|
1422
1507
|
const taken = /* @__PURE__ */ new Set();
|
|
1423
1508
|
const inbound = /* @__PURE__ */ new Map();
|
|
1509
|
+
const outbound = /* @__PURE__ */ new Map();
|
|
1424
1510
|
for (const edge of args.edges) {
|
|
1425
1511
|
const list = inbound.get(edge.to) ?? [];
|
|
1426
1512
|
list.push(edge);
|
|
1427
1513
|
inbound.set(edge.to, list);
|
|
1514
|
+
outbound.set(edge.from, (outbound.get(edge.from) ?? 0) + 1);
|
|
1428
1515
|
}
|
|
1516
|
+
const drops = (edge) => SIDE_PORTS.has(edge.port) && (outbound.get(edge.from) ?? 0) > 1;
|
|
1429
1517
|
const nodes = [];
|
|
1430
1518
|
for (const { step } of rows) {
|
|
1431
1519
|
const from = (inbound.get(step.id) ?? []).filter((edge) => placed.has(nodeId(edge.from)));
|
|
1432
1520
|
const col = Math.max(1, ...from.map((edge) => placed.get(nodeId(edge.from)).col + 1));
|
|
1433
|
-
let lane = Math.min(...from.map((edge) => placed.get(nodeId(edge.from)).lane + (
|
|
1521
|
+
let lane = Math.min(...from.map((edge) => placed.get(nodeId(edge.from)).lane + (drops(edge) ? 1 : 0)), from.length === 0 ? 0 : Infinity);
|
|
1434
1522
|
const port = from.length === 1 && from[0].port !== "next" ? from[0].port : null;
|
|
1435
1523
|
while (taken.has(`${col}:${lane}`)) lane++;
|
|
1436
1524
|
taken.add(`${col}:${lane}`);
|
|
@@ -1479,37 +1567,67 @@ function graphLayout(args) {
|
|
|
1479
1567
|
}
|
|
1480
1568
|
//#endregion
|
|
1481
1569
|
//#region editors/workflow-studio/components/WorkflowGraph.tsx
|
|
1570
|
+
const STACK_GAP = 16;
|
|
1571
|
+
const MAX_STRETCH = 1.5;
|
|
1572
|
+
function fitGraph(base, cols, room) {
|
|
1573
|
+
if (!room || room.width <= 0 || cols === 0) return {
|
|
1574
|
+
g: base,
|
|
1575
|
+
stacked: false,
|
|
1576
|
+
perRow: Math.max(cols, 1)
|
|
1577
|
+
};
|
|
1578
|
+
const tailOf = (col) => base.label ? col / 2 : base.r;
|
|
1579
|
+
const span = (n, lead) => lead + (n - 1) * base.col + base.r + tailOf(base.col);
|
|
1580
|
+
const beside = room.width - room.pill;
|
|
1581
|
+
const stacked = span(cols, base.lead) > beside;
|
|
1582
|
+
const lead = stacked ? base.pillLogoX * 2 : base.lead;
|
|
1583
|
+
const space = stacked ? room.width : beside;
|
|
1584
|
+
const fits = Math.floor((space - lead - base.r - tailOf(base.col)) / base.col) + 1;
|
|
1585
|
+
const perRow = stacked ? Math.min(cols, Math.max(2, fits)) : cols;
|
|
1586
|
+
const fill = base.label ? (space - lead - base.r) / (perRow - .5) : perRow > 1 ? (space - lead - 2 * base.r) / (perRow - 1) : base.col;
|
|
1587
|
+
const col = Math.floor(Math.min(base.col * MAX_STRETCH, Math.max(base.col, fill)));
|
|
1588
|
+
return {
|
|
1589
|
+
g: {
|
|
1590
|
+
...base,
|
|
1591
|
+
col,
|
|
1592
|
+
lead
|
|
1593
|
+
},
|
|
1594
|
+
stacked,
|
|
1595
|
+
perRow
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1482
1598
|
const GEOMETRY = {
|
|
1483
1599
|
sm: {
|
|
1484
1600
|
r: 12,
|
|
1485
|
-
col:
|
|
1486
|
-
lane:
|
|
1487
|
-
lead:
|
|
1601
|
+
col: 144,
|
|
1602
|
+
lane: 80,
|
|
1603
|
+
lead: 40,
|
|
1488
1604
|
top: 14,
|
|
1489
|
-
dip:
|
|
1490
|
-
label:
|
|
1605
|
+
dip: 60,
|
|
1606
|
+
label: 34,
|
|
1491
1607
|
subtitle: false,
|
|
1492
|
-
nameText: "text-xs",
|
|
1608
|
+
nameText: "text-xs leading-4",
|
|
1493
1609
|
logo: 14,
|
|
1494
1610
|
circle: "h-6 w-6",
|
|
1495
1611
|
pill: "h-7 pl-1 pr-2.5 text-[12px]",
|
|
1496
1612
|
pillLogo: "h-5 w-5",
|
|
1613
|
+
pillLogoX: 14,
|
|
1497
1614
|
portText: "text-[10px]"
|
|
1498
1615
|
},
|
|
1499
1616
|
md: {
|
|
1500
1617
|
r: 18,
|
|
1501
|
-
col:
|
|
1502
|
-
lane:
|
|
1503
|
-
lead:
|
|
1618
|
+
col: 168,
|
|
1619
|
+
lane: 112,
|
|
1620
|
+
lead: 48,
|
|
1504
1621
|
top: 18,
|
|
1505
|
-
dip:
|
|
1506
|
-
label:
|
|
1622
|
+
dip: 86,
|
|
1623
|
+
label: 54,
|
|
1507
1624
|
subtitle: true,
|
|
1508
|
-
nameText: "text-[13px]",
|
|
1625
|
+
nameText: "text-[13px] leading-[18px]",
|
|
1509
1626
|
logo: 20,
|
|
1510
1627
|
circle: "h-9 w-9",
|
|
1511
1628
|
pill: "h-9 pl-1.5 pr-3 text-[13px]",
|
|
1512
1629
|
pillLogo: "h-6 w-6",
|
|
1630
|
+
pillLogoX: 18,
|
|
1513
1631
|
portText: "text-[11px]"
|
|
1514
1632
|
}
|
|
1515
1633
|
};
|
|
@@ -1529,8 +1647,8 @@ const STROKE = {
|
|
|
1529
1647
|
};
|
|
1530
1648
|
const PORT_PILL = {
|
|
1531
1649
|
true: "bg-wf-ok/10 text-wf-ok ring-wf-ok/30",
|
|
1532
|
-
false: "bg-
|
|
1533
|
-
error: "bg-wf-
|
|
1650
|
+
false: "bg-foreground/5 text-muted-foreground ring-foreground/15",
|
|
1651
|
+
error: "bg-wf-fail/10 text-wf-fail ring-wf-fail/30"
|
|
1534
1652
|
};
|
|
1535
1653
|
const PORT_TEXT = {
|
|
1536
1654
|
true: "Runs when the condition is true",
|
|
@@ -1553,34 +1671,61 @@ function roundedPath(points, radius = 6) {
|
|
|
1553
1671
|
const [lx, ly] = points[points.length - 1];
|
|
1554
1672
|
return `${d} L ${lx} ${ly}`;
|
|
1555
1673
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1674
|
+
function simplify(route) {
|
|
1675
|
+
const points = [];
|
|
1676
|
+
for (const point of route) {
|
|
1677
|
+
const last = points.at(-1);
|
|
1678
|
+
if (last && last[0] === point[0] && last[1] === point[1]) continue;
|
|
1679
|
+
const prev = points.at(-2);
|
|
1680
|
+
if (prev && last && (prev[0] === last[0] && last[0] === point[0] || prev[1] === last[1] && last[1] === point[1])) points.pop();
|
|
1681
|
+
points.push(point);
|
|
1682
|
+
}
|
|
1683
|
+
return points;
|
|
1684
|
+
}
|
|
1685
|
+
function edgeRoute(g, source, target, trackY, stacked) {
|
|
1686
|
+
const dir = target.dir;
|
|
1687
|
+
const after = source ? source.x + dir * g.col / 2 : g.lead / 2;
|
|
1688
|
+
const fromAbove = !source && stacked;
|
|
1689
|
+
const x1 = source ? source.x + dir * g.r : fromAbove ? after : 0;
|
|
1690
|
+
const y1 = source ? source.y : fromAbove ? -16 : g.top;
|
|
1691
|
+
const x2 = target.x - dir * g.r;
|
|
1560
1692
|
const y2 = target.y;
|
|
1561
|
-
const
|
|
1562
|
-
const before = target.x - g.col / 2;
|
|
1563
|
-
const route = [
|
|
1564
|
-
[x1, y1],
|
|
1565
|
-
[after, y1],
|
|
1566
|
-
[after, trackY],
|
|
1567
|
-
[before, trackY],
|
|
1568
|
-
[before, y2],
|
|
1569
|
-
[x2, y2]
|
|
1570
|
-
];
|
|
1693
|
+
const before = target.x - dir * g.col / 2;
|
|
1571
1694
|
return {
|
|
1572
|
-
points:
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1695
|
+
points: simplify([
|
|
1696
|
+
[x1, y1],
|
|
1697
|
+
[after, y1],
|
|
1698
|
+
[after, trackY],
|
|
1699
|
+
[before, trackY],
|
|
1700
|
+
[before, y2],
|
|
1701
|
+
[x2, y2]
|
|
1702
|
+
]),
|
|
1578
1703
|
label: {
|
|
1579
1704
|
x: ((trackY === y1 ? x1 : after) + (trackY === y2 ? x2 : before)) / 2,
|
|
1580
1705
|
y: trackY
|
|
1581
1706
|
}
|
|
1582
1707
|
};
|
|
1583
1708
|
}
|
|
1709
|
+
function wrapRoute(g, source, target, ends) {
|
|
1710
|
+
const turn = source.dir > 0 ? ends.right : ends.left;
|
|
1711
|
+
const x1 = source.x + source.dir * g.r;
|
|
1712
|
+
const before = target.x - target.dir * g.col / 2;
|
|
1713
|
+
const y = (target.row - source.row) % 2 === 1 ? target.y : target.y - g.lane / 2;
|
|
1714
|
+
return {
|
|
1715
|
+
points: simplify([
|
|
1716
|
+
[x1, source.y],
|
|
1717
|
+
[turn, source.y],
|
|
1718
|
+
[turn, y],
|
|
1719
|
+
[before, y],
|
|
1720
|
+
[before, target.y],
|
|
1721
|
+
[target.x - target.dir * g.r, target.y]
|
|
1722
|
+
]),
|
|
1723
|
+
label: {
|
|
1724
|
+
x: (x1 + turn) / 2,
|
|
1725
|
+
y: source.y
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1584
1729
|
function Mark({ label, className, onOpen, children, ref, onClick, ...rest }) {
|
|
1585
1730
|
return onOpen ? /* @__PURE__ */ jsx("button", {
|
|
1586
1731
|
...rest,
|
|
@@ -1651,82 +1796,143 @@ function StepTip(props) {
|
|
|
1651
1796
|
}
|
|
1652
1797
|
function WorkflowGraph(props) {
|
|
1653
1798
|
const { state, latest } = props;
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
const
|
|
1799
|
+
const frame = useRef(null);
|
|
1800
|
+
const pill = useRef(null);
|
|
1801
|
+
const [room, setRoom] = useState(null);
|
|
1802
|
+
useLayoutEffect(() => {
|
|
1803
|
+
const element = frame.current;
|
|
1804
|
+
if (!props.fit || !element) return;
|
|
1805
|
+
const measure = () => {
|
|
1806
|
+
const next = {
|
|
1807
|
+
width: element.clientWidth,
|
|
1808
|
+
pill: pill.current?.offsetWidth ?? 0
|
|
1809
|
+
};
|
|
1810
|
+
setRoom((prev) => prev?.width === next.width && prev.pill === next.pill ? prev : next);
|
|
1811
|
+
};
|
|
1812
|
+
measure();
|
|
1813
|
+
const observer = new ResizeObserver(measure);
|
|
1814
|
+
observer.observe(element);
|
|
1815
|
+
if (pill.current) observer.observe(pill.current);
|
|
1816
|
+
return () => observer.disconnect();
|
|
1817
|
+
}, [props.fit]);
|
|
1657
1818
|
const layout = graphLayout({
|
|
1658
1819
|
triggerId: state.trigger?.id,
|
|
1659
1820
|
steps: state.steps,
|
|
1660
1821
|
edges: state.edges
|
|
1661
1822
|
});
|
|
1823
|
+
const { g, stacked, perRow } = fitGraph(GEOMETRY[props.size ?? "sm"], layout.cols, props.fit ? room : null);
|
|
1824
|
+
const rowOf = (col) => Math.floor((col - 1) / perRow);
|
|
1825
|
+
const rows = Math.max(1, Math.ceil(layout.cols / perRow));
|
|
1826
|
+
const rowLanes = Array.from({ length: rows }, () => 1);
|
|
1827
|
+
for (const node of layout.nodes) {
|
|
1828
|
+
const row = rowOf(node.col);
|
|
1829
|
+
rowLanes[row] = Math.max(rowLanes[row], node.lane + 1);
|
|
1830
|
+
}
|
|
1831
|
+
const rowTop = [];
|
|
1832
|
+
for (let row = 0, y = g.top; row < rows; y += rowLanes[row] * g.lane, row++) rowTop.push(y);
|
|
1833
|
+
const spot = (col, lane) => {
|
|
1834
|
+
const row = rowOf(col);
|
|
1835
|
+
const slot = (col - 1) % perRow;
|
|
1836
|
+
const back = row % 2 === 1;
|
|
1837
|
+
return {
|
|
1838
|
+
x: g.lead + (back ? perRow - 1 - slot : slot) * g.col + g.r,
|
|
1839
|
+
y: rowTop[row] + lane * g.lane,
|
|
1840
|
+
row,
|
|
1841
|
+
dir: back ? -1 : 1
|
|
1842
|
+
};
|
|
1843
|
+
};
|
|
1662
1844
|
const records = new Map((latest?.steps ?? []).map((record) => [record.stepKey, record]));
|
|
1663
1845
|
const toneOfStep = (key) => {
|
|
1664
1846
|
const status = records.get(key)?.status;
|
|
1665
1847
|
return status ? toneOf(STEP_TONE, status) : "idle";
|
|
1666
1848
|
};
|
|
1667
1849
|
const at = new Map(layout.nodes.map((node) => [node.step.id, node]));
|
|
1668
|
-
const
|
|
1669
|
-
const
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1850
|
+
const lastX = g.lead + (Math.min(perRow, layout.cols) - 1) * g.col + g.r;
|
|
1851
|
+
const width = layout.cols > 0 ? lastX + (g.label ? g.col / 2 : g.r) : 0;
|
|
1852
|
+
const ends = {
|
|
1853
|
+
left: g.lead / 2,
|
|
1854
|
+
right: lastX + g.col / 2
|
|
1855
|
+
};
|
|
1856
|
+
const trackY = (edge, row) => rowTop[row] + edge.track.lane * g.lane + (edge.track.under ? g.dip : 0);
|
|
1672
1857
|
const routes = layout.edges.map((edge) => {
|
|
1673
|
-
const
|
|
1674
|
-
const
|
|
1858
|
+
const from = edge.from === "trigger" ? null : at.get(edge.from);
|
|
1859
|
+
const to = at.get(edge.to);
|
|
1860
|
+
const source = from ? spot(from.col, from.lane) : null;
|
|
1861
|
+
const target = spot(to.col, to.lane);
|
|
1862
|
+
const wraps = source !== null && source.row !== target.row;
|
|
1675
1863
|
return {
|
|
1676
1864
|
key: `${edge.from}-${edge.port}-${edge.to}`,
|
|
1677
1865
|
edge,
|
|
1678
|
-
tone: toneOfStep(
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
y: centerY(source.lane)
|
|
1682
|
-
} : null, {
|
|
1683
|
-
x: centerX(target.col),
|
|
1684
|
-
y: centerY(target.lane)
|
|
1685
|
-
}, trackY(edge))
|
|
1866
|
+
tone: toneOfStep(to.step.key),
|
|
1867
|
+
under: !wraps && edge.track.under,
|
|
1868
|
+
route: wraps ? wrapRoute(g, source, target, ends) : edgeRoute(g, source, target, trackY(edge, target.row), stacked)
|
|
1686
1869
|
};
|
|
1687
1870
|
});
|
|
1871
|
+
const dips = routes.filter((route) => route.under).map(({ route, edge }) => route.label.y + (PORT_PILL[edge.port] ? 10 : 4));
|
|
1872
|
+
const height = Math.max(...layout.nodes.map((node) => spot(node.col, node.lane).y + (g.label ? g.r + 6 + g.label : g.top)), ...dips);
|
|
1873
|
+
const labelBox = (x) => {
|
|
1874
|
+
let w = Math.min(g.col - 16, 2 * (width - x));
|
|
1875
|
+
let left = x - w / 2;
|
|
1876
|
+
if (stacked && left < -12) {
|
|
1877
|
+
left += Math.min(-12 - left, 16);
|
|
1878
|
+
if (left < -12) {
|
|
1879
|
+
w -= -12 - left;
|
|
1880
|
+
left = -12;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
return {
|
|
1884
|
+
left,
|
|
1885
|
+
width: w
|
|
1886
|
+
};
|
|
1887
|
+
};
|
|
1688
1888
|
const trigger = state.trigger ? triggerBlock(state.trigger) : null;
|
|
1689
1889
|
const triggerMeta = trigger ? blockMeta(trigger) : null;
|
|
1690
1890
|
return /* @__PURE__ */ jsx(ConnectTooltipProvider, {
|
|
1691
1891
|
disableHoverableContent: true,
|
|
1692
1892
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
children:
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1893
|
+
ref: frame,
|
|
1894
|
+
className: stacked ? "flex flex-col items-start" : "flex items-start",
|
|
1895
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1896
|
+
ref: pill,
|
|
1897
|
+
className: "flex shrink-0",
|
|
1898
|
+
children: /* @__PURE__ */ jsx(Tip, {
|
|
1899
|
+
content: /* @__PURE__ */ jsxs("span", {
|
|
1900
|
+
className: "flex flex-col gap-0.5",
|
|
1901
|
+
children: [
|
|
1902
|
+
/* @__PURE__ */ jsx("span", {
|
|
1903
|
+
className: "font-medium",
|
|
1904
|
+
children: triggerMeta?.displayName ?? "No trigger"
|
|
1905
|
+
}),
|
|
1906
|
+
triggerMeta ? /* @__PURE__ */ jsx("span", {
|
|
1907
|
+
className: "text-muted-foreground",
|
|
1908
|
+
children: triggerMeta.subtitle
|
|
1909
|
+
}) : null,
|
|
1910
|
+
/* @__PURE__ */ jsx("span", {
|
|
1911
|
+
className: "mt-1",
|
|
1912
|
+
children: latest ? `Last fired ${formatWhen(latest.startedAt)}` : "Not fired yet"
|
|
1913
|
+
})
|
|
1914
|
+
]
|
|
1915
|
+
}),
|
|
1916
|
+
children: /* @__PURE__ */ jsxs(Mark, {
|
|
1917
|
+
label: `Trigger: ${props.triggerText}`,
|
|
1918
|
+
onOpen: props.onOpen,
|
|
1919
|
+
className: `flex shrink-0 items-center gap-1.5 rounded-full bg-card font-medium text-foreground ring-[1.5px] ${g.pill} ${latest ? RING$1.ok : RING$1.idle}`,
|
|
1920
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1921
|
+
className: `flex items-center justify-center rounded-full dark:bg-white ${g.pillLogo}`,
|
|
1922
|
+
children: trigger ? /* @__PURE__ */ jsx(BlockLogo, {
|
|
1923
|
+
bare: true,
|
|
1924
|
+
block: trigger,
|
|
1925
|
+
size: g.logo - 2
|
|
1926
|
+
}) : null
|
|
1927
|
+
}), props.triggerText]
|
|
1928
|
+
})
|
|
1724
1929
|
})
|
|
1725
1930
|
}), layout.nodes.length > 0 ? /* @__PURE__ */ jsxs("ol", {
|
|
1726
|
-
className:
|
|
1931
|
+
className: `relative shrink-0 ${stacked ? "" : "-ml-px"}`,
|
|
1727
1932
|
style: {
|
|
1728
1933
|
width,
|
|
1729
|
-
height
|
|
1934
|
+
height,
|
|
1935
|
+
marginTop: stacked ? STACK_GAP : 0
|
|
1730
1936
|
},
|
|
1731
1937
|
"aria-label": layout.nodes.map((node) => {
|
|
1732
1938
|
const status = records.get(node.step.key)?.status;
|
|
@@ -1764,8 +1970,12 @@ function WorkflowGraph(props) {
|
|
|
1764
1970
|
const record = records.get(node.step.key);
|
|
1765
1971
|
const skipped = record?.status === "SKIPPED";
|
|
1766
1972
|
const name = node.step.name || node.step.key;
|
|
1767
|
-
const x =
|
|
1768
|
-
const
|
|
1973
|
+
const { x, y } = spot(node.col, node.lane);
|
|
1974
|
+
const tip = /* @__PURE__ */ jsx(StepTip, {
|
|
1975
|
+
node,
|
|
1976
|
+
record,
|
|
1977
|
+
ran: Boolean(latest)
|
|
1978
|
+
});
|
|
1769
1979
|
return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", {
|
|
1770
1980
|
className: "absolute",
|
|
1771
1981
|
style: {
|
|
@@ -1773,11 +1983,7 @@ function WorkflowGraph(props) {
|
|
|
1773
1983
|
top: y - g.r
|
|
1774
1984
|
},
|
|
1775
1985
|
children: /* @__PURE__ */ jsx(Tip, {
|
|
1776
|
-
content:
|
|
1777
|
-
node,
|
|
1778
|
-
record,
|
|
1779
|
-
ran: Boolean(latest)
|
|
1780
|
-
}),
|
|
1986
|
+
content: tip,
|
|
1781
1987
|
children: /* @__PURE__ */ jsx(Mark, {
|
|
1782
1988
|
label: `${name}: ${record ? record.status.toLowerCase() : "not run"}`,
|
|
1783
1989
|
onOpen: props.onOpen,
|
|
@@ -1796,13 +2002,15 @@ function WorkflowGraph(props) {
|
|
|
1796
2002
|
"aria-hidden": true,
|
|
1797
2003
|
className: "pointer-events-none absolute flex flex-col items-center text-center",
|
|
1798
2004
|
style: {
|
|
1799
|
-
|
|
1800
|
-
top: y + g.r + 6
|
|
1801
|
-
width: g.col - 16
|
|
2005
|
+
...labelBox(x),
|
|
2006
|
+
top: y + g.r + 6
|
|
1802
2007
|
},
|
|
1803
|
-
children: [/* @__PURE__ */ jsx(
|
|
1804
|
-
|
|
1805
|
-
children:
|
|
2008
|
+
children: [/* @__PURE__ */ jsx(Tip, {
|
|
2009
|
+
content: tip,
|
|
2010
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
2011
|
+
className: `pointer-events-auto line-clamp-2 max-w-full font-medium text-foreground [overflow-wrap:anywhere] ${g.nameText}`,
|
|
2012
|
+
children: name
|
|
2013
|
+
})
|
|
1806
2014
|
}), g.subtitle ? /* @__PURE__ */ jsx("span", {
|
|
1807
2015
|
className: "max-w-full truncate text-xs text-muted-foreground",
|
|
1808
2016
|
children: blockMeta(stepBlock(node.step)).displayName
|
|
@@ -1816,6 +2024,42 @@ function WorkflowGraph(props) {
|
|
|
1816
2024
|
}
|
|
1817
2025
|
//#endregion
|
|
1818
2026
|
//#region editors/workflow-studio/components/WorkflowBoard.tsx
|
|
2027
|
+
function CollapsedChain(props) {
|
|
2028
|
+
const trigger = props.state.trigger ? triggerBlock(props.state.trigger) : null;
|
|
2029
|
+
const links = workflowLinks({
|
|
2030
|
+
triggerId: props.state.trigger?.id,
|
|
2031
|
+
steps: props.state.steps,
|
|
2032
|
+
edges: props.state.edges
|
|
2033
|
+
}, props.latest);
|
|
2034
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
2035
|
+
className: "flex min-w-0 items-center",
|
|
2036
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
2037
|
+
title: props.triggerText,
|
|
2038
|
+
className: `flex h-6 max-w-full shrink-0 items-center gap-1.5 rounded-full bg-card pl-0.5 pr-2.5 text-[12px] font-medium text-foreground ring-[1.5px] ${props.latest ? "ring-wf-ok" : "ring-foreground/15 dark:ring-foreground/30"}`,
|
|
2039
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2040
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full dark:bg-white",
|
|
2041
|
+
children: trigger ? /* @__PURE__ */ jsx(BlockLogo, {
|
|
2042
|
+
bare: true,
|
|
2043
|
+
block: trigger,
|
|
2044
|
+
size: 12
|
|
2045
|
+
}) : null
|
|
2046
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2047
|
+
className: "truncate",
|
|
2048
|
+
children: props.triggerText
|
|
2049
|
+
})]
|
|
2050
|
+
}), links.length > 0 ? /* @__PURE__ */ jsxs("span", {
|
|
2051
|
+
className: "flex min-w-0 shrink-[100] items-center",
|
|
2052
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2053
|
+
"aria-hidden": true,
|
|
2054
|
+
className: "h-0.5 w-3 shrink-0 bg-foreground/15 dark:bg-foreground/30"
|
|
2055
|
+
}), /* @__PURE__ */ jsx(ScrollFade, {
|
|
2056
|
+
clip: true,
|
|
2057
|
+
className: "-my-1 min-w-0 py-1 pl-0.5",
|
|
2058
|
+
children: /* @__PURE__ */ jsx(MiniChain, { links })
|
|
2059
|
+
})]
|
|
2060
|
+
}) : null]
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
1819
2063
|
function RowToggle(props) {
|
|
1820
2064
|
const [, dispatch] = useDispatch(props.document);
|
|
1821
2065
|
const state = props.document.state.global;
|
|
@@ -1835,6 +2079,7 @@ function summary(rows) {
|
|
|
1835
2079
|
}
|
|
1836
2080
|
function WorkflowBoard(props) {
|
|
1837
2081
|
usePieceLogos();
|
|
2082
|
+
const { isCollapsed, toggle } = useCollapsed();
|
|
1838
2083
|
const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
|
|
1839
2084
|
const runs = props.runs ?? [];
|
|
1840
2085
|
const positions = new Map(props.order.map((id, i) => [id, i]));
|
|
@@ -1887,71 +2132,112 @@ function WorkflowBoard(props) {
|
|
|
1887
2132
|
const latest = row.runs.at(0);
|
|
1888
2133
|
const latestTone = toneOf(RUN_TONE, latest?.status);
|
|
1889
2134
|
const health = workflowHealth(row.status, latest?.status, Boolean(row.document.state.global.published));
|
|
2135
|
+
const collapsed = isCollapsed(row.id);
|
|
1890
2136
|
return /* @__PURE__ */ jsxs("li", {
|
|
1891
|
-
className: "
|
|
1892
|
-
children: [/* @__PURE__ */ jsxs("
|
|
2137
|
+
className: "group/row border-b border-solid border-foreground/10 first:rounded-t-xl last:rounded-b-xl last:border-b-0",
|
|
2138
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2139
|
+
className: `flex items-start transition-colors group-first/row:rounded-t-xl has-[[data-row-header]:hover]:bg-accent/40 has-[[data-row-header]:focus-visible]:bg-accent/40 ${collapsed ? "group-last/row:rounded-b-xl" : ""}`,
|
|
2140
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
2141
|
+
type: "button",
|
|
2142
|
+
"data-row-header": true,
|
|
2143
|
+
"aria-expanded": !collapsed,
|
|
2144
|
+
"aria-label": `${collapsed ? "Expand" : "Collapse"} ${row.name}`,
|
|
2145
|
+
className: "group/header @container flex min-w-0 flex-1 cursor-pointer items-start gap-1 py-4 pl-2 pr-5 text-left focus-visible:outline-none",
|
|
2146
|
+
onClick: () => toggle(row.id),
|
|
2147
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2148
|
+
"aria-hidden": true,
|
|
2149
|
+
className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover/header:bg-accent group-hover/header:text-foreground group-focus-visible/header:bg-accent group-focus-visible/header:text-foreground",
|
|
2150
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
2151
|
+
name: "chevron",
|
|
2152
|
+
className: `h-3.5 w-3.5 transition-transform ${collapsed ? "" : "rotate-90"}`
|
|
2153
|
+
})
|
|
2154
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
2155
|
+
className: `grid w-full grid-rows-[1.5rem] items-center gap-x-6 ${collapsed ? "grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)] @[44rem]:grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)_auto] @[60rem]:grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)_minmax(0,10rem)_auto]" : "grid-cols-[minmax(0,1fr)_auto] md:grid-cols-[minmax(0,1fr)_minmax(0,10rem)_auto]"}`,
|
|
2156
|
+
children: [
|
|
2157
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2158
|
+
className: "flex min-w-0 items-center gap-2",
|
|
2159
|
+
children: [
|
|
2160
|
+
/* @__PURE__ */ jsx("span", {
|
|
2161
|
+
title: health.label,
|
|
2162
|
+
className: "flex",
|
|
2163
|
+
children: /* @__PURE__ */ jsx(StatusDot, {
|
|
2164
|
+
tone: health.tone,
|
|
2165
|
+
hollow: health.hollow
|
|
2166
|
+
})
|
|
2167
|
+
}),
|
|
2168
|
+
/* @__PURE__ */ jsx("span", {
|
|
2169
|
+
className: "min-w-0 truncate text-[15px] font-semibold text-foreground",
|
|
2170
|
+
children: row.name
|
|
2171
|
+
}),
|
|
2172
|
+
row.status !== "ENABLED" ? /* @__PURE__ */ jsx("span", {
|
|
2173
|
+
className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",
|
|
2174
|
+
children: statusLabel(row.status)
|
|
2175
|
+
}) : null
|
|
2176
|
+
]
|
|
2177
|
+
}),
|
|
2178
|
+
collapsed ? /* @__PURE__ */ jsx(CollapsedChain, {
|
|
2179
|
+
state: row.document.state.global,
|
|
2180
|
+
triggerText: row.trigger,
|
|
2181
|
+
latest
|
|
2182
|
+
}) : null,
|
|
2183
|
+
/* @__PURE__ */ jsx("span", {
|
|
2184
|
+
className: `hidden text-[13px] ${collapsed ? "@[60rem]:block" : "md:block"}`,
|
|
2185
|
+
title: latest ? formatAbsolute(latest.startedAt) : void 0,
|
|
2186
|
+
children: latest ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
2187
|
+
className: `font-medium ${latestTone === "fail" ? "text-wf-fail" : latestTone === "ok" ? "text-wf-ok" : "text-foreground"}`,
|
|
2188
|
+
children: statusLabel(latest.status)
|
|
2189
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2190
|
+
className: "ml-1.5 text-xs text-muted-foreground",
|
|
2191
|
+
children: formatWhen(latest.startedAt)
|
|
2192
|
+
})] }) : /* @__PURE__ */ jsx("span", {
|
|
2193
|
+
className: "text-muted-foreground",
|
|
2194
|
+
children: "Not run yet"
|
|
2195
|
+
})
|
|
2196
|
+
}),
|
|
2197
|
+
collapsed ? /* @__PURE__ */ jsx("span", {
|
|
2198
|
+
className: "hidden @[44rem]:block",
|
|
2199
|
+
children: /* @__PURE__ */ jsx(RunStrip, {
|
|
2200
|
+
centered: true,
|
|
2201
|
+
runs: row.runs
|
|
2202
|
+
})
|
|
2203
|
+
}) : /* @__PURE__ */ jsx(RunStrip, {
|
|
2204
|
+
centered: true,
|
|
2205
|
+
runs: row.runs
|
|
2206
|
+
})
|
|
2207
|
+
]
|
|
2208
|
+
})]
|
|
2209
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
2210
|
+
className: "mt-4 flex h-6 shrink-0 items-center gap-1 pr-3",
|
|
2211
|
+
children: [/* @__PURE__ */ jsx(RowToggle, { document: row.document }), /* @__PURE__ */ jsx(WorkflowMenu, { document: row.document })]
|
|
2212
|
+
})]
|
|
2213
|
+
}), collapsed ? null : /* @__PURE__ */ jsxs("button", {
|
|
1893
2214
|
type: "button",
|
|
1894
|
-
|
|
2215
|
+
"aria-label": `Open ${row.name}`,
|
|
2216
|
+
className: "group/content relative flex w-full cursor-pointer flex-col gap-3 pb-4 pl-9 pr-5 pt-1 text-left transition-colors hover:bg-accent/50 focus-visible:bg-accent/50 focus-visible:outline-none group-last/row:rounded-b-xl",
|
|
1895
2217
|
onClick: () => props.onOpen(row.id),
|
|
1896
|
-
children: [
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
children: statusLabel(row.status)
|
|
1917
|
-
}) : null,
|
|
1918
|
-
row.description ? /* @__PURE__ */ jsx("span", {
|
|
1919
|
-
title: row.description,
|
|
1920
|
-
className: "ml-1 min-w-0 truncate text-[13px] text-muted-foreground",
|
|
1921
|
-
children: row.description
|
|
1922
|
-
}) : null
|
|
1923
|
-
]
|
|
1924
|
-
}),
|
|
1925
|
-
/* @__PURE__ */ jsx("span", {
|
|
1926
|
-
className: "hidden text-[13px] md:block",
|
|
1927
|
-
title: latest ? formatAbsolute(latest.startedAt) : void 0,
|
|
1928
|
-
children: latest ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
1929
|
-
className: `font-medium ${latestTone === "fail" ? "text-wf-fail" : latestTone === "ok" ? "text-wf-ok" : "text-foreground"}`,
|
|
1930
|
-
children: statusLabel(latest.status)
|
|
1931
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1932
|
-
className: "ml-1.5 text-xs text-muted-foreground",
|
|
1933
|
-
children: formatWhen(latest.startedAt)
|
|
1934
|
-
})] }) : /* @__PURE__ */ jsx("span", {
|
|
1935
|
-
className: "text-muted-foreground",
|
|
1936
|
-
children: "Not run yet"
|
|
1937
|
-
})
|
|
1938
|
-
}),
|
|
1939
|
-
/* @__PURE__ */ jsx(RunStrip, {
|
|
1940
|
-
centered: true,
|
|
1941
|
-
runs: row.runs
|
|
2218
|
+
children: [
|
|
2219
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2220
|
+
"aria-hidden": true,
|
|
2221
|
+
className: "pointer-events-none absolute right-5 top-1 flex items-center gap-1 text-xs font-medium text-muted-foreground opacity-0 transition-opacity group-hover/content:opacity-100 group-focus-visible/content:opacity-100",
|
|
2222
|
+
children: ["Open workflow", /* @__PURE__ */ jsx(Icon, {
|
|
2223
|
+
name: "arrowRight",
|
|
2224
|
+
className: "h-3.5 w-3.5"
|
|
2225
|
+
})]
|
|
2226
|
+
}),
|
|
2227
|
+
row.description ? /* @__PURE__ */ jsx("span", {
|
|
2228
|
+
className: "max-w-prose pl-4 text-[13px] leading-5 text-muted-foreground",
|
|
2229
|
+
children: row.description
|
|
2230
|
+
}) : null,
|
|
2231
|
+
/* @__PURE__ */ jsx(ScrollFade, {
|
|
2232
|
+
className: "max-w-full py-1 pl-4 pr-1",
|
|
2233
|
+
children: /* @__PURE__ */ jsx(WorkflowGraph, {
|
|
2234
|
+
fit: true,
|
|
2235
|
+
state: row.document.state.global,
|
|
2236
|
+
triggerText: row.trigger,
|
|
2237
|
+
latest
|
|
1942
2238
|
})
|
|
1943
|
-
]
|
|
1944
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1945
|
-
className: "block max-w-full overflow-x-auto py-1 pl-4 pr-1",
|
|
1946
|
-
children: /* @__PURE__ */ jsx(WorkflowGraph, {
|
|
1947
|
-
state: row.document.state.global,
|
|
1948
|
-
triggerText: row.trigger,
|
|
1949
|
-
latest
|
|
1950
2239
|
})
|
|
1951
|
-
|
|
1952
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
1953
|
-
className: "mt-4 flex h-6 shrink-0 items-center gap-1 pr-3",
|
|
1954
|
-
children: [/* @__PURE__ */ jsx(RowToggle, { document: row.document }), /* @__PURE__ */ jsx(WorkflowMenu, { document: row.document })]
|
|
2240
|
+
]
|
|
1955
2241
|
})]
|
|
1956
2242
|
}, row.id);
|
|
1957
2243
|
})
|
|
@@ -2072,14 +2358,15 @@ function WorkflowSteps(props) {
|
|
|
2072
2358
|
className: "mb-3 text-xs text-wf-warn",
|
|
2073
2359
|
children: "No trigger set, so this workflow never starts on its own."
|
|
2074
2360
|
}) : null,
|
|
2075
|
-
/* @__PURE__ */ jsx(
|
|
2076
|
-
className: "-mx-1
|
|
2361
|
+
/* @__PURE__ */ jsx(ScrollFade, {
|
|
2362
|
+
className: "-mx-1 px-1 py-1.5",
|
|
2077
2363
|
children: /* @__PURE__ */ jsx(WorkflowGraph, {
|
|
2078
2364
|
state,
|
|
2079
2365
|
triggerText: describeTrigger(state.trigger),
|
|
2080
2366
|
latest: props.latestRun,
|
|
2081
2367
|
onOpen: props.onOpenEditor,
|
|
2082
|
-
size: "md"
|
|
2368
|
+
size: "md",
|
|
2369
|
+
fit: true
|
|
2083
2370
|
})
|
|
2084
2371
|
}),
|
|
2085
2372
|
outline.orphans.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -2375,4 +2662,4 @@ function Editor(props) {
|
|
|
2375
2662
|
//#endregion
|
|
2376
2663
|
export { Editor as default };
|
|
2377
2664
|
|
|
2378
|
-
//# sourceMappingURL=editor-
|
|
2665
|
+
//# sourceMappingURL=editor-BXxj5Do5.js.map
|