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
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:
parent
7a7561363d
commit
75f8dd27e7
@ -21,21 +21,25 @@ export class GiteaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getRepos() {
|
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 [];
|
if (!repos) return [];
|
||||||
return Promise.all(repos.map(async (r: any) => {
|
|
||||||
const [issues, pulls, milestones] = await Promise.all([
|
const enriched: any[] = [];
|
||||||
this.giteaGet<any[]>(`/repos/${r.full_name}/issues?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0),
|
for (const r of repos) {
|
||||||
this.giteaGet<any[]>(`/repos/${r.full_name}/pulls?state=all&limit=1`).then(d => d?.length ?? 0).catch(() => 0),
|
const fullName = r.full_name;
|
||||||
this.giteaGet<any[]>(`/repos/${r.full_name}/milestones?state=open`).catch(() => []),
|
// Just use open_issues_count from the search result; skip extra API calls
|
||||||
]);
|
enriched.push({
|
||||||
return {
|
id: r.id, name: r.name, fullName, description: r.description,
|
||||||
id: r.id, name: r.name, fullName: r.full_name, description: r.description,
|
owner: r.owner?.login, stars: r.stars_count ?? 0, forks: r.forks_count ?? 0,
|
||||||
owner: r.owner?.login, stars: r.stars_count, forks: r.forks_count,
|
openIssues: r.open_issues_count ?? 0, openPulls: 0, milestones: 0,
|
||||||
openIssues: r.open_issues_count, openPulls: pulls, milestones: milestones?.length ?? 0,
|
|
||||||
defaultBranch: r.default_branch, updatedAt: r.updated_at,
|
defaultBranch: r.default_branch, updatedAt: r.updated_at,
|
||||||
};
|
});
|
||||||
}));
|
}
|
||||||
|
return enriched;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMilestones(owner: string, repo: string) {
|
async getMilestones(owner: string, repo: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user