Skip to content

Commit f94f945

Browse files
clawsweeperroboclaw-botTakhoffman
authored
improve(ui): declutter Automations across desktop and mobile (#127198)
* improve(ui): declutter automations list * test: align automation UI and process cleanup Co-authored-by: Tak Hoffman <[email protected]> --------- Co-authored-by: RoboClaw <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent 7498391 commit f94f945

9 files changed

Lines changed: 444 additions & 217 deletions

File tree

‎test/scripts/vitest-e2e-global-setup.test.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ import {
77
forceKillVitestProcessGroup,
88
forwardSignalToVitestProcessGroup,
99
} from "../../scripts/vitest-process-group.mts";
10-
import {
11-
isProcessAlive,
12-
waitForChildClose,
13-
waitForDead,
14-
waitForPidFile,
15-
} from "../helpers/process-wait.js";
10+
import { waitForChildClose, waitForDead, waitForPidFile } from "../helpers/process-wait.js";
1611
import { runE2eGlobalSetup } from "../vitest/vitest.e2e.global-setup.js";
1712

1813
type SetupCommandRunner = NonNullable<Parameters<typeof runE2eGlobalSetup>[0]>;
@@ -127,8 +122,12 @@ await runE2eSetupCommand([${JSON.stringify(fixturePath)}], process.env);`;
127122
} finally {
128123
forceKillVitestProcessGroup(runner);
129124
for (const pid of pids) {
130-
if (isProcessAlive(pid)) {
125+
try {
131126
process.kill(pid, "SIGKILL");
127+
} catch (error) {
128+
if ((error as NodeJS.ErrnoException).code !== "ESRCH") {
129+
throw error;
130+
}
132131
}
133132
}
134133
fs.rmSync(fixtureDir, { force: true, recursive: true });

‎ui/src/e2e/cron-descriptions.e2e.test.ts‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function cronJob(id: string, name: string) {
2424
}
2525

2626
suite.define(() => {
27-
it("shows saved descriptions in compact rows and task details for every payload kind", async () => {
27+
it("shows saved descriptions in list rows and task details for every payload kind", async () => {
2828
const jobs = [
2929
{
3030
...cronJob("described-event", "System reminder"),
@@ -81,7 +81,7 @@ suite.define(() => {
8181

8282
for (const job of jobs) {
8383
const description = page.locator(`[data-test-id="cron-row-description-${job.id}"]`);
84-
expect((await description.textContent())?.trim()).toBe(`· ${job.description.trim()}`);
84+
expect((await description.textContent())?.trim()).toBe(job.description.trim());
8585
expect(await description.getAttribute("title")).toBe(
8686
`Description: ${job.description.trim()}`,
8787
);
@@ -90,14 +90,6 @@ suite.define(() => {
9090
await page.locator(`[data-test-id="cron-row-description-${undescribedJob.id}"]`).count(),
9191
).toBe(0);
9292

93-
const describedRow = await page
94-
.locator(`[data-test-id="cron-row-${jobs[1].id}"]`)
95-
.boundingBox();
96-
const undescribedRow = await page
97-
.locator(`[data-test-id="cron-row-${undescribedJob.id}"]`)
98-
.boundingBox();
99-
expect(describedRow?.height).toBe(undescribedRow?.height);
100-
10193
for (const job of jobs) {
10294
const row = page.locator(`[data-test-id="cron-row-${job.id}"]`);
10395
await row.locator(".cron-table__name-text").click();

‎ui/src/pages/cron/stats.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { html } from "lit";
22
import type { CronJob, CronStatus } from "../../api/types.ts";
3-
import { icon } from "../../components/icons.ts";
43
import { t } from "../../i18n/index.ts";
54
import { formatNextRun } from "../../lib/presenter.ts";
65

@@ -30,9 +29,10 @@ export function renderCronStats(props: {
3029
return html`
3130
<div class="cron-stats">
3231
<div class="cron-stat">
33-
<span class="cron-stat__label">${t("cron.stats.tasks")}</span>
3432
<span class="cron-stat__value">${total}</span>
33+
<span class="cron-stat__label">${t("cron.stats.tasks")}</span>
3534
</div>
35+
<span class="cron-stat__separator" aria-hidden="true">·</span>
3636
<button
3737
type="button"
3838
class="cron-stat cron-stat--action"
@@ -44,16 +44,16 @@ export function renderCronStats(props: {
4444
void props.onRunsFiltersChange({ cronRunsStatuses: ["error"] });
4545
}}
4646
>
47-
<span class="cron-stat__label">${t("cron.stats.failing")}</span>
4847
<span
4948
class="cron-stat__value ${typeof failing === "number" && failing > 0
5049
? "cron-stat__value--danger"
5150
: ""}"
5251
>
5352
${failing ?? t("common.na")}
5453
</span>
55-
<span class="cron-stat__go" aria-hidden="true">${icon("chevronRight")}</span>
54+
<span class="cron-stat__label">${t("cron.stats.failing")}</span>
5655
</button>
56+
<span class="cron-stat__separator" aria-hidden="true">·</span>
5757
<div class="cron-stat">
5858
<span class="cron-stat__label">${t("cron.stats.nextWake")}</span>
5959
<span class="cron-stat__value cron-stat__value--time">

‎ui/src/pages/cron/view-auto-disabled.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ it("labels an auto-disabled job distinctly from an operator pause", () => {
1919
const container = renderView({ jobs: [paused, autoDisabled] });
2020
const rows = Array.from(container.querySelectorAll(".cron-table__row"));
2121
expect(rows[0]?.textContent).toContain("Paused");
22+
expect(rows[0]?.querySelector(".cron-table__state--paused")?.getAttribute("aria-label")).toBe(
23+
"Paused",
24+
);
2225
const note = rows[1]?.querySelector("[data-test-id='cron-row-auto-disabled-job-auto']");
2326
expect(note?.textContent?.trim()).toBe("Auto-disabled · 10 run failures");
2427
expect(note?.getAttribute("title")).toBe("provider exploded");
25-
// Escalated failure keeps the error dot even though the job is disabled.
26-
expect(rows[1]?.querySelector(".cron-table__dot--error")).not.toBeNull();
28+
// Escalated failure keeps a visible error marker even though the job is disabled.
29+
expect(rows[1]?.querySelector(".cron-table__state--error")?.getAttribute("aria-label")).toBe(
30+
"Auto-disabled · 10 run failures",
31+
);
2732
});

‎ui/src/pages/cron/view-description.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("cron view saved descriptions", () => {
2626
);
2727

2828
expect(description).toBeInstanceOf(HTMLSpanElement);
29-
expect(description?.textContent?.trim()).toBe("· Summarize overnight deployment activity");
29+
expect(description?.textContent?.trim()).toBe("Summarize overnight deployment activity");
3030
expect(description?.title).toBe("Description: Summarize overnight deployment activity");
3131
description?.click();
3232
expect(onSelectJob).toHaveBeenCalledWith(job);

‎ui/src/pages/cron/view-running-state.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ it("shows Running instead of a past-due next-run time while a run executes", ()
1313
const container = renderView({ jobs: [running] });
1414
const row = container.querySelector(".cron-table__row");
1515
expect(row?.querySelector(".cron-table__running")?.textContent).toBe("Running");
16+
expect(row?.querySelector(".cron-table__state--running")?.getAttribute("aria-label")).toBe(
17+
"Running",
18+
);
1619
expect(row?.textContent).not.toContain("ago");
1720
});

‎ui/src/pages/cron/view.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ describe("cron view list pane", () => {
137137
expect(rows[0]?.textContent).toContain("Cron 0 9 * * *");
138138
expect(rows[1]?.classList.contains("cron-table__row--paused")).toBe(true);
139139
expect(rows[1]?.textContent).toContain("Paused");
140-
expect(rows[2]?.querySelector(".cron-table__dot--error")).not.toBeNull();
140+
expect(rows[2]?.querySelector(".cron-table__state--error")?.getAttribute("aria-label")).toBe(
141+
"Error",
142+
);
141143
expect(rows[2]?.querySelector(".cron-last-glyph--error")).not.toBeNull();
142144
expect(rows[2]?.querySelector(".cron-table__last-run")?.getAttribute("aria-label")).toBe(
143145
"Error",

0 commit comments

Comments
 (0)