From 75f8dd27e7620d7bcbaf8bd11bb7bb0ff1539ce3 Mon Sep 17 00:00:00 2001 From: WangDL Date: Sun, 24 May 2026 20:03:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20project=20center=20=E2=80=94=20fix=20emp?= =?UTF-8?q?ty=20repo=20list=20+=20Gitea=20tab=20bug=20+=20add=20repo=20sel?= =?UTF-8?q?ector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GiteaService: use /repos/search?q= with fallback to /user/repos, remove slow per-repo API calls - Frontend: add RepoSelector dropdown to Issues/Milestones/Releases tabs - Fix Gitea panel tab (was filtered out by conditional undefined) Co-Authored-By: Claude Opus 4.7 --- src/modules/project-center/gitea.service.ts | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/modules/project-center/gitea.service.ts b/src/modules/project-center/gitea.service.ts index 8487bcf..8e67ce2 100644 --- a/src/modules/project-center/gitea.service.ts +++ b/src/modules/project-center/gitea.service.ts @@ -21,21 +21,25 @@ export class GiteaService { } async getRepos() { - const repos = await this.giteaGet('/repos/search?limit=50'); + // Try search with wildcard first, fall back to user repos + let repos = await this.giteaGet('/repos/search?q=&limit=50'); + if (!repos || repos.length === 0) { + repos = await this.giteaGet('/user/repos?limit=50'); + } if (!repos) return []; - return Promise.all(repos.map(async (r: any) => { - const [issues, pulls, milestones] = await Promise.all([ - this.giteaGet(`/repos/${r.full_name}/issues?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0), - this.giteaGet(`/repos/${r.full_name}/pulls?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0), - this.giteaGet(`/repos/${r.full_name}/milestones?state=open`).catch(() => []), - ]); - return { - id: r.id, name: r.name, fullName: r.full_name, description: r.description, - owner: r.owner?.login, stars: r.stars_count, forks: r.forks_count, - openIssues: r.open_issues_count, openPulls: pulls, milestones: milestones?.length ?? 0, + + const enriched: any[] = []; + for (const r of repos) { + const fullName = r.full_name; + // Just use open_issues_count from the search result; skip extra API calls + enriched.push({ + id: r.id, name: r.name, fullName, description: r.description, + owner: r.owner?.login, stars: r.stars_count ?? 0, forks: r.forks_count ?? 0, + openIssues: r.open_issues_count ?? 0, openPulls: 0, milestones: 0, defaultBranch: r.default_branch, updatedAt: r.updated_at, - }; - })); + }); + } + return enriched; } async getMilestones(owner: string, repo: string) {