Loading src/desktop/commands/pipeline_actions.test.ts +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { cancelPipeline, retryPipeline } from './pipeline_actions'; jest.mock('../gitlab/get_gitlab_service'); describe('retryOrCancelPipeline', () => { const item = new PipelineItemModel(projectInRepository, pipeline, [job], false); const item = new PipelineItemModel(projectInRepository, pipeline, [job]); const gitLabService: Partial<GitLabService> = { cancelOrRetryPipeline: jest.fn(), }; Loading src/desktop/current_branch_refresher.test.ts +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ describe('CurrentBranchRefrehser', () => { getMrClosingIssues: () => [{ iid: 123 }], getSingleProjectIssue: () => issue, getJobsForPipeline: () => [job], getTriggerJobsForPipeline: () => [], getExternalStatusForCommit: () => [externalStatus], fetchFromApi: () => [pipeline], }); Loading src/desktop/current_branch_refresher.ts +6 −10 Original line number Diff line number Diff line Loading @@ -53,16 +53,12 @@ const getJobs = async ( if (!pipeline) return []; try { const projectId = projectInRepository.project.restId; const pipelinePromise = getGitLabService(projectInRepository).getJobsForPipeline( pipeline.id, projectId, ); const statusPromise = getGitLabService(projectInRepository).getExternalStatusForCommit( pipeline.sha, pipeline.ref, projectId, ); return [...(await pipelinePromise), ...(await statusPromise)]; const service = getGitLabService(projectInRepository); const pipelinePromise = service.getJobsForPipeline(pipeline.id, projectId); const bridgesPromise = service.getTriggerJobsForPipeline(pipeline.id, projectId); const statusPromise = service.getExternalStatusForCommit(pipeline.sha, pipeline.ref, projectId); return [...(await pipelinePromise), ...(await bridgesPromise), ...(await statusPromise)]; } catch (e) { log.error(new UserFriendlyError('Failed to fetch jobs for pipeline.', e)); return []; Loading src/desktop/gitlab/gitlab_service.ts +9 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,15 @@ export class GitLabService { ); } async getTriggerJobsForPipeline(pipelineId: number, projectId: number): Promise<RestJob[]> { const pages: RestJob[] = await this.fetchAllPages( `/projects/${projectId}/pipelines/${pipelineId}/bridges`, {}, 'trigger jobs for pipeline', ); return pages; } async getExternalStatusForCommit( sha: string, ref: string | null, Loading src/desktop/tree_view/current_branch_data_provider.ts +4 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import { ErrorItem } from './items/error_item'; import { ItemModel } from './items/item_model'; import { MrItemModel } from './items/mr_item_model'; import { IssueItem } from './items/issue_item'; import { PipelineItemModel } from './items/pipeline_item_model'; import { PipelineRootItemModel } from './items/pipeline_root_item_model'; import { isEnabled, FeatureFlag } from '../../common/feature_flags'; import { Loading @@ -30,7 +30,7 @@ export class CurrentBranchDataProvider private state: TreeState = { type: 'invalid' }; private pipelineItem?: PipelineItemModel; private pipelineItem?: PipelineRootItemModel; private mrState?: { mr: RestMr; item: MrItemModel }; Loading @@ -43,11 +43,11 @@ export class CurrentBranchDataProvider if (!state.pipeline) { return new vscode.TreeItem('No pipeline found'); } this.pipelineItem = new PipelineItemModel( this.pipelineItem = new PipelineRootItemModel( state.projectInRepository, state.pipeline, state.jobs, state.type === 'tag', state.type === 'tag' ? 'Tag Pipeline' : 'Pipeline', ); return this.pipelineItem; } Loading Loading
src/desktop/commands/pipeline_actions.test.ts +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { cancelPipeline, retryPipeline } from './pipeline_actions'; jest.mock('../gitlab/get_gitlab_service'); describe('retryOrCancelPipeline', () => { const item = new PipelineItemModel(projectInRepository, pipeline, [job], false); const item = new PipelineItemModel(projectInRepository, pipeline, [job]); const gitLabService: Partial<GitLabService> = { cancelOrRetryPipeline: jest.fn(), }; Loading
src/desktop/current_branch_refresher.test.ts +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ describe('CurrentBranchRefrehser', () => { getMrClosingIssues: () => [{ iid: 123 }], getSingleProjectIssue: () => issue, getJobsForPipeline: () => [job], getTriggerJobsForPipeline: () => [], getExternalStatusForCommit: () => [externalStatus], fetchFromApi: () => [pipeline], }); Loading
src/desktop/current_branch_refresher.ts +6 −10 Original line number Diff line number Diff line Loading @@ -53,16 +53,12 @@ const getJobs = async ( if (!pipeline) return []; try { const projectId = projectInRepository.project.restId; const pipelinePromise = getGitLabService(projectInRepository).getJobsForPipeline( pipeline.id, projectId, ); const statusPromise = getGitLabService(projectInRepository).getExternalStatusForCommit( pipeline.sha, pipeline.ref, projectId, ); return [...(await pipelinePromise), ...(await statusPromise)]; const service = getGitLabService(projectInRepository); const pipelinePromise = service.getJobsForPipeline(pipeline.id, projectId); const bridgesPromise = service.getTriggerJobsForPipeline(pipeline.id, projectId); const statusPromise = service.getExternalStatusForCommit(pipeline.sha, pipeline.ref, projectId); return [...(await pipelinePromise), ...(await bridgesPromise), ...(await statusPromise)]; } catch (e) { log.error(new UserFriendlyError('Failed to fetch jobs for pipeline.', e)); return []; Loading
src/desktop/gitlab/gitlab_service.ts +9 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,15 @@ export class GitLabService { ); } async getTriggerJobsForPipeline(pipelineId: number, projectId: number): Promise<RestJob[]> { const pages: RestJob[] = await this.fetchAllPages( `/projects/${projectId}/pipelines/${pipelineId}/bridges`, {}, 'trigger jobs for pipeline', ); return pages; } async getExternalStatusForCommit( sha: string, ref: string | null, Loading
src/desktop/tree_view/current_branch_data_provider.ts +4 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import { ErrorItem } from './items/error_item'; import { ItemModel } from './items/item_model'; import { MrItemModel } from './items/mr_item_model'; import { IssueItem } from './items/issue_item'; import { PipelineItemModel } from './items/pipeline_item_model'; import { PipelineRootItemModel } from './items/pipeline_root_item_model'; import { isEnabled, FeatureFlag } from '../../common/feature_flags'; import { Loading @@ -30,7 +30,7 @@ export class CurrentBranchDataProvider private state: TreeState = { type: 'invalid' }; private pipelineItem?: PipelineItemModel; private pipelineItem?: PipelineRootItemModel; private mrState?: { mr: RestMr; item: MrItemModel }; Loading @@ -43,11 +43,11 @@ export class CurrentBranchDataProvider if (!state.pipeline) { return new vscode.TreeItem('No pipeline found'); } this.pipelineItem = new PipelineItemModel( this.pipelineItem = new PipelineRootItemModel( state.projectInRepository, state.pipeline, state.jobs, state.type === 'tag', state.type === 'tag' ? 'Tag Pipeline' : 'Pipeline', ); return this.pipelineItem; } Loading