419974952a84

remove unnecessary repository search (v3.0.126)

time
2026-09-29 21:26 UTC · 1 week ago
machine
Junes-MacBook-Pro.local
agent
gpt-6-sol
session
direct repo selection
parent
68cf65f02c26
3 files package.json+1 −1src/admin/repos.ts+4 −14tests/console.test.ts+4 −3
package.json+1 −1
@@ -1,6 +1,6 @@11 {22 	"name": "kepr",3-	"version": "3.0.125",3+	"version": "3.0.126",44 	"private": true,55 	"type": "module",66 	"scripts": {

view file

src/admin/repos.ts+4 −14
@@ -51,31 +51,21 @@5151 5252 function reposPage(c: Context, ctx: AdminContext, error: string): string {5353 	const repos = allRepos(ctx.kepr);54-	const query = (c.req.query("q") ?? "").slice(0, 100);55-	const filtered = repos.filter((repo) =>56-		`${repo.name} ${repo.category}`.toLowerCase().includes(query.toLowerCase()),57-	);58-	const selected = filtered.find((repo) => repo.name === c.req.query("repo")) ?? filtered[0];54+	const selected = repos.find((repo) => repo.name === c.req.query("repo")) ?? repos[0];5955 	const body = html`${notice(error)}6056 <p class="admin-intro">Choose a repository to manage its visibility and public page.</p>61-<form class="issues-form" method="get" action="/admin/repos">62-<label class="issues-label" for="repo-search">find a repository</label>63-<input class="issues-input" id="repo-search" name="q" value="${query}" maxlength="100" type="search">64-<button class="issues-submit" type="submit">search</button></form>6557 <form method="post" action="/admin/sync">6658 ${formField(c)}<button class="issues-submit" type="submit">sync now</button></form>6759 ${repos.length === 0 && html`<p class="muted mono save-empty">no repos found in the bucket yet</p>`}6860 <div class="admin-repos">6961 <nav aria-label="repositories">70-${filtered.map(71-	(72-		repo,73-	) => html`<a class="issue-row" id="repo-${repo.name}" href="/admin/repos?repo=${repo.name}&q=${encodeURIComponent(query)}#repo-editor"${selected?.name === repo.name ? html` aria-current="page"` : ""}>62+${repos.map(63+	(repo) => html`<a class="issue-row" id="repo-${repo.name}"64+href="/admin/repos?repo=${repo.name}#repo-editor"${selected?.name === repo.name ? html` aria-current="page"` : ""}>7465 <span>${repo.name}</span><span>${repo.public ? "public" : "private"}</span>7566 <span class="issue-meta mono">${repo.last_sync_at === null ? "never synced" : `last sync ${formatDate(repo.last_sync_at)} UTC`}</span>7667 ${repo.last_sync_error && html`<span class="issues-error">${repo.last_sync_error}</span>`}</a>`,7768 )}78-${repos.length > 0 && filtered.length === 0 && html`<p class="muted">No repositories match “${query}”. <a href="/admin/repos">clear search</a></p>`}7969 </nav>8070 ${selected && repoForm(c, selected, quarantinedPaths(openMirror(ctx.mirrorDir, selected.name)))}8171 </div>`;

view file

tests/console.test.ts+4 −3
@@ -81,10 +81,11 @@8181 		expect((await statuses()).every((line) => line.endsWith(" 404"))).toBe(true);8282 	});8383 84-	test("repo search focuses one settings form and links back to the selected repo after saving", async () => {85-		const page = await (await browser.get("/admin/repos?q=other")).text();84+	test("repo selection focuses one settings form without a search form", async () => {85+		const page = await (await browser.get("/admin/repos?repo=other")).text();8686 		expect(page).toContain('action="/admin/repos/other"');87-		expect(page).not.toContain('id="repo-app"');87+		expect(page).toContain('id="repo-app"');88+		expect(page).not.toContain('type="search"');8889 		const saved = await publish("other", {});8990 		expect(saved.headers.get("location")).toBe("/admin/repos?repo=other&saved=1#repo-editor");9091 		expect(await (await browser.get("/admin/repos?repo=other&saved=1")).text()).toContain(

view file