mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 09:01:00 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee2aa4de51 |
No files matched your search
@@ -679,111 +679,3 @@ test("Docker Compose dashboard shows per-service resource usage and named projec
|
||||
});
|
||||
await expect(detail).toContainText("27.40%", { timeout: 5000 });
|
||||
});
|
||||
|
||||
test("Docker Compose dashboard keeps its action row pinned when scrolling", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1200, height: 640 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const containers = Array.from({ length: 10 }, (_, idx) => {
|
||||
const n = idx + 1;
|
||||
return {
|
||||
id: `runner-${n}`,
|
||||
name: `selfhost-github-runner-${n}`,
|
||||
image: "myoung34/github-runner:latest",
|
||||
command: "./bin/Runner.Listener run",
|
||||
state: "running",
|
||||
status: "Up 24 hours",
|
||||
ports: "",
|
||||
createdAt: "2026-11-22T20:00:00Z",
|
||||
composeProject: "selfhost",
|
||||
composeService: `github-runner-${n}`,
|
||||
composeWorkingDir: "/work/selfhost",
|
||||
composeFiles: ["/work/selfhost/docker-compose.yml"],
|
||||
mounts: [],
|
||||
networks: ["selfhost_default"],
|
||||
};
|
||||
});
|
||||
const snapshot = {
|
||||
availability: { kind: "ready", clientVersion: "28.0.1", serverVersion: "28.0.1", context: "desktop-linux" },
|
||||
executable: "/usr/bin/docker",
|
||||
containers,
|
||||
images: [],
|
||||
volumes: [],
|
||||
networks: [],
|
||||
errors: [],
|
||||
};
|
||||
window.__ipc.handlers.docker_settings = () => ({
|
||||
connections: [{ id: "default", name: "Docker", endpoint: { kind: "default" } }],
|
||||
registries: [],
|
||||
});
|
||||
window.__ipc.handlers.docker_snapshot = () => snapshot;
|
||||
window.__ipc.handlers.docker_events = () => new Promise(() => {});
|
||||
window.__ipc.handlers.docker_inspect = () => "[]";
|
||||
window.__ipc.handlers.docker_container_stats = () => ({
|
||||
cpuPerc: "0.04%",
|
||||
memUsage: "99.85MiB / 114.3GiB",
|
||||
memPerc: "0.09%",
|
||||
netIo: "1.1MB / 3.75MB",
|
||||
blockIo: "0B / 213kB",
|
||||
pids: "15",
|
||||
});
|
||||
|
||||
const storeMod = "/src/features/services/store.ts";
|
||||
const treeMod = "/src/features/services/tree.ts";
|
||||
const { useServices } = await import(/* @vite-ignore */ storeMod);
|
||||
const { useServicesTree } = await import(/* @vite-ignore */ treeMod);
|
||||
useServices.setState({
|
||||
settings: { connections: [{ id: "default", name: "Docker", endpoint: { kind: "default" } }], registries: [] },
|
||||
conns: { default: { snapshot, loading: false, error: null } },
|
||||
});
|
||||
useServicesTree.setState({
|
||||
expanded: new Set(["docker:default"]),
|
||||
selectedKey: "docker:default:compose:selfhost",
|
||||
selectedKeys: new Set(["docker:default:compose:selfhost"]),
|
||||
});
|
||||
});
|
||||
|
||||
await page.keyboard.press("Meta+8");
|
||||
const services = page.getByRole("region", { name: "Services", exact: true });
|
||||
const detail = services.locator("[data-panel][id=services-detail]");
|
||||
const startBtn = detail.getByRole("button", { name: "Start", exact: true });
|
||||
const stopBtn = detail.getByRole("button", { name: "Stop", exact: true });
|
||||
const restartBtn = detail.getByRole("button", { name: "Restart", exact: true });
|
||||
const downBtn = detail.getByRole("button", { name: "Compose Down", exact: true });
|
||||
await expect(downBtn).toBeVisible();
|
||||
|
||||
const beforeStart = (await startBtn.boundingBox())!;
|
||||
const beforeDown = (await downBtn.boundingBox())!;
|
||||
const beforeBanner = (await detail.getByText("Compose project 'selfhost'").boundingBox())!;
|
||||
|
||||
const scrollState = await detail.evaluate((panel) => {
|
||||
const scrollers = Array.from(panel.querySelectorAll<HTMLElement>("*")).filter((el) => {
|
||||
const cs = getComputedStyle(el);
|
||||
return (cs.overflowY === "auto" || cs.overflowY === "scroll") && el.scrollHeight - el.clientHeight > 2;
|
||||
});
|
||||
scrollers[0]!.scrollTop = 160;
|
||||
return {
|
||||
scrollerCount: scrollers.length,
|
||||
scrollTop: scrollers[0]!.scrollTop,
|
||||
scrollerTop: scrollers[0]!.getBoundingClientRect().top,
|
||||
};
|
||||
});
|
||||
|
||||
expect(scrollState.scrollerCount).toBe(1);
|
||||
expect(scrollState.scrollTop).toBeGreaterThan(100);
|
||||
// The scroll container starts strictly below the pinned action row.
|
||||
expect(scrollState.scrollerTop).toBeGreaterThanOrEqual(beforeDown.y + beforeDown.height);
|
||||
|
||||
await expect(startBtn).toBeVisible();
|
||||
await expect(stopBtn).toBeVisible();
|
||||
await expect(restartBtn).toBeVisible();
|
||||
await expect(downBtn).toBeVisible();
|
||||
|
||||
const afterStart = (await startBtn.boundingBox())!;
|
||||
const afterDown = (await downBtn.boundingBox())!;
|
||||
const afterBanner = (await detail.getByText("Compose project 'selfhost'").boundingBox())!;
|
||||
|
||||
expect(afterStart.y).toBe(beforeStart.y);
|
||||
expect(afterDown.y).toBe(beforeDown.y);
|
||||
expect(afterBanner.y).toBeLessThan(beforeBanner.y - 100);
|
||||
});
|
||||
@@ -408,8 +408,6 @@
|
||||
|
||||
.reply {
|
||||
position: relative;
|
||||
/* Keep WebKit's selection gap fill from extending across reply boundaries. */
|
||||
transform: translateX(0);
|
||||
}
|
||||
.replyFooter {
|
||||
position: absolute;
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
}
|
||||
.detailPane {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -236,7 +235,6 @@
|
||||
user-select: text;
|
||||
}
|
||||
.dashboardActions {
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
@@ -256,10 +254,6 @@
|
||||
border-top: 1px solid var(--border);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.dashboard > .sectionBanner:first-child,
|
||||
.dashboardActions + .sectionBanner {
|
||||
border-top: 0;
|
||||
}
|
||||
.propList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
+137
-139
@@ -1888,7 +1888,7 @@ export function ComposeProjectDashboard({
|
||||
const { byId: activeStats, loading: statsLoading } = useLiveContainerStats(conn, runningIdsKey);
|
||||
|
||||
return (
|
||||
<div className={styles.detailBody}>
|
||||
<div className={styles.dashboard} tabIndex={0} onKeyDown={copySelectionOnKeyDown}>
|
||||
<div className={styles.dashboardActions}>
|
||||
<OpButton busy={busy === "start"} disabled={!canStart(target)} onClick={() => void start(target)}>
|
||||
Start
|
||||
@@ -1904,146 +1904,144 @@ export function ComposeProjectDashboard({
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.dashboard} tabIndex={0} onKeyDown={copySelectionOnKeyDown}>
|
||||
<SectionBanner>{txTemplate(`Compose project '${project}'`)}</SectionBanner>
|
||||
<div className={styles.propList}>
|
||||
<PropRow label={<T>Project</T>}>
|
||||
<span className={styles.mono}>{project}</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Status</T>}>
|
||||
<span>
|
||||
{runningCount}/{containers.length} running
|
||||
</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Working directory</T>} hidden={!first?.composeWorkingDir}>
|
||||
<span className={styles.mono}>{first?.composeWorkingDir}</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Compose files</T>} hidden={!first?.composeFiles.length}>
|
||||
<span className={styles.inlineRow}>
|
||||
{first?.composeFiles.map((file) => (
|
||||
<button
|
||||
key={file}
|
||||
type="button"
|
||||
className={styles.link}
|
||||
onClick={() => void openComposeFile(file, first.composeWorkingDir)}
|
||||
>
|
||||
<span className={styles.mono}>{file}</span>
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
</PropRow>
|
||||
</div>
|
||||
|
||||
<SectionBanner>
|
||||
<T>Services</T>
|
||||
</SectionBanner>
|
||||
<div className={styles.composeTableWrap}>
|
||||
<table className={clsx(styles.gridTable, styles.composeServicesTable)}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<T>Service</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Status</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>CPU</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Memory</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Network I/O</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Block I/O</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>PIDs</T>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{containers.map((c) => {
|
||||
const running = isRunning(c);
|
||||
const stats = running ? activeStats[c.id] : undefined;
|
||||
const cpuPct = stats ? parsePercent(stats.cpuPerc) : 0;
|
||||
const memPair = stats ? parseUsagePair(stats.memUsage) : null;
|
||||
const memPct = memPair ? memPair.percent : stats ? parsePercent(stats.memPerc) : 0;
|
||||
return (
|
||||
<tr key={c.id}>
|
||||
<td className={styles.composeServiceCell}>
|
||||
<button type="button" className={styles.link} onClick={() => selectContainerInTree(conn, c)}>
|
||||
<span className={clsx(styles.statusDot, running ? styles.dotOk : styles.dotMuted)} />
|
||||
<span className={styles.mono}>{c.name}</span>
|
||||
</button>
|
||||
{c.composeService && !c.name.includes(c.composeService) && (
|
||||
<span className={styles.mutedMeta}>{c.composeService}</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={styles.nowrapCell}>
|
||||
<StatusBadge state={c.state} text={c.status || c.state} />
|
||||
</td>
|
||||
<td className={styles.composeMetricCell}>
|
||||
{stats ? (
|
||||
<div className={styles.composeMetric}>
|
||||
<span className={styles.mono}>{stats.cpuPerc}</span>
|
||||
<LineProgress percent={cpuPct} />
|
||||
</div>
|
||||
) : running && statsLoading ? (
|
||||
<Spinner size={12} />
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={styles.composeMemoryCell}>
|
||||
{stats ? (
|
||||
<div className={styles.composeMetric}>
|
||||
<span className={styles.mono}>
|
||||
{stats.memUsage} ({stats.memPerc})
|
||||
</span>
|
||||
<LineProgress percent={memPct} />
|
||||
</div>
|
||||
) : running && statsLoading ? (
|
||||
<span className={styles.mutedMeta}>
|
||||
<T>Loading…</T>
|
||||
</span>
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.netIo || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.blockIo || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.pids || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<SectionBanner>
|
||||
<T>Volumes</T>
|
||||
</SectionBanner>
|
||||
{namedVolumes.length > 0 ? (
|
||||
<div className={styles.chipGroup}>
|
||||
{namedVolumes.map((v) => (
|
||||
<VolumeLinkChip key={v.name} conn={conn} volume={v} />
|
||||
<SectionBanner>{txTemplate(`Compose project '${project}'`)}</SectionBanner>
|
||||
<div className={styles.propList}>
|
||||
<PropRow label={<T>Project</T>}>
|
||||
<span className={styles.mono}>{project}</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Status</T>}>
|
||||
<span>
|
||||
{runningCount}/{containers.length} running
|
||||
</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Working directory</T>} hidden={!first?.composeWorkingDir}>
|
||||
<span className={styles.mono}>{first?.composeWorkingDir}</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Compose files</T>} hidden={!first?.composeFiles.length}>
|
||||
<span className={styles.inlineRow}>
|
||||
{first?.composeFiles.map((file) => (
|
||||
<button
|
||||
key={file}
|
||||
type="button"
|
||||
className={styles.link}
|
||||
onClick={() => void openComposeFile(file, first.composeWorkingDir)}
|
||||
>
|
||||
<span className={styles.mono}>{file}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.emptySection}>
|
||||
<T>No named volumes</T>
|
||||
</div>
|
||||
)}
|
||||
</span>
|
||||
</PropRow>
|
||||
</div>
|
||||
|
||||
<SectionBanner>
|
||||
<T>Services</T>
|
||||
</SectionBanner>
|
||||
<div className={styles.composeTableWrap}>
|
||||
<table className={clsx(styles.gridTable, styles.composeServicesTable)}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<T>Service</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Status</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>CPU</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Memory</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Network I/O</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>Block I/O</T>
|
||||
</th>
|
||||
<th>
|
||||
<T>PIDs</T>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{containers.map((c) => {
|
||||
const running = isRunning(c);
|
||||
const stats = running ? activeStats[c.id] : undefined;
|
||||
const cpuPct = stats ? parsePercent(stats.cpuPerc) : 0;
|
||||
const memPair = stats ? parseUsagePair(stats.memUsage) : null;
|
||||
const memPct = memPair ? memPair.percent : stats ? parsePercent(stats.memPerc) : 0;
|
||||
return (
|
||||
<tr key={c.id}>
|
||||
<td className={styles.composeServiceCell}>
|
||||
<button type="button" className={styles.link} onClick={() => selectContainerInTree(conn, c)}>
|
||||
<span className={clsx(styles.statusDot, running ? styles.dotOk : styles.dotMuted)} />
|
||||
<span className={styles.mono}>{c.name}</span>
|
||||
</button>
|
||||
{c.composeService && !c.name.includes(c.composeService) && (
|
||||
<span className={styles.mutedMeta}>{c.composeService}</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={styles.nowrapCell}>
|
||||
<StatusBadge state={c.state} text={c.status || c.state} />
|
||||
</td>
|
||||
<td className={styles.composeMetricCell}>
|
||||
{stats ? (
|
||||
<div className={styles.composeMetric}>
|
||||
<span className={styles.mono}>{stats.cpuPerc}</span>
|
||||
<LineProgress percent={cpuPct} />
|
||||
</div>
|
||||
) : running && statsLoading ? (
|
||||
<Spinner size={12} />
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={styles.composeMemoryCell}>
|
||||
{stats ? (
|
||||
<div className={styles.composeMetric}>
|
||||
<span className={styles.mono}>
|
||||
{stats.memUsage} ({stats.memPerc})
|
||||
</span>
|
||||
<LineProgress percent={memPct} />
|
||||
</div>
|
||||
) : running && statsLoading ? (
|
||||
<span className={styles.mutedMeta}>
|
||||
<T>Loading…</T>
|
||||
</span>
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
)}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.netIo || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.blockIo || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
<td className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{stats?.pids || <span className={styles.mutedMeta}>—</span>}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<SectionBanner>
|
||||
<T>Volumes</T>
|
||||
</SectionBanner>
|
||||
{namedVolumes.length > 0 ? (
|
||||
<div className={styles.chipGroup}>
|
||||
{namedVolumes.map((v) => (
|
||||
<VolumeLinkChip key={v.name} conn={conn} volume={v} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.emptySection}>
|
||||
<T>No named volumes</T>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user