Simplify server detail actions

This commit is contained in:
npc0-hue
2026-08-26 15:34:14 +08:00
parent d395019848
commit e3e1c787be
2 changed files with 18 additions and 14 deletions
@@ -32,6 +32,16 @@ describe("ServerDetailPage config write approval", () => {
expect(serversPageSource).toContain("<UsageMeter");
});
it("keeps the detail header focused on a single shared action row", () => {
expect(serverDetailPageSource).not.toContain("Run 心跳");
expect(serverDetailPageSource).not.toContain("已自动附着");
expect(serverDetailPageSource).toContain('<span>返回列表</span>');
expect(serverDetailPageSource).toContain('<span>刷新</span>');
expect(serverDetailPageSource).toContain('<span>打开终端</span>');
expect(serverDetailPageSource).toContain('<span>启动</span>');
expect(serverDetailPageSource).toContain('<span>停止</span>');
});
it("maps platform diff preview responses into the display diff without losing approval metadata", () => {
const view = configDiffViewFromPreview(preview);
+8 -14
View File
@@ -160,17 +160,6 @@ export function ServerDetailPage(props: PageComponentProps) {
return (
<section className="server-detail-page" aria-labelledby="server-detail-title">
<div className="action-strip">
<button type="button" className="icon-command" onClick={() => onNavigate("servers")}>
<MoonStar size={16} />
<span></span>
</button>
<button type="button" className="icon-command" onClick={() => void refresh()}>
<Sparkles size={16} />
<span></span>
</button>
</div>
{instance.status === "loading" && <LoadingState label="正在加载服务器详情…" />}
{instance.status === "error" && (
<ErrorState title="服务器详情加载失败" reason={instance.reason} diagnosticId={`server-detail:${serverId}`} onRetry={() => void refresh()} />
@@ -198,11 +187,16 @@ export function ServerDetailPage(props: PageComponentProps) {
<div className="server-detail-title-row">
<div>
<h1 id="server-detail-title">{instance.data.name}</h1>
<span className="provider-id">
{instance.data.id} · {instance.data.pluginId}@{instance.data.pluginVersion} · Run {runEndpoint ? "已自动附着" : "等待上报"}
</span>
</div>
<div className="action-strip">
<button type="button" className="icon-command" onClick={() => onNavigate("servers")}>
<MoonStar size={16} />
<span></span>
</button>
<button type="button" className="icon-command" onClick={() => void refresh()}>
<Sparkles size={16} />
<span></span>
</button>
<span className={cx("status-pill", detailFreshness === "fresh" ? statusClass(instance.data.state) : "status-disabled")}>{detailStateText}</span>
<button
type="button"