feat(pipelines): add pipelines view modes, time-range filtering, group aggregation, sorting, and job log polling
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as plugins from '../plugins.ts';
|
||||
import type * as interfaces from '../../ts_interfaces/index.ts';
|
||||
import { BaseProvider, type ITestConnectionResult, type IListOptions } from './classes.baseprovider.ts';
|
||||
import { BaseProvider, type ITestConnectionResult, type IListOptions, type IPipelineListOptions } from './classes.baseprovider.ts';
|
||||
|
||||
/**
|
||||
* Gitea API v1 provider implementation
|
||||
@@ -70,6 +70,23 @@ export class GiteaProvider extends BaseProvider {
|
||||
return allOrgs.map((o) => this.mapGroup(o));
|
||||
}
|
||||
|
||||
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||
if (opts?.page) {
|
||||
const repos = await this.client.getOrgRepos(groupId, opts);
|
||||
return repos.map((r) => this.mapProject(r));
|
||||
}
|
||||
const allRepos: plugins.giteaClient.IGiteaRepository[] = [];
|
||||
const perPage = opts?.perPage || 50;
|
||||
let page = 1;
|
||||
while (true) {
|
||||
const repos = await this.client.getOrgRepos(groupId, { ...opts, page, perPage });
|
||||
allRepos.push(...repos);
|
||||
if (repos.length < perPage) break;
|
||||
page++;
|
||||
}
|
||||
return allRepos.map((r) => this.mapProject(r));
|
||||
}
|
||||
|
||||
// --- Branches / Tags ---
|
||||
|
||||
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
||||
@@ -166,9 +183,15 @@ export class GiteaProvider extends BaseProvider {
|
||||
|
||||
async getPipelines(
|
||||
projectId: string,
|
||||
opts?: IListOptions,
|
||||
opts?: IPipelineListOptions,
|
||||
): Promise<interfaces.data.IPipeline[]> {
|
||||
const runs = await this.client.getActionRuns(projectId, opts);
|
||||
const runs = await this.client.getActionRuns(projectId, {
|
||||
page: opts?.page,
|
||||
perPage: opts?.perPage,
|
||||
status: opts?.status,
|
||||
branch: opts?.ref,
|
||||
event: opts?.source,
|
||||
});
|
||||
return runs.map((r) => this.mapPipeline(r, projectId));
|
||||
}
|
||||
|
||||
@@ -236,11 +259,11 @@ export class GiteaProvider extends BaseProvider {
|
||||
};
|
||||
}
|
||||
|
||||
private mapPipeline(r: plugins.giteaClient.IGiteaActionRun, projectId: string): interfaces.data.IPipeline {
|
||||
private mapPipeline(r: plugins.giteaClient.IGiteaActionRun, projectId: string, projectName?: string): interfaces.data.IPipeline {
|
||||
return {
|
||||
id: String(r.id),
|
||||
projectId,
|
||||
projectName: projectId,
|
||||
projectName: projectName || projectId,
|
||||
connectionId: this.connectionId,
|
||||
status: this.mapStatus(r.status || r.conclusion),
|
||||
ref: r.head_branch || '',
|
||||
|
||||
Reference in New Issue
Block a user