Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-dev"
version = "0.0.57"
version = "0.0.58"
description = "UiPath Developer Console"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,14 @@ function DataSection({
{copyText && (
<button
onClick={copy}
className="ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded"
className="ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors"
style={{
color: copied ? "var(--success)" : "var(--text-muted)",
background: "var(--bg-secondary)",
border: "1px solid var(--border)",
}}
onMouseEnter={(e) => { if (!copied) e.currentTarget.style.color = "var(--text-primary)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = copied ? "var(--success)" : "var(--text-muted)"; }}
>
{copied ? "Copied" : "Copy"}
</button>
Expand Down
212 changes: 122 additions & 90 deletions src/uipath/dev/server/frontend/src/components/traces/SpanDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ function tryParseJson(value: unknown): string | null {
return null;
}

function formatDuration(ms: number): string {
if (ms < 1) return `${(ms * 1000).toFixed(0)}us`;
if (ms < 1000) return `${ms.toFixed(2)}ms`;
if (ms < 60000) return `${(ms / 1000).toFixed(2)}s`;
const mins = Math.floor(ms / 60000);
const secs = ((ms % 60000) / 1000).toFixed(1);
return `${mins}m ${secs}s`;
}

const TRUNCATE_LIMIT = 200;

function stringifyValue(value: unknown): string {
Expand Down Expand Up @@ -112,12 +103,16 @@ function AttributeValue({ value }: { value: unknown }) {
export default function SpanDetails({ span }: Props) {
const [attrsOpen, setAttrsOpen] = useState(true);
const [idsOpen, setIdsOpen] = useState(false);
const [detailMode, setDetailMode] = useState<"table" | "json">("table");
const [copied, setCopied] = useState(false);
const status = STATUS_CONFIG[span.status.toLowerCase()] ?? { ...DEFAULT_STATUS, label: span.status };

const time = new Date(span.timestamp).toLocaleTimeString(undefined, {
hour12: false,
fractionalSecondDigits: 3,
} as Intl.DateTimeFormatOptions);
const spanJson = useMemo(() => JSON.stringify(span, null, 2), [span]);
const copySpanJson = useCallback(() => {
navigator.clipboard.writeText(spanJson).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 1500);
});
}, [spanJson]);

const attrEntries = Object.entries(span.attributes);
const ids: { label: string; value: string }[] = [
Expand All @@ -128,17 +123,38 @@ export default function SpanDetails({ span }: Props) {
];

return (
<div className="overflow-y-auto h-full text-xs leading-normal">
{/* Header: name + pills */}
<div className="flex flex-col h-full text-xs leading-normal">
{/* Header: tabs + status pill — fixed */}
<div
className="px-2 py-1.5 border-b flex items-center gap-2 flex-wrap"
style={{ borderColor: "var(--border)", background: "var(--bg-secondary)" }}
className="px-2 border-b flex items-center gap-1 shrink-0"
style={{ borderColor: "var(--border)", background: "var(--bg-secondary)", height: "28px" }}
>
<span className="text-xs font-semibold mr-auto" style={{ color: "var(--text-primary)" }}>
{span.span_name}
</span>
<button
onClick={() => setDetailMode("table")}
className="px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center"
style={{
color: detailMode === "table" ? "var(--accent)" : "var(--text-muted)",
background: detailMode === "table" ? "color-mix(in srgb, var(--accent) 10%, transparent)" : "transparent",
}}
onMouseEnter={(e) => { if (detailMode !== "table") e.currentTarget.style.color = "var(--text-primary)"; }}
onMouseLeave={(e) => { if (detailMode !== "table") e.currentTarget.style.color = "var(--text-muted)"; }}
>
Table
</button>
<button
onClick={() => setDetailMode("json")}
className="px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center"
style={{
color: detailMode === "json" ? "var(--accent)" : "var(--text-muted)",
background: detailMode === "json" ? "color-mix(in srgb, var(--accent) 10%, transparent)" : "transparent",
}}
onMouseEnter={(e) => { if (detailMode !== "json") e.currentTarget.style.color = "var(--text-primary)"; }}
onMouseLeave={(e) => { if (detailMode !== "json") e.currentTarget.style.color = "var(--text-muted)"; }}
>
JSON
</button>
<span
className="shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider"
className="ml-auto shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider"
style={{
background: `color-mix(in srgb, ${status.color} 15%, var(--bg-secondary))`,
color: status.color,
Expand All @@ -147,87 +163,103 @@ export default function SpanDetails({ span }: Props) {
<span className="inline-block w-1.5 h-1.5 rounded-full" style={{ background: status.color }} />
{status.label}
</span>
{span.duration_ms != null && (
<span className="shrink-0 font-mono text-[11px] font-semibold" style={{ color: "var(--warning)" }}>
{formatDuration(span.duration_ms)}
</span>
)}
<span className="shrink-0 font-mono text-[11px]" style={{ color: "var(--text-muted)" }}>
{time}
</span>
</div>

{/* Attributes — collapsible */}
{attrEntries.length > 0 && (
{/* Scrollable content */}
<div className="overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5">
{detailMode === "table" ? (
<>
<div
className="px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center"
style={{ color: "var(--accent)", borderColor: "var(--border)", background: "var(--bg-secondary)" }}
onClick={() => setAttrsOpen((o) => !o)}
>
<span className="flex-1">Attributes ({attrEntries.length})</span>
<span style={{ color: "var(--text-muted)", transform: attrsOpen ? "rotate(0deg)" : "rotate(-90deg)" }}>
&#x25BE;
</span>
</div>
{attrsOpen && attrEntries.map(([key, value], idx) => (
{/* Attributes — collapsible */}
{attrEntries.length > 0 && (
<>
<div
key={key}
className="flex gap-2 px-2 py-1 items-start border-b"
style={{
borderColor: "var(--border)",
background: idx % 2 === 0 ? "var(--bg-primary)" : "var(--bg-secondary)",
}}
className="px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center"
style={{ color: "var(--accent)", borderColor: "var(--border)", background: "var(--bg-secondary)" }}
onClick={() => setAttrsOpen((o) => !o)}
>
<span
className="font-mono font-semibold shrink-0 pt-px truncate text-[11px]"
style={{ color: "var(--info)", width: "35%" }}
title={key}
>
{key}
</span>
<span className="flex-1 min-w-0">
<AttributeValue value={value} />
<span className="flex-1">Attributes ({attrEntries.length})</span>
<span style={{ color: "var(--text-muted)", transform: attrsOpen ? "rotate(0deg)" : "rotate(-90deg)" }}>
&#x25BE;
</span>
</div>
))}
</>
)}
{attrsOpen && attrEntries.map(([key, value], idx) => (
<div
key={key}
className="flex gap-2 px-2 py-1 items-start border-b"
style={{
borderColor: "var(--border)",
background: idx % 2 === 0 ? "var(--bg-primary)" : "var(--bg-secondary)",
}}
>
<span
className="font-mono font-semibold shrink-0 pt-px truncate text-[11px]"
style={{ color: "var(--info)", width: "35%" }}
title={key}
>
{key}
</span>
<span className="flex-1 min-w-0">
<AttributeValue value={value} />
</span>
</div>
))}
</>
)}

{/* Identifiers — collapsible */}
<div
className="px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center"
style={{ color: "var(--accent)", borderColor: "var(--border)", background: "var(--bg-secondary)" }}
onClick={() => setIdsOpen((o) => !o)}
>
<span className="flex-1">Identifiers ({ids.length})</span>
<span style={{ color: "var(--text-muted)", transform: idsOpen ? "rotate(0deg)" : "rotate(-90deg)" }}>
&#x25BE;
</span>
</div>
{idsOpen && ids.map((id, idx) => (
{/* Identifiers — collapsible */}
<div
key={id.label}
className="flex gap-2 px-2 py-1 items-start border-b"
style={{
borderColor: "var(--border)",
background: idx % 2 === 0 ? "var(--bg-primary)" : "var(--bg-secondary)",
}}
className="px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center"
style={{ color: "var(--accent)", borderColor: "var(--border)", background: "var(--bg-secondary)" }}
onClick={() => setIdsOpen((o) => !o)}
>
<span
className="font-mono font-semibold shrink-0 pt-px truncate text-[11px]"
style={{ color: "var(--info)", width: "35%" }}
title={id.label}
>
{id.label}
<span className="flex-1">Identifiers ({ids.length})</span>
<span style={{ color: "var(--text-muted)", transform: idsOpen ? "rotate(0deg)" : "rotate(-90deg)" }}>
&#x25BE;
</span>
<span className="flex-1 min-w-0">
<span className="font-mono text-[11px] break-all" style={{ color: "var(--text-primary)" }}>
{id.value}
</div>
{idsOpen && ids.map((id, idx) => (
<div
key={id.label}
className="flex gap-2 px-2 py-1 items-start border-b"
style={{
borderColor: "var(--border)",
background: idx % 2 === 0 ? "var(--bg-primary)" : "var(--bg-secondary)",
}}
>
<span
className="font-mono font-semibold shrink-0 pt-px truncate text-[11px]"
style={{ color: "var(--info)", width: "35%" }}
title={id.label}
>
{id.label}
</span>
</span>
<span className="flex-1 min-w-0">
<span className="font-mono text-[11px] break-all" style={{ color: "var(--text-primary)" }}>
{id.value}
</span>
</span>
</div>
))}
</>
) : (
<div className="relative">
<button
onClick={copySpanJson}
className="absolute top-1 right-1 z-10 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors"
style={{
color: copied ? "var(--success)" : "var(--text-muted)",
background: "var(--bg-secondary)",
border: "1px solid var(--border)",
}}
onMouseEnter={(e) => { if (!copied) e.currentTarget.style.color = "var(--text-primary)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = copied ? "var(--success)" : "var(--text-muted)"; }}
>
{copied ? "Copied!" : "Copy"}
</button>
<JsonHighlight json={spanJson} className="font-mono text-[11px] whitespace-pre-wrap p-2" style={{}} />
</div>
))}
)}
</div>
</div>
);
}
Loading