@industry-theme/principal-view-panels 0.12.92 → 0.12.94
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/panels.bundle.js
CHANGED
|
@@ -181946,6 +181946,304 @@ const GraphRenderer = forwardRef((props, ref) => {
|
|
|
181946
181946
|
return jsx("div", { ref: containerRef, className, style: { width, height, position: "relative" }, children: jsx(TooltipPortalContext.Provider, { value: portalTarget, children: jsx(ReactFlowProvider, { children: jsx(GraphRendererInner, { configuration, nodes, edges, violations, configName, showMinimap, showControls, showBackground, backgroundVariant, backgroundGap, showCenterIndicator, showTooltips, fitViewDuration, highlightedNodeId, activeNodeIds, events, onEventProcessed, editable, onPendingChangesChange, editStateRef, resetVisualStateRef, undoRedoFunctionsRef, pushHistory, clearHistory, undoFromStack, redoFromStack, onNodeClick, fitViewToNodeIds, fitViewPadding, draggableNodeIds, onNodeDragStop, onCopy, initialViewport, elkLayout, scenarioEdges, showSequenceLabels }) }) }) });
|
|
181947
181947
|
});
|
|
181948
181948
|
GraphRenderer.displayName = "GraphRenderer";
|
|
181949
|
+
function extractNamespace(name2, strategy) {
|
|
181950
|
+
if (typeof strategy === "function") {
|
|
181951
|
+
return strategy(name2);
|
|
181952
|
+
}
|
|
181953
|
+
const segments = name2.split(".");
|
|
181954
|
+
if (segments.length <= 1) {
|
|
181955
|
+
return name2;
|
|
181956
|
+
}
|
|
181957
|
+
if (strategy === "first") {
|
|
181958
|
+
return segments[0];
|
|
181959
|
+
}
|
|
181960
|
+
if (strategy === "all-but-last") {
|
|
181961
|
+
return segments.slice(0, -1).join(".");
|
|
181962
|
+
}
|
|
181963
|
+
if (typeof strategy === "number") {
|
|
181964
|
+
return segments.slice(0, strategy).join(".");
|
|
181965
|
+
}
|
|
181966
|
+
return segments.slice(0, -1).join(".");
|
|
181967
|
+
}
|
|
181968
|
+
function getParentNamespace(namespace2) {
|
|
181969
|
+
const segments = namespace2.split(".");
|
|
181970
|
+
if (segments.length <= 1) {
|
|
181971
|
+
return void 0;
|
|
181972
|
+
}
|
|
181973
|
+
return segments.slice(0, -1).join(".");
|
|
181974
|
+
}
|
|
181975
|
+
function useSequenceLayout(events, sequenceEdges, options = {}) {
|
|
181976
|
+
const { namespaceStrategy = "all-but-last", laneWidth = 200, laneGap = 50, eventSpacing = 80, headerHeight = 60, collapsedNamespaces = [], nodeWidth = 14, nodeHeight = 14 } = options;
|
|
181977
|
+
return useMemo(() => {
|
|
181978
|
+
if (events.length === 0) {
|
|
181979
|
+
return {
|
|
181980
|
+
nodes: [],
|
|
181981
|
+
edges: [],
|
|
181982
|
+
swimlanes: [],
|
|
181983
|
+
totalWidth: 0,
|
|
181984
|
+
totalHeight: 0
|
|
181985
|
+
};
|
|
181986
|
+
}
|
|
181987
|
+
const eventNamespaces = /* @__PURE__ */ new Map();
|
|
181988
|
+
const namespaceEvents = /* @__PURE__ */ new Map();
|
|
181989
|
+
for (const event of events) {
|
|
181990
|
+
const namespace2 = extractNamespace(event.name, namespaceStrategy);
|
|
181991
|
+
eventNamespaces.set(event.id, namespace2);
|
|
181992
|
+
if (!namespaceEvents.has(namespace2)) {
|
|
181993
|
+
namespaceEvents.set(namespace2, []);
|
|
181994
|
+
}
|
|
181995
|
+
namespaceEvents.get(namespace2).push(event.id);
|
|
181996
|
+
}
|
|
181997
|
+
const allNamespaces = Array.from(namespaceEvents.keys()).sort();
|
|
181998
|
+
const collapsedSet = new Set(collapsedNamespaces);
|
|
181999
|
+
const visibleNamespaces = [];
|
|
182000
|
+
const namespaceToVisible = /* @__PURE__ */ new Map();
|
|
182001
|
+
for (const ns of allNamespaces) {
|
|
182002
|
+
let visibleNs = ns;
|
|
182003
|
+
let current = ns;
|
|
182004
|
+
while (current) {
|
|
182005
|
+
if (collapsedSet.has(current)) {
|
|
182006
|
+
visibleNs = current;
|
|
182007
|
+
}
|
|
182008
|
+
current = getParentNamespace(current);
|
|
182009
|
+
}
|
|
182010
|
+
namespaceToVisible.set(ns, visibleNs);
|
|
182011
|
+
if (!visibleNamespaces.includes(visibleNs)) {
|
|
182012
|
+
visibleNamespaces.push(visibleNs);
|
|
182013
|
+
}
|
|
182014
|
+
}
|
|
182015
|
+
const swimlanes = visibleNamespaces.map((namespace2, index2) => {
|
|
182016
|
+
const x = index2 * (laneWidth + laneGap) + laneWidth / 2;
|
|
182017
|
+
const eventIds = [];
|
|
182018
|
+
for (const [eventId, eventNs] of eventNamespaces) {
|
|
182019
|
+
if (namespaceToVisible.get(eventNs) === namespace2) {
|
|
182020
|
+
eventIds.push(eventId);
|
|
182021
|
+
}
|
|
182022
|
+
}
|
|
182023
|
+
const children2 = allNamespaces.filter((ns) => getParentNamespace(ns) === namespace2);
|
|
182024
|
+
return {
|
|
182025
|
+
namespace: namespace2,
|
|
182026
|
+
label: namespace2.split(".").pop() || namespace2,
|
|
182027
|
+
x,
|
|
182028
|
+
parentNamespace: getParentNamespace(namespace2),
|
|
182029
|
+
isCollapsed: collapsedSet.has(namespace2),
|
|
182030
|
+
children: children2,
|
|
182031
|
+
eventIds
|
|
182032
|
+
};
|
|
182033
|
+
});
|
|
182034
|
+
const swimlaneByNamespace = /* @__PURE__ */ new Map();
|
|
182035
|
+
for (const lane of swimlanes) {
|
|
182036
|
+
swimlaneByNamespace.set(lane.namespace, lane);
|
|
182037
|
+
}
|
|
182038
|
+
const nodes = [];
|
|
182039
|
+
const eventById = new Map(events.map((e) => [e.id, e]));
|
|
182040
|
+
for (let i = 0; i < events.length; i++) {
|
|
182041
|
+
const event = events[i];
|
|
182042
|
+
const originalNamespace = eventNamespaces.get(event.id);
|
|
182043
|
+
const visibleNamespace = namespaceToVisible.get(originalNamespace);
|
|
182044
|
+
const lane = swimlaneByNamespace.get(visibleNamespace);
|
|
182045
|
+
const y = headerHeight + i * eventSpacing;
|
|
182046
|
+
nodes.push({
|
|
182047
|
+
id: event.id,
|
|
182048
|
+
type: "sequenceMarker",
|
|
182049
|
+
position: {
|
|
182050
|
+
x: lane.x - nodeWidth / 2,
|
|
182051
|
+
y: y - nodeHeight / 2
|
|
182052
|
+
// Center vertically on the time layer
|
|
182053
|
+
},
|
|
182054
|
+
data: {
|
|
182055
|
+
label: event.label || event.name.split(".").pop() || event.name,
|
|
182056
|
+
fullName: event.name,
|
|
182057
|
+
namespace: originalNamespace,
|
|
182058
|
+
visibleNamespace,
|
|
182059
|
+
timeLayer: i,
|
|
182060
|
+
...event.data
|
|
182061
|
+
},
|
|
182062
|
+
style: {
|
|
182063
|
+
width: nodeWidth,
|
|
182064
|
+
height: nodeHeight
|
|
182065
|
+
}
|
|
182066
|
+
});
|
|
182067
|
+
}
|
|
182068
|
+
const edges = sequenceEdges.map((edge) => {
|
|
182069
|
+
const sourceNamespace = eventNamespaces.get(edge.fromEvent);
|
|
182070
|
+
const targetNamespace = eventNamespaces.get(edge.toEvent);
|
|
182071
|
+
const crossesLanes = namespaceToVisible.get(sourceNamespace) !== namespaceToVisible.get(targetNamespace);
|
|
182072
|
+
const targetEvent = eventById.get(edge.toEvent);
|
|
182073
|
+
const edgeLabel = edge.label || (targetEvent == null ? void 0 : targetEvent.label) || (targetEvent == null ? void 0 : targetEvent.name.split(".").pop()) || "";
|
|
182074
|
+
return {
|
|
182075
|
+
id: edge.id,
|
|
182076
|
+
source: edge.fromEvent,
|
|
182077
|
+
target: edge.toEvent,
|
|
182078
|
+
type: "sequenceArrow",
|
|
182079
|
+
label: edgeLabel,
|
|
182080
|
+
labelStyle: { fontSize: 12, fontWeight: 500 },
|
|
182081
|
+
labelBgStyle: { fill: "white", fillOpacity: 0.8 },
|
|
182082
|
+
data: {
|
|
182083
|
+
crossesLanes,
|
|
182084
|
+
sourceNamespace,
|
|
182085
|
+
targetNamespace
|
|
182086
|
+
}
|
|
182087
|
+
};
|
|
182088
|
+
});
|
|
182089
|
+
const totalWidth = swimlanes.length * (laneWidth + laneGap) - laneGap + laneWidth;
|
|
182090
|
+
const totalHeight = headerHeight + events.length * eventSpacing + eventSpacing;
|
|
182091
|
+
return {
|
|
182092
|
+
nodes,
|
|
182093
|
+
edges,
|
|
182094
|
+
swimlanes,
|
|
182095
|
+
totalWidth,
|
|
182096
|
+
totalHeight
|
|
182097
|
+
};
|
|
182098
|
+
}, [
|
|
182099
|
+
events,
|
|
182100
|
+
sequenceEdges,
|
|
182101
|
+
namespaceStrategy,
|
|
182102
|
+
laneWidth,
|
|
182103
|
+
laneGap,
|
|
182104
|
+
eventSpacing,
|
|
182105
|
+
headerHeight,
|
|
182106
|
+
nodeWidth,
|
|
182107
|
+
nodeHeight,
|
|
182108
|
+
collapsedNamespaces
|
|
182109
|
+
]);
|
|
182110
|
+
}
|
|
182111
|
+
function SequenceMarkerNode({ data }) {
|
|
182112
|
+
return jsxs("div", { style: {
|
|
182113
|
+
width: "100%",
|
|
182114
|
+
height: "100%",
|
|
182115
|
+
backgroundColor: "var(--sequence-marker-bg, #6495ED)",
|
|
182116
|
+
borderRadius: "50%",
|
|
182117
|
+
border: "2px solid var(--sequence-marker-border, #4169E1)",
|
|
182118
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
182119
|
+
}, title: data.fullName, children: [jsx(Handle, { type: "target", position: Position.Top, style: { visibility: "hidden" } }), jsx(Handle, { type: "source", position: Position.Bottom, style: { visibility: "hidden" } })] });
|
|
182120
|
+
}
|
|
182121
|
+
function SequenceArrowEdge({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, data }) {
|
|
182122
|
+
const isSameLane = !(data == null ? void 0 : data.crossesLanes);
|
|
182123
|
+
const [edgePath, labelX, labelY] = getBezierPath({
|
|
182124
|
+
sourceX,
|
|
182125
|
+
sourceY,
|
|
182126
|
+
sourcePosition,
|
|
182127
|
+
targetX,
|
|
182128
|
+
targetY,
|
|
182129
|
+
targetPosition,
|
|
182130
|
+
curvature: isSameLane ? 0.5 : 0.25
|
|
182131
|
+
});
|
|
182132
|
+
return jsxs(Fragment, { children: [jsx(BaseEdge, { id: id2, path: edgePath, style: {
|
|
182133
|
+
stroke: "var(--sequence-arrow-color, #4169E1)",
|
|
182134
|
+
strokeWidth: 2
|
|
182135
|
+
}, markerEnd: "url(#sequence-arrow)" }), label && jsx(EdgeLabelRenderer, { children: jsx("div", { style: {
|
|
182136
|
+
position: "absolute",
|
|
182137
|
+
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
|
182138
|
+
background: "var(--sequence-label-bg, rgba(255, 255, 255, 0.95))",
|
|
182139
|
+
padding: "2px 8px",
|
|
182140
|
+
borderRadius: 4,
|
|
182141
|
+
fontSize: 12,
|
|
182142
|
+
fontWeight: 500,
|
|
182143
|
+
color: "var(--sequence-label-text, #333)",
|
|
182144
|
+
border: "1px solid var(--sequence-label-border, #ddd)",
|
|
182145
|
+
pointerEvents: "all",
|
|
182146
|
+
whiteSpace: "nowrap"
|
|
182147
|
+
}, className: "nodrag nopan", children: label }) })] });
|
|
182148
|
+
}
|
|
182149
|
+
const defaultSequenceNodeTypes = {
|
|
182150
|
+
sequenceMarker: SequenceMarkerNode
|
|
182151
|
+
};
|
|
182152
|
+
const defaultSequenceEdgeTypes = {
|
|
182153
|
+
sequenceArrow: SequenceArrowEdge
|
|
182154
|
+
};
|
|
182155
|
+
function SwimlaneLayer({ swimlanes, laneWidth, headerHeight, totalHeight, onToggleCollapse }) {
|
|
182156
|
+
const { x, y, zoom: zoom2 } = useViewport();
|
|
182157
|
+
const extendedHeight = Math.max(totalHeight, 2e3);
|
|
182158
|
+
return jsxs("div", { style: {
|
|
182159
|
+
position: "absolute",
|
|
182160
|
+
top: 0,
|
|
182161
|
+
left: 0,
|
|
182162
|
+
transformOrigin: "0 0",
|
|
182163
|
+
transform: `translate(${x}px, ${y}px) scale(${zoom2})`,
|
|
182164
|
+
pointerEvents: "none",
|
|
182165
|
+
zIndex: -1
|
|
182166
|
+
}, children: [swimlanes.map((lane, index2) => {
|
|
182167
|
+
const isEven = index2 % 2 === 0;
|
|
182168
|
+
return jsx("div", { style: {
|
|
182169
|
+
position: "absolute",
|
|
182170
|
+
left: lane.x - laneWidth / 2,
|
|
182171
|
+
top: 0,
|
|
182172
|
+
width: laneWidth,
|
|
182173
|
+
height: extendedHeight,
|
|
182174
|
+
backgroundColor: isEven ? "var(--sequence-lane-even, rgba(100, 149, 237, 0.08))" : "var(--sequence-lane-odd, rgba(100, 149, 237, 0.03))",
|
|
182175
|
+
borderRight: "1px solid var(--sequence-lane-border, rgba(100, 149, 237, 0.2))"
|
|
182176
|
+
} }, `bg-${lane.namespace}`);
|
|
182177
|
+
}), swimlanes.map((lane) => {
|
|
182178
|
+
const hasChildren = lane.children.length > 0;
|
|
182179
|
+
return jsxs("div", { style: {
|
|
182180
|
+
position: "absolute",
|
|
182181
|
+
left: lane.x - laneWidth / 2,
|
|
182182
|
+
top: 0,
|
|
182183
|
+
width: laneWidth,
|
|
182184
|
+
height: headerHeight,
|
|
182185
|
+
display: "flex",
|
|
182186
|
+
alignItems: "center",
|
|
182187
|
+
justifyContent: "center",
|
|
182188
|
+
backgroundColor: "var(--sequence-header-bg, rgba(100, 149, 237, 0.15))",
|
|
182189
|
+
borderBottom: "2px solid var(--sequence-header-border, rgba(100, 149, 237, 0.4))",
|
|
182190
|
+
fontWeight: 600,
|
|
182191
|
+
fontSize: 13,
|
|
182192
|
+
color: "var(--sequence-header-text, #333)",
|
|
182193
|
+
pointerEvents: "auto",
|
|
182194
|
+
cursor: hasChildren ? "pointer" : "default",
|
|
182195
|
+
userSelect: "none"
|
|
182196
|
+
}, onClick: () => hasChildren && (onToggleCollapse == null ? void 0 : onToggleCollapse(lane.namespace)), children: [hasChildren && jsx("span", { style: { marginRight: 6, fontSize: 10 }, children: lane.isCollapsed ? "▶" : "▼" }), jsx("span", { children: lane.label }), lane.eventIds.length > 1 && jsxs("span", { style: { marginLeft: 6, fontSize: 11, opacity: 0.6 }, children: ["(", lane.eventIds.length, ")"] })] }, `header-${lane.namespace}`);
|
|
182197
|
+
}), swimlanes.map((lane) => jsx("div", { style: {
|
|
182198
|
+
position: "absolute",
|
|
182199
|
+
left: lane.x,
|
|
182200
|
+
top: headerHeight,
|
|
182201
|
+
width: 2,
|
|
182202
|
+
height: extendedHeight - headerHeight,
|
|
182203
|
+
backgroundColor: "var(--sequence-lifeline, rgba(100, 149, 237, 0.3))",
|
|
182204
|
+
transform: "translateX(-1px)"
|
|
182205
|
+
} }, `lifeline-${lane.namespace}`))] });
|
|
182206
|
+
}
|
|
182207
|
+
function SequenceDiagramInner({
|
|
182208
|
+
events,
|
|
182209
|
+
edges: sequenceEdges,
|
|
182210
|
+
layoutOptions = {},
|
|
182211
|
+
nodeTypes: customNodeTypes,
|
|
182212
|
+
edgeTypes: customEdgeTypes,
|
|
182213
|
+
onToggleCollapse,
|
|
182214
|
+
onNodeClick,
|
|
182215
|
+
showControls = true,
|
|
182216
|
+
showBackground = false
|
|
182217
|
+
// Default to false since swimlanes provide visual structure
|
|
182218
|
+
}) {
|
|
182219
|
+
const { laneWidth = 200, headerHeight = 60 } = layoutOptions;
|
|
182220
|
+
const nodeTypes2 = useMemo(() => ({ ...defaultSequenceNodeTypes, ...customNodeTypes }), [customNodeTypes]);
|
|
182221
|
+
const edgeTypes2 = useMemo(() => ({ ...defaultSequenceEdgeTypes, ...customEdgeTypes }), [customEdgeTypes]);
|
|
182222
|
+
const { nodes, edges, swimlanes, totalHeight } = useSequenceLayout(events, sequenceEdges, layoutOptions);
|
|
182223
|
+
const handleNodeClick2 = useCallback((_event, node2) => {
|
|
182224
|
+
onNodeClick == null ? void 0 : onNodeClick(node2.id, _event);
|
|
182225
|
+
}, [onNodeClick]);
|
|
182226
|
+
return jsxs(index$2, { nodes, edges, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick: handleNodeClick2, fitView: true, fitViewOptions: {
|
|
182227
|
+
padding: 0.2,
|
|
182228
|
+
minZoom: 0.5,
|
|
182229
|
+
maxZoom: 1.5
|
|
182230
|
+
}, minZoom: 0.1, maxZoom: 2, nodesDraggable: false, nodesConnectable: false, elementsSelectable: true, panOnScroll: true, zoomOnScroll: true, children: [jsx("svg", { style: { position: "absolute", width: 0, height: 0 }, children: jsx("defs", { children: jsx("marker", { id: "sequence-arrow", viewBox: "0 0 10 10", refX: "8", refY: "5", markerWidth: "6", markerHeight: "6", orient: "auto-start-reverse", children: jsx("path", { d: "M 0 0 L 10 5 L 0 10 z", fill: "var(--sequence-arrow-color, #4169E1)" }) }) }) }), showBackground && jsx(Background, { variant: BackgroundVariant.Dots, gap: 16, size: 1 }), showControls && jsx(Controls, {}), jsx(SwimlaneLayer, { swimlanes, laneWidth, headerHeight, totalHeight, onToggleCollapse }), swimlanes.some((s2) => s2.children.length > 0) && jsx(Panel$1, { position: "top-right", children: jsx("div", { style: {
|
|
182231
|
+
background: "var(--sequence-panel-bg, rgba(255, 255, 255, 0.95))",
|
|
182232
|
+
border: "1px solid var(--sequence-panel-border, #ddd)",
|
|
182233
|
+
borderRadius: 4,
|
|
182234
|
+
padding: "6px 10px",
|
|
182235
|
+
fontSize: 11,
|
|
182236
|
+
color: "#666"
|
|
182237
|
+
}, children: "Click lane headers to expand/collapse" }) })] });
|
|
182238
|
+
}
|
|
182239
|
+
function SequenceDiagramRenderer(props) {
|
|
182240
|
+
const { className, width = "100%", height = 600 } = props;
|
|
182241
|
+
return jsx("div", { className, style: {
|
|
182242
|
+
width,
|
|
182243
|
+
height,
|
|
182244
|
+
position: "relative"
|
|
182245
|
+
}, children: jsx(ReactFlowProvider, { children: jsx(SequenceDiagramInner, { ...props }) }) });
|
|
182246
|
+
}
|
|
181949
182247
|
const DEFAULT_NODE_WIDTH = 200;
|
|
181950
182248
|
const DEFAULT_NODE_HEIGHT = 100;
|
|
181951
182249
|
const GROUP_PADDING = 40;
|
|
@@ -206082,14 +206380,190 @@ class EmptyDataProvider {
|
|
|
206082
206380
|
};
|
|
206083
206381
|
}
|
|
206084
206382
|
}
|
|
206383
|
+
function convertWorkflowToSequence(scenario) {
|
|
206384
|
+
const templateEvents = scenario.template.events ?? {};
|
|
206385
|
+
const eventNames = Object.keys(templateEvents);
|
|
206386
|
+
const events = eventNames.map((name2, index2) => ({
|
|
206387
|
+
id: `event-${index2}`,
|
|
206388
|
+
name: name2,
|
|
206389
|
+
label: name2.split(".").pop() ?? name2
|
|
206390
|
+
}));
|
|
206391
|
+
const edges = [];
|
|
206392
|
+
for (let i = 0; i < events.length - 1; i++) {
|
|
206393
|
+
edges.push({
|
|
206394
|
+
id: `edge-${i}`,
|
|
206395
|
+
fromEvent: events[i].id,
|
|
206396
|
+
toEvent: events[i + 1].id
|
|
206397
|
+
});
|
|
206398
|
+
}
|
|
206399
|
+
return { events, edges };
|
|
206400
|
+
}
|
|
206401
|
+
function SequenceDiagramModal({
|
|
206402
|
+
sequence,
|
|
206403
|
+
onClose,
|
|
206404
|
+
onOpenCanvas,
|
|
206405
|
+
theme: theme2
|
|
206406
|
+
}) {
|
|
206407
|
+
const { events, edges } = useMemo(
|
|
206408
|
+
() => convertWorkflowToSequence(sequence.scenario),
|
|
206409
|
+
[sequence.scenario]
|
|
206410
|
+
);
|
|
206411
|
+
return /* @__PURE__ */ jsx(
|
|
206412
|
+
"div",
|
|
206413
|
+
{
|
|
206414
|
+
style: {
|
|
206415
|
+
position: "fixed",
|
|
206416
|
+
inset: 0,
|
|
206417
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
206418
|
+
display: "flex",
|
|
206419
|
+
alignItems: "center",
|
|
206420
|
+
justifyContent: "center",
|
|
206421
|
+
zIndex: 1e3
|
|
206422
|
+
},
|
|
206423
|
+
onClick: (e) => {
|
|
206424
|
+
if (e.target === e.currentTarget) onClose();
|
|
206425
|
+
},
|
|
206426
|
+
children: /* @__PURE__ */ jsxs(
|
|
206427
|
+
"div",
|
|
206428
|
+
{
|
|
206429
|
+
style: {
|
|
206430
|
+
backgroundColor: theme2.colors.background,
|
|
206431
|
+
borderRadius: theme2.radii[2],
|
|
206432
|
+
boxShadow: "0 4px 20px rgba(0, 0, 0, 0.3)",
|
|
206433
|
+
width: "90%",
|
|
206434
|
+
maxWidth: 1200,
|
|
206435
|
+
height: "80%",
|
|
206436
|
+
maxHeight: 800,
|
|
206437
|
+
display: "flex",
|
|
206438
|
+
flexDirection: "column",
|
|
206439
|
+
overflow: "hidden"
|
|
206440
|
+
},
|
|
206441
|
+
children: [
|
|
206442
|
+
/* @__PURE__ */ jsxs(
|
|
206443
|
+
"div",
|
|
206444
|
+
{
|
|
206445
|
+
style: {
|
|
206446
|
+
display: "flex",
|
|
206447
|
+
alignItems: "center",
|
|
206448
|
+
justifyContent: "space-between",
|
|
206449
|
+
padding: `${theme2.space[3]} ${theme2.space[4]}`,
|
|
206450
|
+
borderBottom: `1px solid ${theme2.colors.border}`,
|
|
206451
|
+
backgroundColor: theme2.colors.surface
|
|
206452
|
+
},
|
|
206453
|
+
children: [
|
|
206454
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
206455
|
+
/* @__PURE__ */ jsx(
|
|
206456
|
+
"h2",
|
|
206457
|
+
{
|
|
206458
|
+
style: {
|
|
206459
|
+
margin: 0,
|
|
206460
|
+
fontSize: theme2.fontSizes[4],
|
|
206461
|
+
fontWeight: 600,
|
|
206462
|
+
color: theme2.colors.text
|
|
206463
|
+
},
|
|
206464
|
+
children: sequence.workflow.name
|
|
206465
|
+
}
|
|
206466
|
+
),
|
|
206467
|
+
/* @__PURE__ */ jsx(
|
|
206468
|
+
"p",
|
|
206469
|
+
{
|
|
206470
|
+
style: {
|
|
206471
|
+
margin: `${theme2.space[1]} 0 0`,
|
|
206472
|
+
fontSize: theme2.fontSizes[1],
|
|
206473
|
+
color: theme2.colors.textSecondary
|
|
206474
|
+
},
|
|
206475
|
+
children: sequence.scenario.description
|
|
206476
|
+
}
|
|
206477
|
+
)
|
|
206478
|
+
] }),
|
|
206479
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: theme2.space[2] }, children: [
|
|
206480
|
+
/* @__PURE__ */ jsxs(
|
|
206481
|
+
"button",
|
|
206482
|
+
{
|
|
206483
|
+
onClick: onOpenCanvas,
|
|
206484
|
+
style: {
|
|
206485
|
+
display: "flex",
|
|
206486
|
+
alignItems: "center",
|
|
206487
|
+
gap: theme2.space[1],
|
|
206488
|
+
padding: `${theme2.space[2]} ${theme2.space[3]}`,
|
|
206489
|
+
backgroundColor: theme2.colors.primary,
|
|
206490
|
+
color: theme2.colors.background,
|
|
206491
|
+
border: "none",
|
|
206492
|
+
borderRadius: theme2.radii[1],
|
|
206493
|
+
fontSize: theme2.fontSizes[1],
|
|
206494
|
+
fontWeight: 500,
|
|
206495
|
+
cursor: "pointer"
|
|
206496
|
+
},
|
|
206497
|
+
children: [
|
|
206498
|
+
/* @__PURE__ */ jsx(ExternalLink, { size: 14 }),
|
|
206499
|
+
"Open in Canvas"
|
|
206500
|
+
]
|
|
206501
|
+
}
|
|
206502
|
+
),
|
|
206503
|
+
/* @__PURE__ */ jsx(
|
|
206504
|
+
"button",
|
|
206505
|
+
{
|
|
206506
|
+
onClick: onClose,
|
|
206507
|
+
style: {
|
|
206508
|
+
display: "flex",
|
|
206509
|
+
alignItems: "center",
|
|
206510
|
+
justifyContent: "center",
|
|
206511
|
+
width: 32,
|
|
206512
|
+
height: 32,
|
|
206513
|
+
backgroundColor: "transparent",
|
|
206514
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
206515
|
+
borderRadius: theme2.radii[1],
|
|
206516
|
+
cursor: "pointer",
|
|
206517
|
+
color: theme2.colors.textSecondary
|
|
206518
|
+
},
|
|
206519
|
+
children: /* @__PURE__ */ jsx(X$2, { size: 18 })
|
|
206520
|
+
}
|
|
206521
|
+
)
|
|
206522
|
+
] })
|
|
206523
|
+
]
|
|
206524
|
+
}
|
|
206525
|
+
),
|
|
206526
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 0 }, children: events.length > 0 ? /* @__PURE__ */ jsx(
|
|
206527
|
+
SequenceDiagramRenderer,
|
|
206528
|
+
{
|
|
206529
|
+
events,
|
|
206530
|
+
edges,
|
|
206531
|
+
height: "100%",
|
|
206532
|
+
layoutOptions: {
|
|
206533
|
+
laneWidth: 220,
|
|
206534
|
+
laneGap: 60,
|
|
206535
|
+
eventSpacing: 100,
|
|
206536
|
+
namespaceStrategy: "all-but-last"
|
|
206537
|
+
},
|
|
206538
|
+
showControls: true
|
|
206539
|
+
}
|
|
206540
|
+
) : /* @__PURE__ */ jsx(
|
|
206541
|
+
"div",
|
|
206542
|
+
{
|
|
206543
|
+
style: {
|
|
206544
|
+
height: "100%",
|
|
206545
|
+
display: "flex",
|
|
206546
|
+
alignItems: "center",
|
|
206547
|
+
justifyContent: "center",
|
|
206548
|
+
color: theme2.colors.textSecondary
|
|
206549
|
+
},
|
|
206550
|
+
children: "No events defined for this scenario"
|
|
206551
|
+
}
|
|
206552
|
+
) })
|
|
206553
|
+
]
|
|
206554
|
+
}
|
|
206555
|
+
)
|
|
206556
|
+
}
|
|
206557
|
+
);
|
|
206558
|
+
}
|
|
206085
206559
|
const DashboardPanel = ({
|
|
206086
|
-
context:
|
|
206560
|
+
context: context2,
|
|
206087
206561
|
actions,
|
|
206088
206562
|
events,
|
|
206089
206563
|
selectedDashboard,
|
|
206090
206564
|
dataProvider,
|
|
206091
|
-
storyboards,
|
|
206092
|
-
workflows,
|
|
206565
|
+
storyboards: storyboardsProp,
|
|
206566
|
+
workflows: workflowsProp,
|
|
206093
206567
|
onSourceClick,
|
|
206094
206568
|
onMetricClick
|
|
206095
206569
|
}) => {
|
|
@@ -206100,10 +206574,29 @@ const DashboardPanel = ({
|
|
|
206100
206574
|
const [error, setError] = useState(null);
|
|
206101
206575
|
const [timeRange, setTimeRange] = useState({ preset: "last_1h" });
|
|
206102
206576
|
const [refreshInterval, setRefreshInterval] = useState("off");
|
|
206577
|
+
const [selectedSequence, setSelectedSequence] = useState(null);
|
|
206103
206578
|
gt("dashboard", events, () => {
|
|
206104
206579
|
var _a2;
|
|
206105
206580
|
return (_a2 = panelRef.current) == null ? void 0 : _a2.focus();
|
|
206106
206581
|
});
|
|
206582
|
+
const typedContext = context2;
|
|
206583
|
+
const fileTreeSlice = typedContext == null ? void 0 : typedContext.fileTree;
|
|
206584
|
+
const { storyboards: discoveredStoryboards, workflows: discoveredWorkflows } = useCanvasWorkflowData({
|
|
206585
|
+
context: fileTreeSlice ? { fileTree: fileTreeSlice } : {
|
|
206586
|
+
fileTree: {
|
|
206587
|
+
data: null,
|
|
206588
|
+
loading: false,
|
|
206589
|
+
error: null,
|
|
206590
|
+
scope: "repository",
|
|
206591
|
+
name: "fileTree",
|
|
206592
|
+
refresh: async () => {
|
|
206593
|
+
}
|
|
206594
|
+
}
|
|
206595
|
+
},
|
|
206596
|
+
actions
|
|
206597
|
+
});
|
|
206598
|
+
const storyboards = storyboardsProp ?? discoveredStoryboards;
|
|
206599
|
+
const workflows = workflowsProp ?? discoveredWorkflows;
|
|
206107
206600
|
useEffect(() => {
|
|
206108
206601
|
if (!selectedDashboard) {
|
|
206109
206602
|
setDashboard(null);
|
|
@@ -206136,7 +206629,6 @@ const DashboardPanel = ({
|
|
|
206136
206629
|
onSourceClick(source2);
|
|
206137
206630
|
return;
|
|
206138
206631
|
}
|
|
206139
|
-
if (!(events == null ? void 0 : events.emit)) return;
|
|
206140
206632
|
const matchingStoryboard = storyboards == null ? void 0 : storyboards.find(
|
|
206141
206633
|
(sb) => sb.basename === source2.storyboard || sb.name === source2.storyboard
|
|
206142
206634
|
);
|
|
@@ -206148,6 +206640,44 @@ const DashboardPanel = ({
|
|
|
206148
206640
|
const fullWorkflow = workflows == null ? void 0 : workflows.find(
|
|
206149
206641
|
(wf) => wf.file.path === matchingWorkflowMeta.path
|
|
206150
206642
|
);
|
|
206643
|
+
if (fullWorkflow == null ? void 0 : fullWorkflow.template) {
|
|
206644
|
+
const scenario = fullWorkflow.template.scenarios.find(
|
|
206645
|
+
(s2) => {
|
|
206646
|
+
var _a2;
|
|
206647
|
+
return s2.id === source2.event || ((_a2 = s2.template.events) == null ? void 0 : _a2[source2.event ?? ""]);
|
|
206648
|
+
}
|
|
206649
|
+
) ?? fullWorkflow.template.scenarios[0];
|
|
206650
|
+
if (scenario) {
|
|
206651
|
+
setSelectedSequence({
|
|
206652
|
+
storyboard: matchingStoryboard,
|
|
206653
|
+
workflowMeta: matchingWorkflowMeta,
|
|
206654
|
+
workflow: fullWorkflow.template,
|
|
206655
|
+
scenario,
|
|
206656
|
+
source: source2
|
|
206657
|
+
});
|
|
206658
|
+
return;
|
|
206659
|
+
}
|
|
206660
|
+
}
|
|
206661
|
+
if (events == null ? void 0 : events.emit) {
|
|
206662
|
+
events.emit({
|
|
206663
|
+
type: "custom",
|
|
206664
|
+
source: "dashboard-panel",
|
|
206665
|
+
timestamp: Date.now(),
|
|
206666
|
+
payload: {
|
|
206667
|
+
action: "openCanvas",
|
|
206668
|
+
canvasId: matchingStoryboard.canvas.id,
|
|
206669
|
+
canvas: matchingStoryboard.canvas,
|
|
206670
|
+
workflowId: matchingWorkflowMeta.id,
|
|
206671
|
+
workflow: fullWorkflow == null ? void 0 : fullWorkflow.template,
|
|
206672
|
+
openMode: "detail",
|
|
206673
|
+
sourceNodes: source2.nodes,
|
|
206674
|
+
sourceEvent: source2.event
|
|
206675
|
+
}
|
|
206676
|
+
});
|
|
206677
|
+
}
|
|
206678
|
+
return;
|
|
206679
|
+
}
|
|
206680
|
+
if (events == null ? void 0 : events.emit) {
|
|
206151
206681
|
events.emit({
|
|
206152
206682
|
type: "custom",
|
|
206153
206683
|
source: "dashboard-panel",
|
|
@@ -206156,43 +206686,48 @@ const DashboardPanel = ({
|
|
|
206156
206686
|
action: "openCanvas",
|
|
206157
206687
|
canvasId: matchingStoryboard.canvas.id,
|
|
206158
206688
|
canvas: matchingStoryboard.canvas,
|
|
206159
|
-
|
|
206160
|
-
workflow: fullWorkflow == null ? void 0 : fullWorkflow.template,
|
|
206161
|
-
openMode: "detail",
|
|
206162
|
-
// Include source info for potential node/event highlighting
|
|
206163
|
-
sourceNodes: source2.nodes,
|
|
206164
|
-
sourceEvent: source2.event
|
|
206689
|
+
openMode: "editor"
|
|
206165
206690
|
}
|
|
206166
206691
|
});
|
|
206167
|
-
return;
|
|
206168
206692
|
}
|
|
206693
|
+
return;
|
|
206694
|
+
}
|
|
206695
|
+
if (events == null ? void 0 : events.emit) {
|
|
206169
206696
|
events.emit({
|
|
206170
|
-
type: "
|
|
206697
|
+
type: "dashboard:source-click",
|
|
206171
206698
|
source: "dashboard-panel",
|
|
206172
206699
|
timestamp: Date.now(),
|
|
206173
206700
|
payload: {
|
|
206174
|
-
|
|
206175
|
-
|
|
206176
|
-
|
|
206177
|
-
|
|
206701
|
+
source: source2,
|
|
206702
|
+
storyboard: source2.storyboard,
|
|
206703
|
+
workflow: source2.workflow,
|
|
206704
|
+
nodes: source2.nodes
|
|
206178
206705
|
}
|
|
206179
206706
|
});
|
|
206180
|
-
return;
|
|
206181
206707
|
}
|
|
206182
|
-
events.emit({
|
|
206183
|
-
type: "dashboard:source-click",
|
|
206184
|
-
source: "dashboard-panel",
|
|
206185
|
-
timestamp: Date.now(),
|
|
206186
|
-
payload: {
|
|
206187
|
-
source: source2,
|
|
206188
|
-
storyboard: source2.storyboard,
|
|
206189
|
-
workflow: source2.workflow,
|
|
206190
|
-
nodes: source2.nodes
|
|
206191
|
-
}
|
|
206192
|
-
});
|
|
206193
206708
|
},
|
|
206194
206709
|
[onSourceClick, events, storyboards, workflows]
|
|
206195
206710
|
);
|
|
206711
|
+
const handleOpenCanvas = useCallback(() => {
|
|
206712
|
+
if (!selectedSequence || !(events == null ? void 0 : events.emit)) return;
|
|
206713
|
+
const { storyboard, workflowMeta, workflow, source: source2 } = selectedSequence;
|
|
206714
|
+
events.emit({
|
|
206715
|
+
type: "custom",
|
|
206716
|
+
source: "dashboard-panel",
|
|
206717
|
+
timestamp: Date.now(),
|
|
206718
|
+
payload: {
|
|
206719
|
+
action: "openCanvas",
|
|
206720
|
+
canvasId: storyboard.canvas.id,
|
|
206721
|
+
canvas: storyboard.canvas,
|
|
206722
|
+
workflowId: workflowMeta.id,
|
|
206723
|
+
workflow,
|
|
206724
|
+
openMode: "detail",
|
|
206725
|
+
sourceNodes: source2.nodes,
|
|
206726
|
+
sourceEvent: source2.event
|
|
206727
|
+
}
|
|
206728
|
+
});
|
|
206729
|
+
setSelectedSequence(null);
|
|
206730
|
+
}, [selectedSequence, events]);
|
|
206196
206731
|
const handleMetricClick = useCallback(
|
|
206197
206732
|
(metricId) => {
|
|
206198
206733
|
if (onMetricClick) {
|
|
@@ -206291,7 +206826,7 @@ const DashboardPanel = ({
|
|
|
206291
206826
|
}
|
|
206292
206827
|
);
|
|
206293
206828
|
}
|
|
206294
|
-
return /* @__PURE__ */
|
|
206829
|
+
return /* @__PURE__ */ jsxs(
|
|
206295
206830
|
"div",
|
|
206296
206831
|
{
|
|
206297
206832
|
ref: panelRef,
|
|
@@ -206302,19 +206837,30 @@ const DashboardPanel = ({
|
|
|
206302
206837
|
overflow: "auto",
|
|
206303
206838
|
outline: "none"
|
|
206304
206839
|
},
|
|
206305
|
-
children:
|
|
206306
|
-
|
|
206307
|
-
|
|
206308
|
-
|
|
206309
|
-
|
|
206310
|
-
|
|
206311
|
-
|
|
206312
|
-
|
|
206313
|
-
|
|
206314
|
-
|
|
206315
|
-
|
|
206316
|
-
|
|
206317
|
-
|
|
206840
|
+
children: [
|
|
206841
|
+
/* @__PURE__ */ jsx(
|
|
206842
|
+
DashboardRenderer,
|
|
206843
|
+
{
|
|
206844
|
+
dashboard,
|
|
206845
|
+
dataProvider: effectiveDataProvider,
|
|
206846
|
+
timeRange,
|
|
206847
|
+
onTimeRangeChange: setTimeRange,
|
|
206848
|
+
refreshInterval,
|
|
206849
|
+
onRefreshIntervalChange: setRefreshInterval,
|
|
206850
|
+
onMetricClick: handleMetricClick,
|
|
206851
|
+
onSourceClick: handleSourceClick
|
|
206852
|
+
}
|
|
206853
|
+
),
|
|
206854
|
+
selectedSequence && /* @__PURE__ */ jsx(
|
|
206855
|
+
SequenceDiagramModal,
|
|
206856
|
+
{
|
|
206857
|
+
sequence: selectedSequence,
|
|
206858
|
+
onClose: () => setSelectedSequence(null),
|
|
206859
|
+
onOpenCanvas: handleOpenCanvas,
|
|
206860
|
+
theme: theme2
|
|
206861
|
+
}
|
|
206862
|
+
)
|
|
206863
|
+
]
|
|
206318
206864
|
}
|
|
206319
206865
|
);
|
|
206320
206866
|
};
|