fix: project center — fix empty repo list + Gitea tab bug + add repo selector
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 40s

- 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 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 20:03:27 +08:00
parent 7a7561363d
commit 75f8dd27e7

View File

@ -21,21 +21,25 @@ export class GiteaService {
}
async getRepos() {
const repos = await this.giteaGet<any[]>('/repos/search?limit=50');
// Try search with wildcard first, fall back to user repos
let repos = await this.giteaGet<any[]>('/repos/search?q=&limit=50');
if (!repos || repos.length === 0) {
repos = await this.giteaGet<any[]>('/user/repos?limit=50');
}
if (!repos) return [];
return Promise.all(repos.map(async (r: any) => {
const [issues, pulls, milestones] = await Promise.all([
this.giteaGet<any[]>(`/repos/${r.full_name}/issues?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0),
this.giteaGet<any[]>(`/repos/${r.full_name}/pulls?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0),
this.giteaGet<any[]>(`/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) {