fix(run): keep console actions visible in short panes (#4511)

Run session controls move above the console: Rerun, Stop, Clear All and configuration controls fit together in a short docked pane, the console gets the full width, and the toolbar wraps by action group in narrow panes. Sessions without lifecycle controls (services, debugger console) keep the vertical toolbar.
This commit is contained in:
l0ng-ai
2026-11-19 20:55:10 +08:00
committed by GitHub
parent 313a5f3a14
commit af281341b1
4 changed files with 101 additions and 32 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ for (const kind of ["run", "debug", "services-run", "services-debug", "stacktrac
component = SessionPanel;
props = {
session: run.useRun.getState().sessions.find((s: { id: string }) => s.id === id),
...(kind === "services-run" ? { onRerun: null, onDebug: null } : {}),
showLifecycle: kind === "run",
};
} else if (kind === "debug" || kind === "services-debug") {
const statePath = "/src/features/debugger/state.ts";
+33
View File
@@ -81,6 +81,39 @@ test("⌘F2 stops a running process", async ({ workbench: page }) => {
await expect(run.getByRole("tab", { name: "dev" })).toHaveAttribute("data-tooltip", /exit code 143$/);
});
test("a short Run pane has room for the full toolbar above the output", async ({ workbench: page }) => {
await page.setViewportSize({ width: 400, height: 500 });
const output = "Watching for changes…";
await stubRun(page, [{ kind: "stdout", text: `${output}\n` }], null);
await page.keyboard.press("Control+r");
const run = page.getByRole("region", { name: "Run", exact: true });
await expect(run.getByText(output)).toBeVisible();
await page.evaluate(async () => {
const path = "/src/workbench/toolwindows/store.ts";
const { setToolWindowSize } = await import(/* @vite-ignore */ path);
setToolWindowSize("bottom", 160);
});
const toolbar = run.getByRole("toolbar", { name: "Run actions" });
const clipped = await toolbar.evaluate((el) => {
const bar = el.getBoundingClientRect();
return Array.from(el.querySelectorAll("button")).flatMap((button) => {
const box = button.getBoundingClientRect();
return box.left < bar.left - 1 || box.right > bar.right + 1 || box.bottom > bar.bottom + 1
? [button.getAttribute("aria-label")]
: [];
});
});
expect(clipped).toEqual([]);
await expect(toolbar).toHaveAttribute("aria-orientation", "horizontal");
const toolbarBox = (await toolbar.boundingBox())!;
const consoleBox = (await run.getByRole("log").boundingBox())!;
expect(consoleBox.y).toBeGreaterThanOrEqual(toolbarBox.y + toolbarBox.height - 1);
await toolbar.getByRole("button", { name: "Clear All" }).click();
await expect(run.getByText(output)).toBeHidden();
await toolbar.getByRole("button", { name: "Stop" }).click();
await expect.poll(() => ipcCalls(page, "run_stop")).toEqual([{ id: RUN_ID }]);
});
test("Go reruns keep each package's exact failures and the original configuration", async ({ workbench: page }) => {
await stubDesktop(page);
await page.evaluate(async () => {
+29 -1
View File
@@ -51,6 +51,10 @@
min-width: 0;
}
.topToolbarSession {
flex-direction: column;
}
.toolbar {
flex: none;
width: 32px;
@@ -69,12 +73,36 @@
.toolbar::-webkit-scrollbar {
display: none;
}
.toolbarSep {
.toolbarGroup {
display: flex;
flex: none;
flex-direction: inherit;
align-items: center;
gap: var(--space-0-5);
max-width: 100%;
}
.toolbarGroup + .toolbarGroup::before {
content: "";
width: 16px;
height: 1px;
margin: 3px 0;
background: var(--border-strong);
}
.topToolbarSession .toolbar {
width: auto;
flex-direction: row;
flex-wrap: wrap;
gap: var(--space-0-5) var(--space-2);
padding: var(--space-0-5) var(--space-1);
border-right: none;
border-bottom: 1px solid var(--border);
}
.topToolbarSession .toolbarGroup {
flex-wrap: wrap;
}
.topToolbarSession .toolbarGroup::before {
display: none;
}
.sessionBody {
flex: 1;
+38 -30
View File
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useRef, useState } from "react";
import clsx from "clsx";
import type { RunConfig } from "@/platform/ipc";
import type { RunTargetValid } from "@/platform/remoteSettings";
import { useAgentRunSettings, useWorkflowSettings } from "@/platform/workflowSettings";
@@ -181,10 +182,15 @@ export function SessionPanel({
);
return (
<div className={styles.session}>
<div className={styles.toolbar} role="toolbar" aria-orientation="vertical" aria-label={tx("Run actions")}>
<div className={clsx(styles.session, showLifecycle && styles.topToolbarSession)}>
<div
className={styles.toolbar}
role="toolbar"
aria-orientation={showLifecycle ? "horizontal" : "vertical"}
aria-label={tx("Run actions")}
>
{showLifecycle && (
<>
<div className={styles.toolbarGroup}>
<IconButton
icon="rerun"
title="Rerun"
@@ -242,34 +248,36 @@ export function SessionPanel({
/>
</>
)}
<div className={styles.toolbarSep} />
</>
</div>
)}
{!rt.terminal && (
<>
<IconButton
icon="search"
title="Find…"
shortcut={formatBinding(hostBinding("Meta+F"))}
pressed={findOpen}
onClick={() => setFindOpen((v) => !v)}
/>
<IconButton
icon="scroll-to-end"
title="Scroll to End"
pressed={follow}
onClick={() => setFollow((v) => !v)}
/>
<IconButton icon="soft-wrap" title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
</>
)}
<IconButton icon="trash" title="Clear All" onClick={() => clearConsole(session.id)} />
<div className={styles.toolbarSep} />
<IconButton
icon="settings"
title="Edit Configurations…"
onClick={() => void executeAction("run.editConfigs", session.config.id)}
/>
<div className={styles.toolbarGroup}>
{!rt.terminal && (
<>
<IconButton
icon="search"
title="Find…"
shortcut={formatBinding(hostBinding("Meta+F"))}
pressed={findOpen}
onClick={() => setFindOpen((v) => !v)}
/>
<IconButton
icon="scroll-to-end"
title="Scroll to End"
pressed={follow}
onClick={() => setFollow((v) => !v)}
/>
<IconButton icon="soft-wrap" title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
</>
)}
<IconButton icon="trash" title="Clear All" onClick={() => clearConsole(session.id)} />
</div>
<div className={styles.toolbarGroup}>
<IconButton
icon="settings"
title="Edit Configurations…"
onClick={() => void executeAction("run.editConfigs", session.config.id)}
/>
</div>
</div>
<div className={styles.sessionBody}>
{rt.tests ? (