feat(sync): add sync subsystem: SyncManager, OpsServer sync handlers, Sync UI and state, provider groupFilter support, and realtime sync log streaming via TypedSocket
This commit is contained in:
@@ -8,8 +8,8 @@ import { BaseProvider, type ITestConnectionResult, type IListOptions } from './c
|
||||
export class GiteaProvider extends BaseProvider {
|
||||
private client: plugins.giteaClient.GiteaClient;
|
||||
|
||||
constructor(connectionId: string, baseUrl: string, token: string) {
|
||||
super(connectionId, baseUrl, token);
|
||||
constructor(connectionId: string, baseUrl: string, token: string, groupFilterId?: string) {
|
||||
super(connectionId, baseUrl, token, groupFilterId);
|
||||
this.client = new plugins.giteaClient.GiteaClient(baseUrl, token);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,14 @@ export class GiteaProvider extends BaseProvider {
|
||||
}
|
||||
|
||||
async getProjects(opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||
// Use org-scoped listing when groupFilterId is set
|
||||
const fetchFn = this.groupFilterId
|
||||
? (o: IListOptions) => this.client.getOrgRepos(this.groupFilterId!, o)
|
||||
: (o: IListOptions) => this.client.getRepos(o);
|
||||
|
||||
// If caller explicitly requests a specific page, respect it (no auto-pagination)
|
||||
if (opts?.page) {
|
||||
const repos = await this.client.getRepos(opts);
|
||||
const repos = await fetchFn(opts);
|
||||
return repos.map((r) => this.mapProject(r));
|
||||
}
|
||||
|
||||
@@ -29,7 +34,7 @@ export class GiteaProvider extends BaseProvider {
|
||||
let page = 1;
|
||||
|
||||
while (true) {
|
||||
const repos = await this.client.getRepos({ ...opts, page, perPage });
|
||||
const repos = await fetchFn({ ...opts, page, perPage });
|
||||
allRepos.push(...repos);
|
||||
if (repos.length < perPage) break;
|
||||
page++;
|
||||
@@ -39,6 +44,12 @@ export class GiteaProvider extends BaseProvider {
|
||||
}
|
||||
|
||||
async getGroups(opts?: IListOptions): Promise<interfaces.data.IGroup[]> {
|
||||
// When groupFilterId is set, return only that single org
|
||||
if (this.groupFilterId) {
|
||||
const org = await this.client.getOrg(this.groupFilterId);
|
||||
return [this.mapGroup(org)];
|
||||
}
|
||||
|
||||
// If caller explicitly requests a specific page, respect it (no auto-pagination)
|
||||
if (opts?.page) {
|
||||
const orgs = await this.client.getOrgs(opts);
|
||||
|
||||
Reference in New Issue
Block a user