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';
|
||||
|
||||
/**
|
||||
* GitLab API v4 provider implementation
|
||||
@@ -85,6 +85,23 @@ export class GitLabProvider extends BaseProvider {
|
||||
return allGroups.map((g) => this.mapGroup(g));
|
||||
}
|
||||
|
||||
async getGroupProjects(groupId: string, opts?: IListOptions): Promise<interfaces.data.IProject[]> {
|
||||
if (opts?.page) {
|
||||
const projects = await this.client.getGroupProjects(groupId, opts);
|
||||
return projects.map((p) => this.mapProject(p));
|
||||
}
|
||||
const allProjects: plugins.gitlabClient.IGitLabProject[] = [];
|
||||
const perPage = opts?.perPage || 50;
|
||||
let page = 1;
|
||||
while (true) {
|
||||
const projects = await this.client.getGroupProjects(groupId, { ...opts, page, perPage });
|
||||
allProjects.push(...projects);
|
||||
if (projects.length < perPage) break;
|
||||
page++;
|
||||
}
|
||||
return allProjects.map((p) => this.mapProject(p));
|
||||
}
|
||||
|
||||
// --- Branches / Tags ---
|
||||
|
||||
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
|
||||
@@ -183,9 +200,15 @@ export class GitLabProvider extends BaseProvider {
|
||||
|
||||
async getPipelines(
|
||||
projectId: string,
|
||||
opts?: IListOptions,
|
||||
opts?: IPipelineListOptions,
|
||||
): Promise<interfaces.data.IPipeline[]> {
|
||||
const pipelines = await this.client.getPipelines(projectId, opts);
|
||||
const pipelines = await this.client.getPipelines(projectId, {
|
||||
page: opts?.page,
|
||||
perPage: opts?.perPage,
|
||||
status: opts?.status,
|
||||
ref: opts?.ref,
|
||||
source: opts?.source,
|
||||
});
|
||||
return pipelines.map((p) => this.mapPipeline(p, projectId));
|
||||
}
|
||||
|
||||
@@ -258,11 +281,11 @@ export class GitLabProvider extends BaseProvider {
|
||||
};
|
||||
}
|
||||
|
||||
private mapPipeline(p: plugins.gitlabClient.IGitLabPipeline, projectId: string): interfaces.data.IPipeline {
|
||||
private mapPipeline(p: plugins.gitlabClient.IGitLabPipeline, projectId: string, projectName?: string): interfaces.data.IPipeline {
|
||||
return {
|
||||
id: String(p.id),
|
||||
projectId,
|
||||
projectName: projectId,
|
||||
projectName: projectName || projectId,
|
||||
connectionId: this.connectionId,
|
||||
status: (p.status || 'pending') as interfaces.data.TPipelineStatus,
|
||||
ref: p.ref || '',
|
||||
|
||||
Reference in New Issue
Block a user