Skip to content

Commit 50d6214

Browse files
author
Peter Steinberger
committed
fix(ui): scope agent cron jobs and surface model catalog failures
1 parent 12297b7 commit 50d6214

13 files changed

Lines changed: 851 additions & 232 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// @vitest-environment node
2+
import { readFile } from "node:fs/promises";
3+
import { describe, expect, it } from "vitest";
4+
5+
describe("cron jobs pagination style ownership", () => {
6+
it("loads shared pagination styles through the component on either route", async () => {
7+
const [componentSource, sharedStyles, cronStyles, agentsSource, cronSource] = await Promise.all(
8+
[
9+
readFile(new URL("./cron-jobs-pagination.ts", import.meta.url), "utf8"),
10+
readFile(new URL("../styles/cron-jobs-pagination.css", import.meta.url), "utf8"),
11+
readFile(new URL("../styles/cron.css", import.meta.url), "utf8"),
12+
readFile(new URL("../pages/agents/panels-status-files.ts", import.meta.url), "utf8"),
13+
readFile(new URL("../pages/cron/view.ts", import.meta.url), "utf8"),
14+
],
15+
);
16+
17+
expect(componentSource).toContain('import "../styles/cron-jobs-pagination.css"');
18+
expect(agentsSource).toContain('from "../../components/cron-jobs-pagination.ts"');
19+
expect(cronSource).toContain('from "../../components/cron-jobs-pagination.ts"');
20+
21+
for (const selector of [".cron-table__footer", ".cron-load-more"]) {
22+
expect(sharedStyles).toContain(`${selector} {`);
23+
expect(cronStyles).not.toContain(`${selector} {`);
24+
}
25+
});
26+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { html, nothing } from "lit";
2+
import { t } from "../i18n/index.ts";
3+
import "../styles/cron-jobs-pagination.css";
4+
5+
export function renderCronJobsPagination(params: {
6+
jobsShown: number;
7+
jobsTotal: number;
8+
hasMore: boolean;
9+
loading: boolean;
10+
loadingMore: boolean;
11+
onLoadMore: () => void;
12+
}) {
13+
return html`
14+
<div class="cron-table__footer">
15+
<span class="muted">
16+
${t("cron.list.shownOf", {
17+
shown: String(params.jobsShown),
18+
total: String(Math.max(params.jobsTotal, params.jobsShown)),
19+
})}
20+
</span>
21+
${params.hasMore
22+
? html`
23+
<button
24+
class="btn btn--sm cron-load-more"
25+
?disabled=${params.loading || params.loadingMore}
26+
@click=${params.onLoadMore}
27+
>
28+
${params.loadingMore ? t("cron.list.loading") : t("cron.list.loadMore")}
29+
</button>
30+
`
31+
: nothing}
32+
</div>
33+
`;
34+
}

‎ui/src/e2e/model-alias-display.e2e.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ suite.define(() => {
143143
expect(response?.status()).toBe(200);
144144
await gateway.waitForRequest("agents.list");
145145
await gateway.waitForRequest("config.get");
146-
const modelRequest = await gateway.waitForRequest("models.list");
147-
expect(modelRequest.params).toEqual({ view: "configured" });
146+
const modelRequest = await gateway.waitForRequest("chat.metadata");
147+
expect(modelRequest.params).toEqual({ agentId: "main" });
148+
expect(await gateway.getRequests("models.list")).toHaveLength(0);
148149

149150
const select = page.locator("select.settings-select").first();
150151
await select.waitFor({ state: "visible", timeout: 10_000 });

0 commit comments

Comments
 (0)