@industry-theme/principal-view-panels 0.8.3 → 0.8.5

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.
@@ -108,4 +108,12 @@ export declare const CanvasWithDocumentation: Story;
108
108
  * banner about incomplete template data.
109
109
  */
110
110
  export declare const IncompleteTemplateData: Story;
111
+ /**
112
+ * Story: Incomplete Template Data - Missing Event
113
+ *
114
+ * This demonstrates what happens when the workflow template defines an event
115
+ * that is NOT present in the execution data. The narrative should show the
116
+ * event is missing or skip it gracefully.
117
+ */
118
+ export declare const IncompleteTemplateData_MissingEvent: Story;
111
119
  //# sourceMappingURL=WorkflowScenariosPanel.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowScenariosPanel.stories.d.ts","sourceRoot":"","sources":["../../src/panels/WorkflowScenariosPanel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAsBqC,CAAC;AAEhD,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAmyBnC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAgDtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,EAAE,KAgD5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAgD9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,KA6GtC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA6KjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAwDrC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAsGpC,CAAC"}
1
+ {"version":3,"file":"WorkflowScenariosPanel.stories.d.ts","sourceRoot":"","sources":["../../src/panels/WorkflowScenariosPanel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAsBqC,CAAC;AAEhD,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAmyBnC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAgDtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,EAAE,KAgD5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAgD9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,KA6GtC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA6KjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAwDrC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAsGpC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,EAAE,KA2IjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowRenderer.d.ts","sourceRoot":"","sources":["../../../src/panels/execution-viewer/WorkflowRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAA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AC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,sFAAsF;IACtF,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9D,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,kFAAkF;IAClF,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,yCAAyC;IACzC,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAE/B,6CAA6C;IAC7C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA4nB5D,CAAC"}
@@ -50564,76 +50564,138 @@ const WorkflowRenderer = ({
50564
50564
  const bTime = typeof b.timestamp === "number" ? b.timestamp : Date.parse(b.timestamp);
50565
50565
  return aTime - bTime;
50566
50566
  });
50567
- sortedEvents.forEach((event, eventIndex) => {
50567
+ const executionEventsByName = /* @__PURE__ */ new Map();
50568
+ sortedEvents.forEach((event, index2) => {
50569
+ const existing = executionEventsByName.get(event.name) || [];
50570
+ existing.push({ event, index: index2 });
50571
+ executionEventsByName.set(event.name, existing);
50572
+ });
50573
+ const renderedEventIndices = /* @__PURE__ */ new Set();
50574
+ const templateEventNames = scenario.template.events ? Object.keys(scenario.template.events) : [];
50575
+ templateEventNames.forEach((templateEventName) => {
50568
50576
  var _a;
50569
- const eventTemplate = (_a = scenario.template.events) == null ? void 0 : _a[event.name];
50577
+ const eventTemplate = (_a = scenario.template.events) == null ? void 0 : _a[templateEventName];
50570
50578
  if (!eventTemplate) return;
50571
- const eventContext = { ...fullContext };
50572
- if (event.attributes) {
50573
- for (const [key, value] of Object.entries(event.attributes)) {
50574
- if (key.includes(".")) {
50575
- const parts = key.split(".");
50576
- let current = eventContext;
50577
- for (let i = 0; i < parts.length - 1; i++) {
50578
- if (!current[parts[i]] || typeof current[parts[i]] !== "object") {
50579
- current[parts[i]] = {};
50579
+ const matchingEvents = executionEventsByName.get(templateEventName) || [];
50580
+ if (matchingEvents.length === 0) {
50581
+ const renderedText = parseTemplate(eventTemplate, fullContext);
50582
+ const syntheticEventIndex = sortedEvents.length + templateEventNames.indexOf(templateEventName);
50583
+ const syntheticEvent = {
50584
+ name: templateEventName,
50585
+ timestamp: 0,
50586
+ attributes: {}
50587
+ };
50588
+ elements.push(
50589
+ /* @__PURE__ */ jsx(
50590
+ "div",
50591
+ {
50592
+ onClick: () => {
50593
+ if (onEventClick) {
50594
+ onEventClick(syntheticEvent, syntheticEventIndex);
50595
+ }
50596
+ },
50597
+ style: {
50598
+ cursor: onEventClick ? "pointer" : "default",
50599
+ transition: "all 0.2s ease"
50600
+ },
50601
+ children: /* @__PURE__ */ jsxs(
50602
+ "div",
50603
+ {
50604
+ style: {
50605
+ padding: "8px 20px 12px 20px",
50606
+ backgroundColor: activeEventIndex === syntheticEventIndex ? theme.colors.muted : theme.colors.backgroundSecondary,
50607
+ borderBottom: `1px solid ${theme.colors.border}`,
50608
+ borderLeft: activeEventIndex === syntheticEventIndex ? `4px solid ${theme.colors.warning}` : "4px solid transparent",
50609
+ fontSize: theme.fontSizes[1],
50610
+ lineHeight: "1.7",
50611
+ fontWeight: 500,
50612
+ transition: "background-color 0.2s ease, border-color 0.2s ease",
50613
+ color: theme.colors.text
50614
+ },
50615
+ children: [
50616
+ renderFormattedText(renderedText),
50617
+ /* @__PURE__ */ jsx(SourceFileList, { sources: getEventSources(templateEventName), onSourceClick })
50618
+ ]
50619
+ }
50620
+ )
50621
+ },
50622
+ `missing-event-${templateEventName}`
50623
+ )
50624
+ );
50625
+ } else {
50626
+ matchingEvents.forEach(({ event, index: eventIndex }) => {
50627
+ renderedEventIndices.add(eventIndex);
50628
+ const eventContext = { ...fullContext };
50629
+ if (event.attributes) {
50630
+ for (const [key, value] of Object.entries(event.attributes)) {
50631
+ if (key.includes(".")) {
50632
+ const parts = key.split(".");
50633
+ let current = eventContext;
50634
+ for (let i = 0; i < parts.length - 1; i++) {
50635
+ if (!current[parts[i]] || typeof current[parts[i]] !== "object") {
50636
+ current[parts[i]] = {};
50637
+ }
50638
+ current = current[parts[i]];
50639
+ }
50640
+ current[parts[parts.length - 1]] = value;
50641
+ } else {
50642
+ eventContext[key] = value;
50580
50643
  }
50581
- current = current[parts[i]];
50582
50644
  }
50583
- current[parts[parts.length - 1]] = value;
50584
- } else {
50585
- eventContext[key] = value;
50586
50645
  }
50587
- }
50588
- }
50589
- const renderedText = parseTemplate(eventTemplate, eventContext);
50590
- elements.push(
50591
- /* @__PURE__ */ jsx(
50592
- "div",
50593
- {
50594
- ref: activeEventIndex === eventIndex ? activeEventRef : null,
50595
- onClick: () => {
50596
- if (onEventClick) {
50597
- onEventClick(event, eventIndex);
50598
- }
50599
- },
50600
- onContextMenu: (e) => {
50601
- e.preventDefault();
50602
- setContextMenu({
50603
- visible: true,
50604
- x: e.clientX,
50605
- y: e.clientY,
50606
- event
50607
- });
50608
- },
50609
- style: {
50610
- cursor: onEventClick ? "pointer" : "default",
50611
- transition: "all 0.2s ease"
50612
- },
50613
- children: /* @__PURE__ */ jsxs(
50646
+ const renderedText = parseTemplate(eventTemplate, eventContext);
50647
+ elements.push(
50648
+ /* @__PURE__ */ jsx(
50614
50649
  "div",
50615
50650
  {
50651
+ ref: activeEventIndex === eventIndex ? activeEventRef : null,
50652
+ onClick: () => {
50653
+ if (onEventClick) {
50654
+ onEventClick(event, eventIndex);
50655
+ }
50656
+ },
50657
+ onContextMenu: (e) => {
50658
+ e.preventDefault();
50659
+ setContextMenu({
50660
+ visible: true,
50661
+ x: e.clientX,
50662
+ y: e.clientY,
50663
+ event
50664
+ });
50665
+ },
50616
50666
  style: {
50617
- padding: "8px 20px 12px 20px",
50618
- backgroundColor: activeEventIndex === eventIndex ? theme.colors.muted : theme.colors.backgroundSecondary,
50619
- borderBottom: `1px solid ${theme.colors.border}`,
50620
- borderLeft: activeEventIndex === eventIndex ? `4px solid ${theme.colors.primary}` : "4px solid transparent",
50621
- fontSize: theme.fontSizes[1],
50622
- lineHeight: "1.7",
50623
- fontWeight: 500,
50624
- transition: "background-color 0.2s ease, border-color 0.2s ease",
50625
- color: theme.colors.text
50667
+ cursor: onEventClick ? "pointer" : "default",
50668
+ transition: "all 0.2s ease"
50626
50669
  },
50627
- children: [
50628
- renderFormattedText(renderedText),
50629
- /* @__PURE__ */ jsx(SourceFileList, { sources: getEventSources(event.name), onSourceClick })
50630
- ]
50631
- }
50670
+ children: /* @__PURE__ */ jsxs(
50671
+ "div",
50672
+ {
50673
+ style: {
50674
+ padding: "8px 20px 12px 20px",
50675
+ backgroundColor: activeEventIndex === eventIndex ? theme.colors.muted : theme.colors.backgroundSecondary,
50676
+ borderBottom: `1px solid ${theme.colors.border}`,
50677
+ borderLeft: activeEventIndex === eventIndex ? `4px solid ${theme.colors.primary}` : "4px solid transparent",
50678
+ fontSize: theme.fontSizes[1],
50679
+ lineHeight: "1.7",
50680
+ fontWeight: 500,
50681
+ transition: "background-color 0.2s ease, border-color 0.2s ease",
50682
+ color: theme.colors.text
50683
+ },
50684
+ children: [
50685
+ renderFormattedText(renderedText),
50686
+ /* @__PURE__ */ jsx(SourceFileList, { sources: getEventSources(event.name), onSourceClick })
50687
+ ]
50688
+ }
50689
+ )
50690
+ },
50691
+ `event-${eventIndex}`
50632
50692
  )
50633
- },
50634
- `event-${eventIndex}`
50635
- )
50636
- );
50693
+ );
50694
+ });
50695
+ }
50696
+ });
50697
+ sortedEvents.forEach((event, eventIndex) => {
50698
+ if (renderedEventIndices.has(eventIndex)) return;
50637
50699
  });
50638
50700
  }
50639
50701
  if (showOnlySummary && scenario.template.summary) {