@localstack/appinspector-ui 1.0.61 → 1.0.63

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.cjs CHANGED
@@ -12145,8 +12145,8 @@ ServiceCell.displayName = "ServiceCell";
12145
12145
  var import_jsx_runtime124 = require("react/jsx-runtime");
12146
12146
  var columnHelper = createColumnHelper();
12147
12147
  var newSpanBackgroundColor = {
12148
- dark: "#887b02",
12149
- light: "#ffde7b"
12148
+ dark: { from: "rgba(136, 123, 2, 1)", to: "rgba(136, 123, 2, 0)" },
12149
+ light: { from: "rgba(255, 222, 123, 1)", to: "rgba(255, 222, 123, 0)" }
12150
12150
  };
12151
12151
  var LABEL_BEGINNING_OF_STREAM = "This is the beginning of the stream";
12152
12152
  var LABEL_END_OF_STREAM = "This is the end of the stream";
@@ -12165,11 +12165,11 @@ var SpansDataGridRow = (0, import_react40.memo)(
12165
12165
  import_material4.TableRow,
12166
12166
  {
12167
12167
  animate: {
12168
- backgroundColor: "transparent"
12168
+ backgroundColor: theme.palette.mode === "light" ? newSpanBackgroundColor.light.to : newSpanBackgroundColor.dark.to
12169
12169
  },
12170
12170
  component: motion.tr,
12171
12171
  initial: {
12172
- backgroundColor: theme.palette.mode === "light" ? newSpanBackgroundColor.light : newSpanBackgroundColor.dark
12172
+ backgroundColor: theme.palette.mode === "light" ? newSpanBackgroundColor.light.from : newSpanBackgroundColor.dark.from
12173
12173
  },
12174
12174
  sx: {
12175
12175
  transition: "background-color 1200ms ease-in"
@@ -12221,8 +12221,10 @@ var SpansDataGrid = ({
12221
12221
  onFetchForward,
12222
12222
  onOrderChange,
12223
12223
  onSpanClick,
12224
+ onToggleStream,
12224
12225
  order: order2,
12225
- spans
12226
+ spans,
12227
+ streamPaused
12226
12228
  }) => {
12227
12229
  const columns = (0, import_react40.useMemo)(() => [
12228
12230
  columnHelper.accessor("trace_id", {
@@ -12311,6 +12313,21 @@ var SpansDataGrid = ({
12311
12313
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
12312
12314
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.Grid, { item: true, xs: 12, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_material4.Box, { sx: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
12313
12315
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_material4.Box, { sx: { flexGrow: 1 } }),
12316
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12317
+ import_material4.FormControlLabel,
12318
+ {
12319
+ control: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12320
+ import_material4.Button,
12321
+ {
12322
+ onClick: onToggleStream,
12323
+ startIcon: streamPaused ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_icons_material.PlayArrowOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_icons_material.PauseOutlined, {}),
12324
+ variant: "text",
12325
+ children: streamPaused ? "Resume Stream" : "Pause Stream"
12326
+ }
12327
+ ),
12328
+ label: ""
12329
+ }
12330
+ ),
12314
12331
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12315
12332
  import_material4.FormControlLabel,
12316
12333
  {
@@ -12447,9 +12464,10 @@ var SpansList = (props) => {
12447
12464
  onFetchForward: props.onFetchForward,
12448
12465
  onOrderChange: props.onOrderChange,
12449
12466
  onSpanClick: props.onSpanClick,
12467
+ onToggleStream: props.onToggleStream,
12450
12468
  order: props.order,
12451
- refetching: props.refetching,
12452
- spans: props.spans
12469
+ spans: props.spans,
12470
+ streamPaused: props.streamPaused
12453
12471
  }
12454
12472
  )
12455
12473
  ] });
@@ -12899,7 +12917,6 @@ var createPaginationBuffer = (options) => {
12899
12917
  let hasMoreBackward = void 0;
12900
12918
  let fetchingForward = false;
12901
12919
  let fetchingBackward = false;
12902
- const refetching = false;
12903
12920
  const reportDataChange = () => {
12904
12921
  options.onDataChange({
12905
12922
  hasMoreBackward: hasMoreBackward ?? false,
@@ -12910,8 +12927,7 @@ var createPaginationBuffer = (options) => {
12910
12927
  const reportStatusChange = () => {
12911
12928
  options.onStatusChange?.({
12912
12929
  fetchingBackward,
12913
- fetchingForward,
12914
- refetching
12930
+ fetchingForward
12915
12931
  });
12916
12932
  };
12917
12933
  const reportError = (error) => {
@@ -12919,6 +12935,25 @@ var createPaginationBuffer = (options) => {
12919
12935
  };
12920
12936
  let fetchForwardLater = false;
12921
12937
  let fetchBackwardLater = false;
12938
+ let fetchForwardSilentlyLater = false;
12939
+ const checkIfThereAreMoreItemsForward = async () => {
12940
+ if (hasMoreForward === true) {
12941
+ return;
12942
+ }
12943
+ fetchingForward = true;
12944
+ reportStatusChange();
12945
+ try {
12946
+ const newPage = await fetchPage(nextForwardToken);
12947
+ hasMoreForward = newPage.items.length > 0;
12948
+ reportDataChange();
12949
+ } catch (error) {
12950
+ reportError(error instanceof Error ? error : new Error("Failed to fetch forward page", { cause: error }));
12951
+ } finally {
12952
+ fetchingForward = false;
12953
+ reportStatusChange();
12954
+ }
12955
+ runPostFetchActions();
12956
+ };
12922
12957
  const fetchForward = async () => {
12923
12958
  fetchingForward = true;
12924
12959
  reportStatusChange();
@@ -12982,8 +13017,19 @@ var createPaginationBuffer = (options) => {
12982
13017
  fetchForwardLater = false;
12983
13018
  void fetchForward();
12984
13019
  }
13020
+ if (fetchForwardSilentlyLater) {
13021
+ fetchForwardSilentlyLater = false;
13022
+ void checkIfThereAreMoreItemsForward();
13023
+ }
12985
13024
  };
12986
13025
  return {
13026
+ checkIfThereAreMoreItemsForward: () => {
13027
+ if (fetchingForward || fetchingBackward) {
13028
+ fetchForwardSilentlyLater = true;
13029
+ return;
13030
+ }
13031
+ void checkIfThereAreMoreItemsForward();
13032
+ },
12987
13033
  clear: () => {
12988
13034
  if (items !== void 0) {
12989
13035
  items.length = 0;
@@ -13299,7 +13345,6 @@ var useSpans = () => {
13299
13345
  const [fetchError, setFetchError] = (0, import_react47.useState)();
13300
13346
  const [fetchingForward, setFetchingForward] = (0, import_react47.useState)(false);
13301
13347
  const [fetchingBackward, setFetchingBackward] = (0, import_react47.useState)(false);
13302
- const [refetching, setRefetching] = (0, import_react47.useState)(false);
13303
13348
  const paginationBuffer = (0, import_react47.useRef)(createPaginationBuffer({
13304
13349
  async fetchPage(token) {
13305
13350
  const response = await api.getSpans({
@@ -13326,7 +13371,6 @@ var useSpans = () => {
13326
13371
  onStatusChange(status2) {
13327
13372
  setFetchingBackward(status2.fetchingBackward);
13328
13373
  setFetchingForward(status2.fetchingForward);
13329
- setRefetching(status2.refetching);
13330
13374
  },
13331
13375
  // The spans endpoint is sorted by span ingestion time, which might differ from
13332
13376
  // the span timestamp. In order to accomodate for this, we will sort the spans
@@ -13360,9 +13404,19 @@ var useSpans = () => {
13360
13404
  setClearingSpans(false);
13361
13405
  }
13362
13406
  }, [paginationBuffer, api]);
13407
+ const [streamPaused, setStreamPaused] = (0, import_react47.useState)(false);
13408
+ const toggleStream = (0, import_react47.useCallback)(() => {
13409
+ setStreamPaused((previous) => !previous);
13410
+ }, []);
13363
13411
  useSpansWebSocket({
13364
13412
  onMessage: () => {
13365
- paginationBuffer.current.fetchForward();
13413
+ if (!hasMoreForward) {
13414
+ if (streamPaused) {
13415
+ paginationBuffer.current.checkIfThereAreMoreItemsForward();
13416
+ } else {
13417
+ paginationBuffer.current.fetchForward();
13418
+ }
13419
+ }
13366
13420
  }
13367
13421
  });
13368
13422
  return {
@@ -13376,10 +13430,11 @@ var useSpans = () => {
13376
13430
  fetchingForward,
13377
13431
  hasMoreBackward,
13378
13432
  hasMoreForward,
13379
- refetching,
13380
13433
  spans,
13381
13434
  status,
13382
- statusError
13435
+ statusError,
13436
+ streamPaused,
13437
+ toggleStream
13383
13438
  };
13384
13439
  };
13385
13440
 
@@ -14901,10 +14956,11 @@ var SpansListPage = () => {
14901
14956
  fetchingForward,
14902
14957
  hasMoreBackward,
14903
14958
  hasMoreForward,
14904
- refetching,
14905
14959
  spans,
14906
14960
  status,
14907
- statusError
14961
+ statusError,
14962
+ streamPaused,
14963
+ toggleStream
14908
14964
  } = useSpans();
14909
14965
  const clearSpansSync = (0, import_react62.useCallback)(() => {
14910
14966
  void clearSpans();
@@ -14957,9 +15013,10 @@ var SpansListPage = () => {
14957
15013
  onFetchForward: fetchForward,
14958
15014
  onOrderChange: setOrder,
14959
15015
  onSpanClick: navigateToSpan,
15016
+ onToggleStream: toggleStream,
14960
15017
  order: order2,
14961
- refetching,
14962
- spans
15018
+ spans,
15019
+ streamPaused
14963
15020
  }
14964
15021
  )
14965
15022
  }