@localstack/appinspector-ui 1.0.89 → 1.0.91

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/index.js CHANGED
@@ -26527,12 +26527,13 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26527
26527
  requestPayload.MessageBody = tryParseJson(requestPayload.MessageBody);
26528
26528
  }
26529
26529
  }
26530
+ const isResponseSuppressed = selectedEvent.attributes?.["localstack.aws.service.response_suppressed"] === true;
26530
26531
  const responsePayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.response"]);
26531
26532
  if (parseNestedJson && isLambdaInvoke && responsePayload && typeof responsePayload === "object" && "Payload" in responsePayload) {
26532
26533
  responsePayload.Payload = tryParseJson(responsePayload.Payload);
26533
26534
  }
26534
26535
  const exceptionPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.exception"]);
26535
- const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0;
26536
+ const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0 || isResponseSuppressed;
26536
26537
  const duration = selectedEvent.end_time_unix_nano ? ((BigInt(selectedEvent.end_time_unix_nano) - BigInt(selectedEvent.start_time_unix_nano)) / BigInt("1000000")).toString() : void 0;
26537
26538
  return /* @__PURE__ */ jsxs130(Box14, { "data-testid": EVENT_DETAILS_TEST_ID, sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
26538
26539
  /* @__PURE__ */ jsxs130(
@@ -26638,9 +26639,9 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26638
26639
  /* @__PURE__ */ jsx137(Typography10, { sx: { fontWeight: 600 }, variant: "caption", children: "Request" }),
26639
26640
  /* @__PURE__ */ jsx137(PayloadViewer, { testId: EVENT_DETAILS_REQUEST_PAYLOAD, value: requestPayload })
26640
26641
  ] }),
26641
- responsePayload !== void 0 && /* @__PURE__ */ jsxs130(Box14, { children: [
26642
+ (responsePayload !== void 0 || isResponseSuppressed) && /* @__PURE__ */ jsxs130(Box14, { children: [
26642
26643
  /* @__PURE__ */ jsx137(Typography10, { sx: { fontWeight: 600 }, variant: "caption", children: "Response" }),
26643
- /* @__PURE__ */ jsx137(PayloadViewer, { testId: EVENT_DETAILS_RESPONSE_PAYLOAD_TEST_ID, value: responsePayload })
26644
+ isResponseSuppressed ? /* @__PURE__ */ jsx137(Box14, { sx: { py: 1 }, children: /* @__PURE__ */ jsx137(Alert3, { severity: "warning", sx: { mb: 1 }, children: "Response payload is available \u2014 upgrade your license to view" }) }) : /* @__PURE__ */ jsx137(PayloadViewer, { testId: EVENT_DETAILS_RESPONSE_PAYLOAD_TEST_ID, value: responsePayload })
26644
26645
  ] }),
26645
26646
  exceptionPayload !== void 0 && /* @__PURE__ */ jsxs130(Box14, { children: [
26646
26647
  /* @__PURE__ */ jsx137(Typography10, { sx: { fontWeight: 600 }, variant: "caption", children: "Exception" }),
@@ -26684,7 +26685,7 @@ var EventDetails = ({ onClose, selectedEvent }) => {
26684
26685
  };
26685
26686
  var PayloadViewer = memo10(({ testId, value }) => {
26686
26687
  const theme = useTheme3();
26687
- return /* @__PURE__ */ jsx137(Box14, { "data-testid": testId, sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", p: 1 }, children: /* @__PURE__ */ jsx137(
26688
+ return /* @__PURE__ */ jsx137(Box14, { "data-testid": testId, sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", py: 1 }, children: /* @__PURE__ */ jsx137(
26688
26689
  JsonViewer,
26689
26690
  {
26690
26691
  displayDataTypes: false,
@@ -26853,19 +26854,44 @@ var ServiceNode = memo11(({ data, selected }) => {
26853
26854
 
26854
26855
  // src/components/trace-graph/utils.ts
26855
26856
  import dagre from "@dagrejs/dagre";
26856
- var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
26857
+ var getLayoutedNodesAndEdges = (inputNodes, inputEdges, order2 = "oldest_first") => {
26857
26858
  const dagreGraph = new dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
26858
26859
  const direction = "LR";
26859
26860
  const nodeWidth = 200;
26860
26861
  const nodeHeight = 70;
26861
26862
  dagreGraph.setGraph({ rankdir: direction });
26863
+ const timestampMap = new Map(
26864
+ inputNodes.map((n2) => [n2.id, n2.data.event.start_time_unix_nano])
26865
+ );
26862
26866
  for (const node of inputNodes) {
26863
26867
  dagreGraph.setNode(node.id, { height: nodeHeight, width: nodeWidth });
26864
26868
  }
26865
26869
  for (const edge of inputEdges) {
26866
26870
  dagreGraph.setEdge(edge.source, edge.target);
26867
26871
  }
26868
- dagre.layout(dagreGraph);
26872
+ dagre.layout(dagreGraph, {
26873
+ customOrder: (g2) => {
26874
+ const rankMap = /* @__PURE__ */ new Map();
26875
+ for (const nodeId of g2.nodes()) {
26876
+ const rank = g2.node(nodeId).rank;
26877
+ if (rank === void 0) continue;
26878
+ const group4 = rankMap.get(rank) ?? [];
26879
+ group4.push(nodeId);
26880
+ rankMap.set(rank, group4);
26881
+ }
26882
+ for (const nodeIds of rankMap.values()) {
26883
+ nodeIds.sort((a3, b3) => {
26884
+ const tsA = timestampMap.get(a3) ?? "";
26885
+ const tsB = timestampMap.get(b3) ?? "";
26886
+ return order2 === "newest_first" ? tsB.localeCompare(tsA) : tsA.localeCompare(tsB);
26887
+ });
26888
+ for (const [index, nodeId] of nodeIds.entries()) {
26889
+ ;
26890
+ g2.node(nodeId).order = index;
26891
+ }
26892
+ }
26893
+ }
26894
+ });
26869
26895
  const layoutedNodes = inputNodes.map((node) => {
26870
26896
  const nodeWithPosition = dagreGraph.node(node.id);
26871
26897
  return {
@@ -26961,6 +26987,7 @@ var TraceGraph = ({
26961
26987
  initialFocusEventId,
26962
26988
  onEventSelect,
26963
26989
  onRefresh,
26990
+ order: order2 = "oldest_first",
26964
26991
  spans
26965
26992
  }) => {
26966
26993
  const [nodes, setNodes, onNodesChange] = useNodesState([]);
@@ -27006,7 +27033,7 @@ var TraceGraph = ({
27006
27033
  });
27007
27034
  }
27008
27035
  }
27009
- const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
27036
+ const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges, order2);
27010
27037
  for (const node of layoutedNodes) {
27011
27038
  if (node.id === initialFocusEventId) {
27012
27039
  node.selected = true;
@@ -27014,7 +27041,7 @@ var TraceGraph = ({
27014
27041
  }
27015
27042
  setNodes(layoutedNodes);
27016
27043
  setEdges(layoutedEdges);
27017
- }, [spans.data, initialFocusEventId, setNodes, setEdges]);
27044
+ }, [spans.data, initialFocusEventId, order2, setNodes, setEdges]);
27018
27045
  const theme = useTheme4();
27019
27046
  return /* @__PURE__ */ jsxs133(Fragment9, { children: [
27020
27047
  spans.error && /* @__PURE__ */ jsxs133(
@@ -27105,6 +27132,7 @@ var TraceGraphView = ({
27105
27132
  loading,
27106
27133
  navigateToSpansList,
27107
27134
  open,
27135
+ order: order2,
27108
27136
  selectedEvent,
27109
27137
  spanId,
27110
27138
  spans,
@@ -27166,6 +27194,7 @@ var TraceGraphView = ({
27166
27194
  onRefresh: () => {
27167
27195
  fetchSpans();
27168
27196
  },
27197
+ order: order2,
27169
27198
  spans: {
27170
27199
  data: spans,
27171
27200
  error: fetchError,
@@ -27217,7 +27246,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
27217
27246
  }
27218
27247
  return [...allSpans.values()];
27219
27248
  }
27220
- var TraceGraphPage = ({ onClose, spanId, traceId }) => {
27249
+ var TraceGraphPage = ({ onClose, order: order2 = "oldest_first", spanId, traceId }) => {
27221
27250
  const api = useAppInspectorApi();
27222
27251
  const [spans, setSpans] = useState17();
27223
27252
  const [loading, setLoading] = useState17(false);
@@ -27277,6 +27306,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
27277
27306
  loading,
27278
27307
  navigateToSpansList,
27279
27308
  open,
27309
+ order: order2,
27280
27310
  selectedEvent,
27281
27311
  spanId: spanId ?? void 0,
27282
27312
  spans,
@@ -27380,7 +27410,7 @@ var SpansListPage = () => {
27380
27410
  ),
27381
27411
  selectedTraceId !== void 0 && /* @__PURE__ */ jsx143(TraceGraphPage, { onClose: () => {
27382
27412
  setSelectedTraceId(void 0);
27383
- }, spanId: selectedSpanId, traceId: selectedTraceId })
27413
+ }, order: order2, spanId: selectedSpanId, traceId: selectedTraceId })
27384
27414
  ] });
27385
27415
  };
27386
27416