From f786570c0ebfdb8245dac9c96966506833117e6f Mon Sep 17 00:00:00 2001 From: mo Date: Mon, 2 May 2022 13:47:35 -0500 Subject: [PATCH] hyperlink the commit hash Signed-off-by: mo --- .../azure-devops-backend/src/api/AzureDevOpsApi.ts | 14 ++++++++++++-- plugins/azure-devops-common/src/types.ts | 1 + .../src/components/GitTagTable/GitTagTable.tsx | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/azure-devops-backend/src/api/AzureDevOpsApi.ts b/plugins/azure-devops-backend/src/api/AzureDevOpsApi.ts index d77de5d528..b6cc174056 100644 --- a/plugins/azure-devops-backend/src/api/AzureDevOpsApi.ts +++ b/plugins/azure-devops-backend/src/api/AzureDevOpsApi.ts @@ -148,8 +148,11 @@ export class AzureDevOpsApi { const linkBaseUrl = `${this.webApi.serverUrl}/${encodeURIComponent( projectName, )}/_git/${encodeURIComponent(repoName)}?version=GT`; + const commitBaseUrl = `${this.webApi.serverUrl}/${encodeURIComponent( + projectName, + )}/_git/${encodeURIComponent(repoName)}/commit`; const gitTags: GitTag[] = tagRefs.map(tagRef => { - return mappedGitTag(tagRef, linkBaseUrl); + return mappedGitTag(tagRef, linkBaseUrl, commitBaseUrl); }); return gitTags; @@ -391,7 +394,11 @@ export function mappedRepoBuild(build: Build): RepoBuild { }; } -export function mappedGitTag(gitRef: GitRef, linkBaseUrl: string): GitTag { +export function mappedGitTag( + gitRef: GitRef, + linkBaseUrl: string, + commitBaseUrl: string, +): GitTag { return { objectId: gitRef.objectId, peeledObjectId: gitRef.peeledObjectId, @@ -400,6 +407,9 @@ export function mappedGitTag(gitRef: GitRef, linkBaseUrl: string): GitTag { link: `${linkBaseUrl}${encodeURIComponent( gitRef.name?.replace('refs/tags/', '') ?? '', )}`, + commitLink: `${commitBaseUrl}/${encodeURIComponent( + gitRef.peeledObjectId ?? '', + )}`, }; } diff --git a/plugins/azure-devops-common/src/types.ts b/plugins/azure-devops-common/src/types.ts index 3cf3a9fa9c..0ff5e897ed 100644 --- a/plugins/azure-devops-common/src/types.ts +++ b/plugins/azure-devops-common/src/types.ts @@ -114,6 +114,7 @@ export type GitTag = { name?: string; createdBy?: string; link: string; + commitLink: string; }; export type PullRequest = { diff --git a/plugins/azure-devops/src/components/GitTagTable/GitTagTable.tsx b/plugins/azure-devops/src/components/GitTagTable/GitTagTable.tsx index 4b8f63e187..5ed304ee7d 100644 --- a/plugins/azure-devops/src/components/GitTagTable/GitTagTable.tsx +++ b/plugins/azure-devops/src/components/GitTagTable/GitTagTable.tsx @@ -44,6 +44,11 @@ const columns: TableColumn[] = [ title: 'Commit', field: 'peeledObjectId', width: 'auto', + render: (row: Partial) => ( + + {row.peeledObjectId} + + ), }, { title: 'Created By',