@mastra/playground-ui 5.0.1-alpha.3 → 5.0.1-alpha.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.
@@ -25,5 +25,6 @@ export interface RowProps {
25
25
  className?: string;
26
26
  children: React.ReactNode;
27
27
  selected?: boolean;
28
+ onClick?: () => void;
28
29
  }
29
- export declare const Row: ({ className, children, selected }: RowProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const Row: ({ className, children, selected, onClick }: RowProps) => import("react/jsx-runtime").JSX.Element;
package/dist/index.cjs.js CHANGED
@@ -5125,8 +5125,20 @@ const Th = ({ className, children, ...props }) => {
5125
5125
  const Tbody = ({ className, children }) => {
5126
5126
  return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: clsx("", className), children });
5127
5127
  };
5128
- const Row = ({ className, children, selected = false }) => {
5129
- return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: clsx("border-b-sm border-border1 hover:bg-surface3", selected && "bg-surface4", className), children });
5128
+ const Row = ({ className, children, selected = false, onClick }) => {
5129
+ return /* @__PURE__ */ jsxRuntime.jsx(
5130
+ "tr",
5131
+ {
5132
+ className: clsx(
5133
+ "border-b-sm border-border1 hover:bg-surface3",
5134
+ selected && "bg-surface4",
5135
+ onClick && "cursor-pointer",
5136
+ className
5137
+ ),
5138
+ onClick,
5139
+ children
5140
+ }
5141
+ );
5130
5142
  };
5131
5143
 
5132
5144
  const variants = {
@@ -5219,7 +5231,8 @@ const TracesTableError = ({ error, colsCount }) => {
5219
5231
  };
5220
5232
  const TraceRow = ({ trace, index, isActive }) => {
5221
5233
  const { openTrace } = useOpenTrace();
5222
- return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", children: [
5234
+ const hasFailure = trace.trace.some((span) => span.status.code !== 0);
5235
+ return /* @__PURE__ */ jsxRuntime.jsxs(Row, { className: isActive ? "bg-surface4" : "", onClick: () => openTrace(trace.trace, index), children: [
5223
5236
  /* @__PURE__ */ jsxRuntime.jsx(DateTimeCell, { dateTime: new Date(trace.started / 1e3) }),
5224
5237
  /* @__PURE__ */ jsxRuntime.jsx(TxtCell, { children: trace.traceId }),
5225
5238
  /* @__PURE__ */ jsxRuntime.jsx(UnitCell, { unit: "ms", children: trace.duration / 1e3 }),
@@ -5227,7 +5240,8 @@ const TraceRow = ({ trace, index, isActive }) => {
5227
5240
  trace.trace.length,
5228
5241
  " span",
5229
5242
  trace.trace.length > 1 ? "s" : ""
5230
- ] }) }) })
5243
+ ] }) }) }),
5244
+ /* @__PURE__ */ jsxRuntime.jsx(Cell, { children: hasFailure ? /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" }) : /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}), variant: "success", children: "Success" }) })
5231
5245
  ] });
5232
5246
  };
5233
5247
  const TracesTable = ({ traces, isLoading, error }) => {
@@ -5239,7 +5253,8 @@ const TracesTable = ({ traces, isLoading, error }) => {
5239
5253
  /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Time" }),
5240
5254
  /* @__PURE__ */ jsxRuntime.jsx(Th, { width: "auto", children: "Trace Id" }),
5241
5255
  /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Duration" }),
5242
- /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" })
5256
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Spans" }),
5257
+ /* @__PURE__ */ jsxRuntime.jsx(Th, { width: 160, children: "Status" })
5243
5258
  ] }),
5244
5259
  isLoading ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableSkeleton, { colsCount }) : error ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableError, { error, colsCount }) : hasNoTraces ? /* @__PURE__ */ jsxRuntime.jsx(TracesTableEmpty, { colsCount }) : /* @__PURE__ */ jsxRuntime.jsx(Tbody, { children: traces.map((trace, index) => /* @__PURE__ */ jsxRuntime.jsx(TraceRow, { trace, index, isActive: index === currentTraceIndex }, trace.traceId)) })
5245
5260
  ] });
@@ -5551,6 +5566,7 @@ function TraceDetails() {
5551
5566
  const { trace, currentTraceIndex, prevTrace, nextTrace, traces, clearData } = React.useContext(TraceContext);
5552
5567
  const actualTrace = traces[currentTraceIndex];
5553
5568
  if (!actualTrace || !trace) return null;
5569
+ const hasFailure = trace.some((span) => span.status.code !== 0);
5554
5570
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { children: [
5555
5571
  /* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
5556
5572
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
@@ -5565,10 +5581,13 @@ function TraceDetails() {
5565
5581
  }
5566
5582
  )
5567
5583
  ] }),
5568
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5", children: [
5569
- "Trace ",
5570
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
5571
- ] }) })
5584
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 justify-between w-full", children: [
5585
+ /* @__PURE__ */ jsxRuntime.jsxs(Txt, { variant: "ui-lg", className: "font-medium text-icon5 shrink-0", children: [
5586
+ "Trace ",
5587
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-icon3", children: actualTrace.traceId.substring(0, 5) })
5588
+ ] }),
5589
+ hasFailure && /* @__PURE__ */ jsxRuntime.jsx(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: "Failed" })
5590
+ ] })
5572
5591
  ] }),
5573
5592
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-5", children: /* @__PURE__ */ jsxRuntime.jsx(SpanView, { trace }) })
5574
5593
  ] });
@@ -5629,7 +5648,11 @@ function SpanDetail() {
5629
5648
  /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "lg", className: "bg-surface4 p-1 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(SpanIcon, { className: variantClass }) }),
5630
5649
  span.name
5631
5650
  ] }),
5632
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), children: [
5651
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-2 items-center", children: span.status.code === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { icon: /* @__PURE__ */ jsxRuntime.jsx(LatencyIcon, {}), variant: "success", children: [
5652
+ formatDuration(span.duration),
5653
+ "ms"
5654
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Badge$1, { variant: "error", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}), children: [
5655
+ "Failed in ",
5633
5656
  formatDuration(span.duration),
5634
5657
  "ms"
5635
5658
  ] }) }),