fix: redesign session log player controls, fix tooltip overlap and drop dot separators

This commit is contained in:
LukeGus committed 2026-10-01 00:09:32 -05:00
1 parent b3c8f37c0d
commit 9015d5dccb
35 files changed
+434 -283

No files matched your search

+11 -5
View File
@@ -357,11 +357,17 @@ export function AiProviderSettings({
<div className="truncate text-sm font-medium"> <div className="truncate text-sm font-medium">
{provider.label} {provider.label}
</div> </div>
<div className="truncate text-xs text-muted-foreground"> <div className="flex gap-3 overflow-hidden whitespace-nowrap text-xs text-muted-foreground">
{provider.providerType} <span className="shrink-0">{provider.providerType}</span>
{provider.defaultModel ? ` · ${provider.defaultModel}` : ""} {provider.defaultModel && (
{provider.baseUrl ? ` · ${provider.baseUrl}` : ""} <span className="truncate">{provider.defaultModel}</span>
{provider.apiKeyPrefix ? ` · ${provider.apiKeyPrefix}…` : ""} )}
{provider.baseUrl && (
<span className="truncate">{provider.baseUrl}</span>
)}
{provider.apiKeyPrefix && (
<span className="shrink-0">{provider.apiKeyPrefix}…</span>
)}
</div> </div>
</div> </div>
<div className="flex shrink-0 items-center"> <div className="flex shrink-0 items-center">
@@ -428,15 +428,19 @@ export function AutomationsPanel({
</div> </div>
<div className="flex items-center gap-1 mt-1"> <div className="flex items-center gap-1 mt-1">
<span className="text-[11px] text-muted-foreground flex-1 truncate"> <span className="text-[11px] text-muted-foreground flex-1 flex gap-2.5 min-w-0 overflow-hidden whitespace-nowrap">
{row.definition {row.definition && (
? t( <span className="truncate">
{t(
`${base}.triggerKinds.${row.definition.trigger.kind}`, `${base}.triggerKinds.${row.definition.trigger.kind}`,
) )}
: ""} </span>
{row.last_run_status )}
? ` · ${timeAgo(row.last_run_at, t)}` {row.last_run_status && (
: ""} <span className="shrink-0">
{timeAgo(row.last_run_at, t)}
</span>
)}
</span> </span>
<Button <Button
variant="ghost" variant="ghost"
@@ -499,11 +503,11 @@ export function AutomationsPanel({
{t(`${base}.statuses.${entry.status}`)} {t(`${base}.statuses.${entry.status}`)}
</span> </span>
</div> </div>
<div className="text-[11px] text-muted-foreground"> <div className="flex gap-2.5 text-[11px] text-muted-foreground">
{timeAgo(entry.started_at, t)} <span>{timeAgo(entry.started_at, t)}</span>
{entry.duration_ms !== null {entry.duration_ms !== null && (
? ` · ${Math.round(entry.duration_ms / 100) / 10}s` <span>{Math.round(entry.duration_ms / 100) / 10}s</span>
: ""} )}
</div> </div>
{entry.error && ( {entry.error && (
<div className="text-[11px] text-destructive truncate"> <div className="text-[11px] text-destructive truncate">
@@ -41,7 +41,7 @@ function VisibleBadge({
return ( return (
<Badge <Badge
variant="outline" variant="outline"
title={`${active.reasons.join("; ")} · ${active.estimatedEnd}`} title={`${active.reasons.join("; ")}\n${active.estimatedEnd}`}
> >
{title} {title}
</Badge> </Badge>
@@ -121,9 +121,8 @@ function MaintenanceEditor({
return ( return (
<div className="mx-auto w-full max-w-3xl space-y-6 overflow-auto p-6"> <div className="mx-auto w-full max-w-3xl space-y-6 overflow-auto p-6">
<div> <div>
<h2 className="text-lg font-semibold"> <h2 className="text-lg font-semibold">{t("maintenance.title")}</h2>
{t("maintenance.title")} · {host.name || host.ip} <p className="text-sm font-medium">{host.name || host.ip}</p>
</h2>
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
{t("maintenance.description")} {t("maintenance.description")}
</p> </p>
@@ -308,12 +307,16 @@ function MaintenanceEditor({
> >
<div className="min-w-0 space-y-1"> <div className="min-w-0 space-y-1">
<p className="break-words">{plan.reason}</p> <p className="break-words">{plan.reason}</p>
<p className="text-sm text-muted-foreground"> <p className="flex flex-wrap gap-x-3 text-sm text-muted-foreground">
{t(`maintenance.${plan.recurrence}`)} ·{" "} <span>{t(`maintenance.${plan.recurrence}`)}</span>
{plan.nextStart <span>
? `${plan.nextStart.replace("T", " ").slice(0, 16)} UTC` {plan.nextStart
: t("maintenance.completed")}{" "} ? `${plan.nextStart.replace("T", " ").slice(0, 16)} UTC`
· {t("maintenance.minutes", { count: plan.durationMinutes })} : t("maintenance.completed")}
</span>
<span>
{t("maintenance.minutes", { count: plan.durationMinutes })}
</span>
</p> </p>
</div> </div>
{canEdit && ( {canEdit && (
@@ -144,11 +144,13 @@ function StorageMeter({
<span className="min-w-0 flex-1 truncate font-medium"> <span className="min-w-0 flex-1 truncate font-medium">
{fs.mount} {fs.mount}
</span> </span>
<span className="ml-auto shrink-0 whitespace-nowrap text-[10px] tabular-nums text-muted-foreground"> <span className="ml-auto flex shrink-0 gap-2 whitespace-nowrap text-[10px] tabular-nums text-muted-foreground">
{fs.usedHuman && fs.totalHuman <span>
? `${fs.usedHuman}/${fs.totalHuman}` {fs.usedHuman && fs.totalHuman
: "N/A"} ? `${fs.usedHuman}/${fs.totalHuman}`
{fs.percent != null ? ` · ${fs.percent}%` : ""} : "N/A"}
</span>
{fs.percent != null && <span>{fs.percent}%</span>}
</span> </span>
</DropdownMenuItem> </DropdownMenuItem>
))} ))}
@@ -77,8 +77,9 @@ export function AudioPreview({
<h3 className="font-semibold text-foreground text-lg mb-1"> <h3 className="font-semibold text-foreground text-lg mb-1">
{file.name.replace(/\.[^/.]+$/, "")} {file.name.replace(/\.[^/.]+$/, "")}
</h3> </h3>
<p className="text-sm text-muted-foreground"> <p className="flex justify-center gap-3 text-sm text-muted-foreground">
{ext.toUpperCase()} • {formatFileSize(file.size, t)} <span>{ext.toUpperCase()}</span>
<span>{formatFileSize(file.size, t)}</span>
</p> </p>
</div> </div>
@@ -132,7 +132,7 @@ export function CompressDialog({
key={index} key={index}
className="truncate text-foreground font-medium" className="truncate text-foreground font-medium"
> >
• {name} {name}
</li> </li>
))} ))}
{fileNames.length > 5 && ( {fileNames.length > 5 && (
@@ -58,11 +58,10 @@ export function LocalTransferProgressToast({
title={status.currentFileName} title={status.currentFileName}
> >
{(status.activeFiles ?? 0) > 1 && ( {(status.activeFiles ?? 0) > 1 && (
<span className="mr-1 text-foreground/70"> <span className="mr-2.5 text-foreground/70">
{t("fileManager.localTransferInFlight", { {t("fileManager.localTransferInFlight", {
count: status.activeFiles, count: status.activeFiles,
})} })}
{" · "}
</span> </span>
)} )}
{status.currentFileName} {status.currentFileName}
@@ -87,6 +87,6 @@ export function createFormatTransferMetrics(t: TFunction) {
}), }),
); );
} }
return parts.join(" · "); return parts.join(", ");
}; };
} }
@@ -256,15 +256,18 @@ export function FleetInventoryTab({
</select> </select>
{selectedFleet && ( {selectedFleet && (
<span className="text-[11px] text-muted-foreground"> <span className="flex gap-3 text-[11px] text-muted-foreground">
{t("newUi.sidebar.fleets.memberCount", { <span>
count: entries.length, {t("newUi.sidebar.fleets.memberCount", {
})}{" "} count: entries.length,
&middot;{" "} })}
{t("newUi.sidebar.fleets.inventoryCollectedCount", { </span>
count: collectedCount, <span>
total: entries.length, {t("newUi.sidebar.fleets.inventoryCollectedCount", {
})} count: collectedCount,
total: entries.length,
})}
</span>
</span> </span>
)} )}
@@ -178,8 +178,9 @@ function MetricsChartWidget({
<span className="text-[10px] font-semibold text-foreground truncate"> <span className="text-[10px] font-semibold text-foreground truncate">
{hostName ?? `Host #${hostId}`} {hostName ?? `Host #${hostId}`}
</span> </span>
<span className="text-[9px] text-muted-foreground"> <span className="flex gap-2 text-[9px] text-muted-foreground">
{label} · {range} <span className="truncate">{label}</span>
<span className="shrink-0">{range}</span>
</span> </span>
</div> </div>
{showCurrentValue && current != null && ( {showCurrentValue && current != null && (
@@ -66,11 +66,13 @@ export function FilesystemPicker({
{fs.mount} {fs.mount}
</span> </span>
)} )}
<span className="ml-auto shrink-0 whitespace-nowrap text-[10px] tabular-nums text-muted-foreground"> <span className="ml-auto flex shrink-0 gap-2 whitespace-nowrap text-[10px] tabular-nums text-muted-foreground">
{fs.usedHuman && fs.totalHuman <span>
? `${fs.usedHuman}/${fs.totalHuman}` {fs.usedHuman && fs.totalHuman
: "N/A"} ? `${fs.usedHuman}/${fs.totalHuman}`
{fs.percent != null ? ` · ${fs.percent}%` : ""} : "N/A"}
</span>
{fs.percent != null && <span>{fs.percent}%</span>}
</span> </span>
</DropdownMenuItem> </DropdownMenuItem>
))} ))}
@@ -39,7 +39,7 @@ function processVram(process: GpuProcess): string {
process.memoryUsedMiB === null process.memoryUsedMiB === null
? NA ? NA
: `${formatGiB(process.memoryUsedMiB)}G`; : `${formatGiB(process.memoryUsedMiB)}G`;
return process.gpuIndex === null ? vram : `${vram} · GPU ${process.gpuIndex}`; return process.gpuIndex === null ? vram : `${vram} (GPU ${process.gpuIndex})`;
} }
function executableName(path: string): string { function executableName(path: string): string {
@@ -42,7 +42,7 @@ export function ProcessesCard({ metrics }: { metrics: ServerMetrics | null }) {
<StatRow <StatRow
key={p.pid} key={p.pid}
label={p.command} label={p.command}
value={`${p.cpu}% cpu · ${p.mem}% mem`} value={`${p.cpu}% cpu, ${p.mem}% mem`}
mono mono
/> />
))} ))}
@@ -288,9 +288,13 @@ export function HealthCheckCard({ hostId }: { hostId: number | null }) {
: check.target} : check.target}
</span> </span>
</div> </div>
<span className="font-mono text-[10px] text-muted-foreground"> <span className="flex gap-2 font-mono text-[10px] text-muted-foreground">
{result?.latencyMs != null ? `${result.latencyMs}ms` : "—"} <span>
{upPct != null ? ` · ${upPct}%` : ""} {result?.latencyMs != null
? `${result.latencyMs}ms`
: "-"}
</span>
{upPct != null && <span>{upPct}%</span>}
</span> </span>
</div> </div>
{hist.length > 1 && ( {hist.length > 1 && (
@@ -160,7 +160,7 @@ export function ProcessInspectorCard({ hostId }: { hostId: number | null }) {
<span>{p.mem.toFixed(0)}%</span> <span>{p.mem.toFixed(0)}%</span>
<span <span
className="truncate" className="truncate"
title={`${p.user} · ${p.args}`} title={`${p.user}\n${p.args}`}
style={ style={
depth ? { paddingLeft: `${(depth * 12) / 14}rem` } : undefined depth ? { paddingLeft: `${(depth * 12) / 14}rem` } : undefined
} }
@@ -133,10 +133,12 @@ export function WireGuardManagerCard({ hostId }: { hostId: number | null }) {
<span className="text-xs font-semibold font-mono"> <span className="text-xs font-semibold font-mono">
{iface.name} {iface.name}
</span> </span>
<span className="text-[10px] text-muted-foreground"> <span className="flex gap-2 text-[10px] text-muted-foreground">
{iface.up ? "up" : "down"} <span>{iface.up ? "up" : "down"}</span>
{iface.listenPort ? ` · :${iface.listenPort}` : ""} {iface.listenPort ? <span>:{iface.listenPort}</span> : null}
{iface.peers.length > 0 ? ` · ${iface.peers.length}p` : ""} {iface.peers.length > 0 && (
<span>{iface.peers.length}p</span>
)}
</span> </span>
</div> </div>
</button> </button>
@@ -108,8 +108,8 @@ describe("GpuCard", () => {
const python = screen.getByText("python3"); const python = screen.getByText("python3");
expect(python).toHaveAttribute("title", "/usr/bin/python3"); expect(python).toHaveAttribute("title", "/usr/bin/python3");
expect(screen.getByText("7.7G · GPU 0")).toBeInTheDocument(); expect(screen.getByText("7.7G (GPU 0)")).toBeInTheDocument();
expect(screen.getByText("N/A · GPU 1")).toBeInTheDocument(); expect(screen.getByText("N/A (GPU 1)")).toBeInTheDocument();
}); });
it("says so when no process is using a GPU", () => { it("says so when no process is using a GPU", () => {
@@ -65,7 +65,7 @@ export function HostProxmoxTab({
}) })
: t("hosts.proxmoxLastSyncNoResult"); : t("hosts.proxmoxLastSyncNoResult");
const lastSyncDescription = cfg.lastSyncAt const lastSyncDescription = cfg.lastSyncAt
? `${new Date(cfg.lastSyncAt).toLocaleString()} · ${lastSyncSummary}` ? `${new Date(cfg.lastSyncAt).toLocaleString()}, ${lastSyncSummary}`
: t("hosts.proxmoxLastSyncNever"); : t("hosts.proxmoxLastSyncNever");
return ( return (
@@ -331,7 +331,7 @@ export function ProxmoxDiscoverDialog({
selected: selected.size, selected: selected.size,
})} })}
</span> </span>
<div className="flex gap-2"> <div className="flex gap-3">
<button <button
className="hover:text-foreground transition-colors" className="hover:text-foreground transition-colors"
onClick={() => onClick={() =>
@@ -340,7 +340,6 @@ export function ProxmoxDiscoverDialog({
> >
{t("hosts.proxmoxSelectAll")} {t("hosts.proxmoxSelectAll")}
</button> </button>
<span>·</span>
<button <button
className="hover:text-foreground transition-colors" className="hover:text-foreground transition-colors"
onClick={() => setSelected(new Set())} onClick={() => setSelected(new Set())}
@@ -136,10 +136,10 @@ export function NodeSummaryStrip({
</span> </span>
<div className="flex items-center gap-1.5 truncate text-[11px] text-muted-foreground"> <div className="flex items-center gap-1.5 truncate text-[11px] text-muted-foreground">
<Server className="size-3 shrink-0" /> <Server className="size-3 shrink-0" />
<span className="truncate"> <span className="truncate">{node?.system.hostname ?? "-"}</span>
{node?.system.hostname ?? "-"} {node?.system.pveVersion && (
{node?.system.pveVersion ? ` · ${node.system.pveVersion}` : ""} <span className="ml-1 shrink-0">{node.system.pveVersion}</span>
</span> )}
</div> </div>
</div> </div>
</div> </div>
+9 -2
View File
@@ -44,10 +44,17 @@
"copied": "Copied!", "copied": "Copied!",
"loadError": "Failed to load session logs", "loadError": "Failed to load session logs",
"deleteError": "Failed to delete session log", "deleteError": "Failed to delete session log",
"filterByHost": "Filter by host..." "filterByHost": "Filter by host...",
"back": "Back",
"empty": "(empty)",
"noResults": "No results for \"{{query}}\"",
"hostFallback": "Host {{id}}",
"sessionFallback": "Session {{id}}"
}, },
"player": { "player": {
"timeline": "Recording timeline", "timeline": "Recording timeline",
"speed": "Playback speed" "speed": "Playback speed",
"play": "Play recording",
"pause": "Pause recording"
} }
} }
@@ -1,4 +1,11 @@
import { useState, useEffect, useCallback, useMemo, useRef } from "react"; import {
useState,
useEffect,
useCallback,
useMemo,
useRef,
type ReactNode,
} from "react";
import { import {
useTranslation, useTranslation,
useToast, useToast,
@@ -146,6 +153,63 @@ function SectionHeader({ label, count }: { label: string; count: number }) {
); );
} }
function LogMeta({
items,
className,
}: {
items: (string | null | undefined)[];
className?: string;
}) {
return (
<span
className={`flex min-w-0 items-center gap-x-2.5 overflow-hidden whitespace-nowrap text-[10px] ${className ?? ""}`}
>
{items.filter(Boolean).map((item, i) => (
<span key={i} className="truncate last:shrink-0">
{item}
</span>
))}
</span>
);
}
const ACTION_BUTTON =
"size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors";
function ActionButton({
label,
onClick,
destructive,
children,
}: {
label: string;
onClick: () => void;
destructive?: boolean;
children: ReactNode;
}) {
return (
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
onClick={onClick}
aria-label={label}
className={
destructive
? "size-6 flex items-center justify-center text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10 transition-colors"
: ACTION_BUTTON
}
>
{children}
</button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={6}>
{label}
</TooltipContent>
</Tooltip>
);
}
function LogRow({ function LogRow({
log, log,
onView, onView,
@@ -160,7 +224,10 @@ function LogRow({
onDelete: () => void; onDelete: () => void;
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const hostLabel = log.hostName ?? log.hostIp ?? `Host ${log.hostId}`; const hostLabel =
log.hostName ??
log.hostIp ??
t("sessionLogs.hostFallback", { id: log.hostId });
return ( return (
<div className="group flex items-center gap-2.5 px-3 py-2.5 border-b border-border/40 last:border-b-0 hover:bg-muted/40 transition-colors"> <div className="group flex items-center gap-2.5 px-3 py-2.5 border-b border-border/40 last:border-b-0 hover:bg-muted/40 transition-colors">
@@ -172,68 +239,44 @@ function LogRow({
<span className="text-xs font-semibold truncate text-foreground"> <span className="text-xs font-semibold truncate text-foreground">
{hostLabel} {hostLabel}
</span> </span>
<span className="text-[10px] text-muted-foreground/60 truncate"> <LogMeta
{formatDate(log.startedAt)} className="text-muted-foreground/60"
{" · "} items={[
{(log.protocol ?? "ssh").toUpperCase()} formatDate(log.startedAt),
{log.username ? ` · ${log.username}` : ""} (log.protocol ?? "ssh").toUpperCase(),
{" · "} log.username,
{formatDuration(log.duration)} formatDuration(log.duration),
{" · "} formatBytes(log.sizeBytes),
{formatBytes(log.sizeBytes)} ]}
</span> />
</div> </div>
<TooltipProvider> <TooltipProvider disableHoverableContent>
<div className="shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity"> <div className="shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity">
<Tooltip> <ActionButton label={t("sessionLogs.viewLog")} onClick={onView}>
<TooltipTrigger asChild> <Eye className="size-3" />
<button </ActionButton>
onClick={onView}
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors"
>
<Eye className="size-3" />
</button>
</TooltipTrigger>
<TooltipContent side="left">View log</TooltipContent>
</Tooltip>
{log.format === "asciicast" && ( {log.format === "asciicast" && (
<Tooltip> <ActionButton
<TooltipTrigger asChild> label={t("sessionLogs.downloadAsText")}
<button onClick={onDownloadText}
onClick={onDownloadText} >
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors" <FileText className="size-3" />
> </ActionButton>
<FileText className="size-3" />
</button>
</TooltipTrigger>
<TooltipContent side="left">
{t("sessionLogs.downloadAsText")}
</TooltipContent>
</Tooltip>
)} )}
<Tooltip> <ActionButton
<TooltipTrigger asChild> label={t("sessionLogs.downloadLog")}
<button onClick={onDownload}
onClick={onDownload} >
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors" <Download className="size-3" />
> </ActionButton>
<Download className="size-3" /> <ActionButton
</button> label={t("sessionLogs.deleteLog")}
</TooltipTrigger> onClick={onDelete}
<TooltipContent side="left">Download</TooltipContent> destructive
</Tooltip> >
<Tooltip> <X className="size-3" />
<TooltipTrigger asChild> </ActionButton>
<button
onClick={onDelete}
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10 transition-colors"
>
<X className="size-3" />
</button>
</TooltipTrigger>
<TooltipContent side="left">Delete</TooltipContent>
</Tooltip>
</div> </div>
</TooltipProvider> </TooltipProvider>
</div> </div>
@@ -406,14 +449,18 @@ export function SessionLogsPanel() {
// Inline log viewer // Inline log viewer
if (viewLog) { if (viewLog) {
const hostLabel = const hostLabel =
viewLog.hostName ?? viewLog.hostIp ?? `Host ${viewLog.hostId}`; viewLog.hostName ??
viewLog.hostIp ??
t("sessionLogs.hostFallback", { id: viewLog.hostId });
return ( return (
<div className="flex flex-col flex-1 min-h-0 overflow-hidden"> <div className="flex flex-col flex-1 min-h-0 overflow-hidden">
{/* Viewer header */} {/* Viewer header */}
<div className="flex items-center gap-2 px-2 py-2 border-b border-border/60 bg-muted/20 shrink-0"> <div className="flex items-center gap-2 px-2 py-2 border-b border-border/60 bg-muted/20 shrink-0">
<button <button
type="button"
onClick={() => setViewLog(null)} onClick={() => setViewLog(null)}
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors" aria-label={t("sessionLogs.back")}
className={ACTION_BUTTON}
> >
<ArrowLeft className="size-3.5" /> <ArrowLeft className="size-3.5" />
</button> </button>
@@ -421,67 +468,50 @@ export function SessionLogsPanel() {
<span className="text-xs font-semibold truncate text-foreground"> <span className="text-xs font-semibold truncate text-foreground">
{hostLabel} {hostLabel}
</span> </span>
<span className="text-[10px] text-muted-foreground/50"> <LogMeta
{formatDate(viewLog.startedAt)} className="text-muted-foreground/50"
{` · ${viewLog.protocol.toUpperCase()}`} items={[
{viewLog.duration != null formatDate(viewLog.startedAt),
? ` · ${formatDuration(viewLog.duration)}` viewLog.protocol.toUpperCase(),
: ""} viewLog.duration != null
{" · "} ? formatDuration(viewLog.duration)
{formatBytes(viewLog.sizeBytes)} : null,
</span> formatBytes(viewLog.sizeBytes),
]}
/>
</div> </div>
<TooltipProvider> <TooltipProvider disableHoverableContent>
<div className="flex items-center gap-0.5 shrink-0"> <div className="flex items-center gap-0.5 shrink-0">
{viewText != null && ( {viewText != null && (
<Tooltip> <ActionButton
<TooltipTrigger asChild> label={
<button copied
onClick={handleCopy}
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors"
>
{copied ? (
<Check className="size-3 text-green-500" />
) : (
<Copy className="size-3" />
)}
</button>
</TooltipTrigger>
<TooltipContent side="left">
{copied
? t("sessionLogs.copied") ? t("sessionLogs.copied")
: t("sessionLogs.copyContent")} : t("sessionLogs.copyContent")
</TooltipContent> }
</Tooltip> onClick={handleCopy}
>
{copied ? (
<Check className="size-3 text-green-500" />
) : (
<Copy className="size-3" />
)}
</ActionButton>
)} )}
{viewLog.format === "asciicast" && ( {viewLog.format === "asciicast" && (
<Tooltip> <ActionButton
<TooltipTrigger asChild> label={t("sessionLogs.downloadAsText")}
<button onClick={() => handleDownloadText(viewLog)}
onClick={() => handleDownloadText(viewLog)} >
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors" <FileText className="size-3" />
> </ActionButton>
<FileText className="size-3" />
</button>
</TooltipTrigger>
<TooltipContent side="left">
{t("sessionLogs.downloadAsText")}
</TooltipContent>
</Tooltip>
)} )}
<Tooltip> <ActionButton
<TooltipTrigger asChild> label={t("sessionLogs.downloadLog")}
<button onClick={() => handleDownload(viewLog)}
onClick={() => handleDownload(viewLog)} >
className="size-6 flex items-center justify-center text-muted-foreground/50 hover:text-foreground hover:bg-muted/60 transition-colors" <Download className="size-3" />
> </ActionButton>
<Download className="size-3" />
</button>
</TooltipTrigger>
<TooltipContent side="left">
{t("sessionLogs.downloadLog")}
</TooltipContent>
</Tooltip>
</div> </div>
</TooltipProvider> </TooltipProvider>
</div> </div>
@@ -496,7 +526,7 @@ export function SessionLogsPanel() {
<SessionRecordingPlayer log={viewLog} blob={viewBlob} /> <SessionRecordingPlayer log={viewLog} blob={viewBlob} />
) : ( ) : (
<pre className="p-3 text-[11px] font-mono whitespace-pre-wrap break-all text-foreground/80 leading-relaxed"> <pre className="p-3 text-[11px] font-mono whitespace-pre-wrap break-all text-foreground/80 leading-relaxed">
{viewContent || "(empty)"} {viewContent || t("sessionLogs.empty")}
</pre> </pre>
)} )}
</div> </div>
@@ -536,7 +566,7 @@ export function SessionLogsPanel() {
{filtered.length === 0 ? ( {filtered.length === 0 ? (
<div className="flex flex-col items-center justify-center gap-2 py-10 text-center"> <div className="flex flex-col items-center justify-center gap-2 py-10 text-center">
<span className="text-xs text-muted-foreground/50"> <span className="text-xs text-muted-foreground/50">
No results for &quot;{filter}&quot; {t("sessionLogs.noResults", { query: filter })}
</span> </span>
</div> </div>
) : ( ) : (
@@ -568,13 +598,14 @@ export function SessionLogsPanel() {
<p className="text-sm text-foreground"> <p className="text-sm text-foreground">
{t("sessionLogs.confirmDelete")} {t("sessionLogs.confirmDelete")}
</p> </p>
<p className="text-xs text-muted-foreground"> <div className="flex flex-col text-xs text-muted-foreground">
{deleteTarget.hostName ?? <span className="font-medium text-foreground/80">
deleteTarget.hostIp ?? {deleteTarget.hostName ??
`Session ${deleteTarget.id}`} deleteTarget.hostIp ??
{" · "} t("sessionLogs.sessionFallback", { id: deleteTarget.id })}
{formatDate(deleteTarget.startedAt)} </span>
</p> <span>{formatDate(deleteTarget.startedAt)}</span>
</div>
<div className="flex justify-end gap-2"> <div className="flex justify-end gap-2">
<button <button
onClick={() => setDeleteTarget(null)} onClick={() => setDeleteTarget(null)}
@@ -4,7 +4,6 @@ import { Pause, Play } from "lucide-react";
import { Terminal } from "@xterm/xterm"; import { Terminal } from "@xterm/xterm";
import { FitAddon } from "@xterm/addon-fit"; import { FitAddon } from "@xterm/addon-fit";
import Guacamole from "guacamole-common-js"; import Guacamole from "guacamole-common-js";
import { Select2 } from "@termix/plugin-sdk/ui";
import "@xterm/xterm/css/xterm.css"; import "@xterm/xterm/css/xterm.css";
import { parseAsciicast, type Asciicast } from "./asciicast"; import { parseAsciicast, type Asciicast } from "./asciicast";
import type { SessionLogRecord } from "./session-recording-api"; import type { SessionLogRecord } from "./session-recording-api";
@@ -20,6 +19,65 @@ function getErrorMessage(error: unknown, fallback: string): string {
return error instanceof Error ? error.message : fallback; return error instanceof Error ? error.message : fallback;
} }
function SeekBar({
position,
duration,
onSeek,
}: {
position: number;
duration: number;
onSeek: (position: number) => void;
}) {
const { t } = useTranslation();
const barRef = useRef<HTMLDivElement>(null);
const [dragging, setDragging] = useState(false);
const progress = duration > 0 ? Math.min(position / duration, 1) : 0;
const seekFromPointer = (clientX: number) => {
const rect = barRef.current?.getBoundingClientRect();
if (!rect || rect.width === 0 || duration <= 0) return;
const ratio = Math.min(Math.max((clientX - rect.left) / rect.width, 0), 1);
onSeek(ratio * duration);
};
return (
<div
ref={barRef}
role="slider"
tabIndex={0}
aria-label={t("player.timeline")}
aria-valuemin={0}
aria-valuemax={duration}
aria-valuenow={position}
className="group/seek relative h-3 w-full cursor-pointer touch-none outline-none"
onPointerDown={(event) => {
event.currentTarget.setPointerCapture(event.pointerId);
setDragging(true);
seekFromPointer(event.clientX);
}}
onPointerMove={(event) => {
if (dragging) seekFromPointer(event.clientX);
}}
onPointerUp={(event) => {
event.currentTarget.releasePointerCapture(event.pointerId);
setDragging(false);
}}
onKeyDown={(event) => {
if (event.key === "ArrowLeft") onSeek(Math.max(position - 5, 0));
if (event.key === "ArrowRight")
onSeek(Math.min(position + 5, duration));
}}
>
<div className="absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 bg-border transition-[height] group-hover/seek:h-1 group-focus-visible/seek:h-1">
<div
className="h-full bg-primary"
style={{ width: `${progress * 100}%` }}
/>
</div>
</div>
);
}
function PlaybackControls({ function PlaybackControls({
playing, playing,
position, position,
@@ -39,47 +97,47 @@ function PlaybackControls({
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<div className="flex items-center gap-2 border-t border-border/60 bg-muted/20 px-3 py-2"> <div className="shrink-0 border-t border-border/60 bg-muted/20">
<button <SeekBar position={position} duration={duration} onSeek={onSeek} />
type="button" <div className="flex items-center gap-2 px-1 pb-1">
onClick={onToggle} <button
className="flex size-7 items-center justify-center hover:bg-muted" type="button"
aria-label={playing ? "Pause recording" : "Play recording"} onClick={onToggle}
> className="flex size-6 items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground"
{playing ? ( aria-label={playing ? t("player.pause") : t("player.play")}
<Pause className="size-3.5" /> >
) : ( {playing ? (
<Play className="size-3.5" /> <Pause className="size-3.5" />
)} ) : (
</button> <Play className="size-3.5" />
<span className="w-10 text-[10px] tabular-nums text-muted-foreground"> )}
{formatPosition(position)} </button>
</span> <span className="flex-1 text-[10px] tabular-nums text-muted-foreground">
<input {formatPosition(Math.min(position, duration))} /{" "}
type="range" {formatPosition(duration)}
min={0} </span>
max={Math.max(duration, 0.01)} <div
step={0.01} className="flex items-center"
value={Math.min(position, duration)} role="group"
onChange={(event) => onSeek(Number(event.target.value))} aria-label={t("player.speed")}
className="min-w-0 flex-1 accent-primary" >
aria-label={t("player.timeline")} {SPEEDS.map((value) => (
/> <button
<span className="w-10 text-right text-[10px] tabular-nums text-muted-foreground"> key={value}
{formatPosition(duration)} type="button"
</span> onClick={() => onSpeed(value)}
<Select2 aria-pressed={speed === value}
value={speed} className={
onChange={(event) => onSpeed(Number(event.target.value))} speed === value
className="h-7 border border-border bg-background px-1 text-[10px]" ? "h-5 px-1.5 text-[10px] tabular-nums bg-muted text-foreground"
aria-label={t("player.speed")} : "h-5 px-1.5 text-[10px] tabular-nums text-muted-foreground/60 hover:text-foreground"
> }
{SPEEDS.map((value) => ( >
<option key={value} value={value}> {value}x
{value}× </button>
</option> ))}
))} </div>
</Select2> </div>
</div> </div>
); );
} }
@@ -416,14 +416,17 @@ export function ShareSessionModal({
"?", "?",
})} })}
</span> </span>
<span className="text-[10px] text-muted-foreground/60"> <span className="flex flex-wrap gap-x-2.5 text-[10px] text-muted-foreground/60">
{share.permissionLevel === "read-write" <span>
? t("sessionSharing.permissionLevel.readWrite") {share.permissionLevel === "read-write"
: t("sessionSharing.permissionLevel.readOnly")} ? t("sessionSharing.permissionLevel.readWrite")
{" · "} : t("sessionSharing.permissionLevel.readOnly")}
{t("sessionSharing.expiresAt", { </span>
date: new Date(share.expiresAt).toLocaleString(), <span>
})} {t("sessionSharing.expiresAt", {
date: new Date(share.expiresAt).toLocaleString(),
})}
</span>
</span> </span>
</div> </div>
</div> </div>
+5 -2
View File
@@ -86,7 +86,10 @@
"imageUploaded": "Image uploaded: {{path}}", "imageUploaded": "Image uploaded: {{path}}",
"imageClipboardUnavailable": "This browser cannot read images from the clipboard", "imageClipboardUnavailable": "This browser cannot read images from the clipboard",
"imageClipboardEmpty": "No image found in the clipboard", "imageClipboardEmpty": "No image found in the clipboard",
"localShell": "Local terminal shell" "localShell": "Local terminal shell",
"autocompleteHintComplete": "Tab or Enter to complete",
"autocompleteHintNavigate": "↑↓ to navigate",
"autocompleteHintClose": "Esc to close"
}, },
"terminalToolbar": { "terminalToolbar": {
"detachTmux": "Detach tmux", "detachTmux": "Detach tmux",
@@ -163,7 +166,7 @@
}, },
"sessionTimeoutMinutes": { "sessionTimeoutMinutes": {
"label": "Terminal Session Persistence", "label": "Terminal Session Persistence",
"description": "How long a disconnected terminal is kept alive on the server before it is closed. Min 1 · Max 1440 minutes. For sessions that must outlive this, enable Auto-Tmux on the host." "description": "How long a disconnected terminal is kept alive on the server before it is closed. Min 1, max 1440 minutes. For sessions that must outlive this, enable Auto-Tmux on the host."
}, },
"commandHistoryEnabled": { "commandHistoryEnabled": {
"label": "Command History", "label": "Command History",
@@ -1,5 +1,6 @@
import React, { useEffect, useRef } from "react"; import React, { useEffect, useRef } from "react";
import { cn } from "@termix/plugin-sdk/ui"; import { cn } from "@termix/plugin-sdk/ui";
import { useTranslation } from "@termix/plugin-sdk/frontend";
interface CommandAutocompleteProps { interface CommandAutocompleteProps {
suggestions: string[]; suggestions: string[];
@@ -53,6 +54,7 @@ export function CommandAutocomplete({
position, position,
visible, visible,
}: CommandAutocompleteProps) { }: CommandAutocompleteProps) {
const { t } = useTranslation();
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
const selectedRef = useRef<HTMLDivElement>(null); const selectedRef = useRef<HTMLDivElement>(null);
@@ -103,7 +105,11 @@ export function CommandAutocomplete({
))} ))}
</div> </div>
<div className="px-3 py-1 text-xs text-muted-foreground border-t border-border bg-muted/50 shrink-0"> <div className="px-3 py-1 text-xs text-muted-foreground border-t border-border bg-muted/50 shrink-0">
Tab/Enter to complete • ↑↓ to navigate • Esc to close <span className="flex flex-wrap gap-x-3">
<span>{t("terminal.autocompleteHintComplete")}</span>
<span>{t("terminal.autocompleteHintNavigate")}</span>
<span>{t("terminal.autocompleteHintClose")}</span>
</span>
</div> </div>
</div> </div>
); );
@@ -79,8 +79,9 @@ export function PanePreview({
return ( return (
<> <>
<div className="flex items-center gap-3 border-b border-border px-3 py-1.5 text-xs text-muted-foreground"> <div className="flex items-center gap-3 border-b border-border px-3 py-1.5 text-xs text-muted-foreground">
<span className="font-medium text-foreground"> <span className="flex gap-2 font-medium text-foreground">
{pane.sessionName} · {pane.paneId} <span>{pane.sessionName}</span>
<span className="text-muted-foreground">{pane.paneId}</span>
</span> </span>
{metrics && ( {metrics && (
<> <>
@@ -72,8 +72,9 @@ export function SearchResults({
className="flex cursor-pointer items-baseline gap-2 px-3 py-1 text-xs hover:bg-muted/40" className="flex cursor-pointer items-baseline gap-2 px-3 py-1 text-xs hover:bg-muted/40"
onClick={() => onSelect(match)} onClick={() => onSelect(match)}
> >
<span className="shrink-0 font-medium text-primary"> <span className="flex shrink-0 gap-1.5 font-medium text-primary">
{match.sessionName} · {match.paneId} <span>{match.sessionName}</span>
<span className="text-primary/60">{match.paneId}</span>
</span> </span>
<span className="truncate font-mono text-muted-foreground"> <span className="truncate font-mono text-muted-foreground">
{highlightMatch(match.text, query)} {highlightMatch(match.text, query)}
@@ -1,6 +1,6 @@
// Session/window/pane tree styled after the VSCode "tmux manager" view. // Session/window/pane tree styled after the VSCode "tmux manager" view.
// Each session is a single row: status dot, name, inline tag badges, and a // Each session is a single row: status dot, name, inline tag badges, and a
// right-aligned meta label (relative time · cpu · mem) that is overlaid by // right-aligned meta label (relative time, cpu, mem) that is overlaid by
// the hover actions (attach, new window, …-menu). The overlay uses a grid // the hover actions (attach, new window, …-menu). The overlay uses a grid
// stack with opacity so rows never shift and the actions stay reachable via // stack with opacity so rows never shift and the actions stay reachable via
// keyboard focus. // keyboard focus.
@@ -119,11 +119,17 @@ export function SessionTree({
}); });
} }
function metaLabel(session: TmuxSessionOverview): string { function metaLabel(session: TmuxSessionOverview) {
const time = formatRelativeTime(session.lastActivity, now, t); const time = formatRelativeTime(session.lastActivity, now, t);
const agg = metricsBySession.get(session.name); const agg = metricsBySession.get(session.name);
if (!agg) return time; if (!agg) return time;
return `${time} · ${agg.cpu.toFixed(0)}% · ${formatMem(agg.memKb)}`; return (
<span className="flex gap-2">
<span>{time}</span>
<span>{agg.cpu.toFixed(0)}%</span>
<span>{formatMem(agg.memKb)}</span>
</span>
);
} }
return ( return (
+2 -2
View File
@@ -1184,7 +1184,7 @@
"add": "Add:", "add": "Add:",
"commandPalette": "Command Palette", "commandPalette": "Command Palette",
"done": "Done", "done": "Done",
"editModeInstructions": "Drag cards to reorder · Drag the column divider to resize columns · Drag the bottom edge of a card to resize its height · Trash to remove", "editModeInstructions": "Drag cards to reorder. Drag the column divider to resize columns. Drag the bottom edge of a card to change its height. Use the trash button to remove a card.",
"empty": "Empty", "empty": "Empty",
"clear": "Clear", "clear": "Clear",
"viewServerDetails": "View server details", "viewServerDetails": "View server details",
@@ -1264,7 +1264,7 @@
"auditForwardingSaveError": "Failed to save audit forwarding settings", "auditForwardingSaveError": "Failed to save audit forwarding settings",
"sessionTimeout": "Session Timeout", "sessionTimeout": "Session Timeout",
"hours": "hours", "hours": "hours",
"sessionTimeoutRange": "Min 1h · Max 720h", "sessionTimeoutRange": "Min 1h, max 720h",
"monitoringDefaults": "Monitoring Defaults", "monitoringDefaults": "Monitoring Defaults",
"statusCheck": "Status Check", "statusCheck": "Status Check",
"sec": "sec", "sec": "sec",
+7 -5
View File
@@ -230,11 +230,13 @@ export function AdminApiKeysSection({
<span className="text-[10px] font-mono text-muted-foreground truncate"> <span className="text-[10px] font-mono text-muted-foreground truncate">
{key.tokenPrefix}… {key.tokenPrefix}…
</span> </span>
<span className="text-[10px] text-muted-foreground"> <span className="flex gap-2.5 text-[10px] text-muted-foreground">
{key.createdAt.split("T")[0]} ·{" "} <span>{key.createdAt.split("T")[0]}</span>
{key.expiresAt <span>
? key.expiresAt.split("T")[0] {key.expiresAt
: t("admin.apiKeyNoExpiry")} ? key.expiresAt.split("T")[0]
: t("admin.apiKeyNoExpiry")}
</span>
</span> </span>
</div> </div>
<Button <Button
+3 -2
View File
@@ -815,8 +815,9 @@ export function AdminUserManagePanel({
<span className="text-xs font-semibold truncate max-w-[180px]"> <span className="text-xs font-semibold truncate max-w-[180px]">
{cred.name} {cred.name}
</span> </span>
<span className="text-[10px] text-muted-foreground truncate"> <span className="flex gap-2.5 text-[10px] text-muted-foreground min-w-0">
{cred.username || "-"} · {cred.type} <span className="truncate">{cred.username || "-"}</span>
<span className="shrink-0">{cred.type}</span>
</span> </span>
</div> </div>
</div> </div>
+1 -3
View File
@@ -189,9 +189,7 @@ function ConnectionRow({
</div> </div>
<span className="text-[10px] text-muted-foreground/60 truncate pl-3"> <span className="text-[10px] text-muted-foreground/60 truncate pl-3">
{hostName && hostName !== name ? ( {hostName && hostName !== name ? (
<span className="text-muted-foreground/50"> <span className="text-muted-foreground/50 mr-2.5">{hostName}</span>
{hostName} &middot;{" "}
</span>
) : null} ) : null}
{subLabel} {subLabel}
</span> </span>
+16 -9
View File
@@ -320,16 +320,23 @@ export function HostExportDialog({
</div> </div>
<div className="shrink-0 text-xs text-muted-foreground"> <div className="shrink-0 text-xs text-muted-foreground">
{count === 0 {count === 0 ? (
? t("hosts.export.noneSelected") t("hosts.export.noneSelected")
: `${t("hosts.export.summary", { ) : (
selected: count, <span className="flex flex-wrap gap-x-3">
total: exportableHosts.length, <span>
})} · ${ {t("hosts.export.summary", {
withCredentials selected: count,
total: exportableHosts.length,
})}
</span>
<span>
{withCredentials
? t("hosts.export.credentialsIncluded") ? t("hosts.export.credentialsIncluded")
: t("hosts.export.credentialsExcluded") : t("hosts.export.credentialsExcluded")}
}`} </span>
</span>
)}
</div> </div>
<DialogFooter className="shrink-0"> <DialogFooter className="shrink-0">
@@ -335,8 +335,9 @@ export function CredentialItem({
<span className="text-[11px] text-muted-foreground/60 truncate leading-none font-mono"> <span className="text-[11px] text-muted-foreground/60 truncate leading-none font-mono">
{cred.username} {cred.username}
{usedByCount > 0 && ( {usedByCount > 0 && (
<span className="text-muted-foreground/40"> <span
{cred.username ? " · " : ""} className={`text-muted-foreground/40${cred.username ? " ml-2" : ""}`}
>
{usedByCount}h {usedByCount}h
</span> </span>
)} )}