@localstack/appinspector-ui 1.0.200 → 1.0.201

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
@@ -15699,6 +15699,7 @@ var NATIVE_SCROLLBARS = {
15699
15699
  // src/components/spans-list/spans-filter-bar.tsx
15700
15700
  var import_jsx_runtime126 = require("react/jsx-runtime");
15701
15701
  var SHOW_EXCLUSIONS = false;
15702
+ var SHOW_PRODUCER = false;
15702
15703
  var toggle = (list, item) => list.includes(item) ? list.filter((other) => other !== item) : [...list, item];
15703
15704
  var FilterDropdown = ({ "data-testid": testId, label, onChange, options, value }) => {
15704
15705
  const [anchorElement, setAnchorElement] = (0, import_react37.useState)();
@@ -15881,7 +15882,7 @@ var SpansFilterBar = ({ facets, onQueryChange, query: query2, totalCount }) => {
15881
15882
  };
15882
15883
  return (
15883
15884
  // Its controls wrap as items of the parent's controls row.
15884
- /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_material6.Box, { sx: { display: "contents" }, children: [
15885
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(import_jsx_runtime126.Fragment, { children: [
15885
15886
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
15886
15887
  StatusFilter,
15887
15888
  {
@@ -15892,7 +15893,7 @@ var SpansFilterBar = ({ facets, onQueryChange, query: query2, totalCount }) => {
15892
15893
  value: getQueryValues(query2, "status")
15893
15894
  }
15894
15895
  ),
15895
- dropdown("producer", "Producer", facets.producer, (facet) => facet.value === EXTERNAL_PRODUCER ? { label: "External producer" } : { label: getServiceDisplayName(facet.value), serviceCode: facet.value }, FILTER_PRODUCER_TEST_ID),
15896
+ SHOW_PRODUCER && dropdown("producer", "Producer", facets.producer, (facet) => facet.value === EXTERNAL_PRODUCER ? { label: "External producer" } : { label: getServiceDisplayName(facet.value), serviceCode: facet.value }, FILTER_PRODUCER_TEST_ID),
15896
15897
  dropdown("service", "Consumer", facets.service, (facet) => ({ label: getServiceDisplayName(facet.value), serviceCode: facet.value }), FILTER_CONSUMER_TEST_ID)
15897
15898
  ] })
15898
15899
  );
@@ -15923,6 +15924,7 @@ var NoMatchRow = ({ colSpan, filtersActive, onClearAll, searchActive, term }) =>
15923
15924
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Button, { onClick: onClearAll, size: "small", variant: "text", children: clearLabel })
15924
15925
  ] }) }) });
15925
15926
  };
15927
+ var SEARCH_FLEX_BASIS_PX = 160;
15926
15928
  var SpansSearchField = ({ onChange, onClear, value }) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
15927
15929
  import_material7.TextField,
15928
15930
  {
@@ -16093,7 +16095,7 @@ var SpansDataGrid = ({
16093
16095
  id: "request",
16094
16096
  size: 128
16095
16097
  }),
16096
- columnHelper.display({
16098
+ ...SHOW_PRODUCER ? [columnHelper.display({
16097
16099
  cell: (props) => {
16098
16100
  if (!props.row.original.parent_service_name || !props.row.original.parent_resource_name) {
16099
16101
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Typography, { sx: { fontStyle: "italic" }, variant: "body2", children: "External producer" });
@@ -16109,7 +16111,7 @@ var SpansDataGrid = ({
16109
16111
  header: "Producer",
16110
16112
  id: "producer",
16111
16113
  size: 180
16112
- }),
16114
+ })] : [],
16113
16115
  columnHelper.accessor("operation_name", {
16114
16116
  cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16115
16117
  import_material7.Box,
@@ -16173,6 +16175,26 @@ var SpansDataGrid = ({
16173
16175
  const totalVirtualSize = virtualizer.getTotalSize();
16174
16176
  const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
16175
16177
  const paddingBottom = virtualItems.length > 0 ? totalVirtualSize - (virtualItems.at(-1)?.end ?? 0) : totalVirtualSize;
16178
+ const controlsRef = (0, import_react38.useRef)(null);
16179
+ const filtersRef = (0, import_react38.useRef)(null);
16180
+ const clearRef = (0, import_react38.useRef)(null);
16181
+ const [controlsOnOneLine, setControlsOnOneLine] = (0, import_react38.useState)(false);
16182
+ (0, import_react38.useLayoutEffect)(() => {
16183
+ const controls = controlsRef.current;
16184
+ const filters = filtersRef.current;
16185
+ const clear = clearRef.current;
16186
+ if (!controls || !filters || !clear) return;
16187
+ const observer = new ResizeObserver(() => {
16188
+ const gap = Number.parseFloat(getComputedStyle(controls).columnGap) || 0;
16189
+ const filterWidths = [...filters.children].map((child) => child.getBoundingClientRect().width);
16190
+ const neededWidth = SEARCH_FLEX_BASIS_PX + clear.getBoundingClientRect().width + filterWidths.reduce((sum2, width) => sum2 + width, 0) + gap * (filterWidths.length + 1);
16191
+ setControlsOnOneLine(neededWidth <= controls.getBoundingClientRect().width);
16192
+ });
16193
+ for (const element of [controls, clear, ...filters.children]) observer.observe(element);
16194
+ return () => {
16195
+ observer.disconnect();
16196
+ };
16197
+ }, []);
16176
16198
  const lastSpanId = spans?.at(-1)?.span_id;
16177
16199
  (0, import_react38.useLayoutEffect)(() => {
16178
16200
  handleScroll();
@@ -16186,8 +16208,8 @@ var SpansDataGrid = ({
16186
16208
  }, [order2, spans?.length, lastSpanId]);
16187
16209
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
16188
16210
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Grid, { item: true, xs: 12, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material7.Box, { sx: { display: "flex", flexDirection: "column", gap: "0.5rem", pt: 1, px: 1 }, children: [
16189
- /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material7.Box, { sx: { alignItems: "center", containerType: "inline-size", display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
16190
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { sx: { flex: "1 1 160px", maxWidth: 220, order: -1 }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16211
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material7.Box, { ref: controlsRef, sx: { alignItems: "center", display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
16212
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { sx: { flex: `1 1 ${String(SEARCH_FLEX_BASIS_PX)}px`, maxWidth: 220, order: -1 }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16191
16213
  SpansSearchField,
16192
16214
  {
16193
16215
  onChange: (value) => {
@@ -16197,7 +16219,7 @@ var SpansDataGrid = ({
16197
16219
  value: searchText
16198
16220
  }
16199
16221
  ) }),
16200
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16222
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { ref: filtersRef, sx: { display: "contents" }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16201
16223
  SpansFilterBar,
16202
16224
  {
16203
16225
  facets: compute.facets,
@@ -16205,8 +16227,8 @@ var SpansDataGrid = ({
16205
16227
  query: dropdownQuery,
16206
16228
  totalCount: compute.totalCount
16207
16229
  }
16208
- ),
16209
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { sx: { "@container (min-width: 960px)": { order: 1 }, "flexShrink": 0, "ml": "auto", "order": -1 }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16230
+ ) }),
16231
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { ref: clearRef, sx: { flexShrink: 0, ml: "auto", order: controlsOnOneLine ? 1 : -1 }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
16210
16232
  import_material7.Button,
16211
16233
  {
16212
16234
  "data-testid": CLEAR_SPANS_TEST_ID,
@@ -16216,7 +16238,7 @@ var SpansDataGrid = ({
16216
16238
  children: "Clear Operations"
16217
16239
  }
16218
16240
  ) }),
16219
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { sx: { "@container (min-width: 960px)": { display: "none" }, "flexBasis": "100%", "mt": "-0.5rem", "order": -1 } })
16241
+ !controlsOnOneLine && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_material7.Box, { sx: { flexBasis: "100%", mt: "-0.5rem", order: -1 } })
16220
16242
  ] }),
16221
16243
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_material7.Box, { sx: { alignItems: "center", display: "flex", gap: "0.5rem", pl: 0.5 }, children: [
16222
16244
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(