Skip to content

Commit

Permalink
mhutchie#462 Updated GitLab detail url
Browse files Browse the repository at this point in the history
  • Loading branch information
keydepth committed Apr 30, 2021
1 parent 8657451 commit 2dc18ad
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/cicdManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ export class CicdManager extends Disposable {
ret.forEach(element => {
let save: CICDDataSave;
if (cicdRequest.detail) {
save = this.convComitStatuses2CICDDataSave(element, cicdRequest.detail);
save = this.convGitLabComitStatuses2CICDDataSave(element, cicdRequest.detail,
`${hostProtocol}://${hostRootUrl}${hostPort === '' ? '' : ':' + hostPort}/${hostpath.replace(/%2F/g, '/')}/-/jobs/`);
} else {
save = this.convCICDData2CICDDataSave(element);
}
Expand Down Expand Up @@ -644,7 +645,7 @@ export class CicdManager extends Disposable {
}

/**
* Fetch an cicd from GitHub.
* Fetch an cicd from GitHub/GitLab/Jenkins.
* @param cicdData The CICDData.
* @returns The CICDDataSave.
*/
Expand All @@ -660,20 +661,24 @@ export class CicdManager extends Disposable {
}

/**
* Fetch an cicd from GitHub.
* @param cicdData The CICDData.
* Fetch an cicd from GitLab.
* @param data The result of GitLab commit statuses API.
* @param detail Detail fetch flag.
* @returns The CICDDataSave.
*/
private convComitStatuses2CICDDataSave(data: any, detail: boolean): CICDDataSave {
return {
private convGitLabComitStatuses2CICDDataSave(data: any, detail: boolean, url: string): CICDDataSave {
let ret = {
name: data!.name,
ref: data!.ref,
status: data!.status,
web_url: data!.target_url,
event: '',
detail: detail
};
if (typeof ret.web_url === 'undefined' || ret.web_url === null) {
ret.web_url = url + data.id;
}
return ret;
}

/**
Expand Down

0 comments on commit 2dc18ad

Please sign in to comment.