render actual git tag data in table in client
Signed-off-by: mo <mcassidy@hchb.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
BuildRun,
|
||||
BuildRunOptions,
|
||||
DashboardPullRequest,
|
||||
GitTag,
|
||||
PullRequest,
|
||||
PullRequestOptions,
|
||||
RepoBuild,
|
||||
@@ -42,7 +43,7 @@ export interface AzureDevOpsApi {
|
||||
projectName: string,
|
||||
repoName: string,
|
||||
options?: PullRequestOptions,
|
||||
): Promise<{ items: PullRequest[] }>;
|
||||
): Promise<{ items: GitTag[] }>;
|
||||
|
||||
getPullRequests(
|
||||
projectName: string,
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
BuildRun,
|
||||
BuildRunOptions,
|
||||
DashboardPullRequest,
|
||||
GitTag,
|
||||
PullRequest,
|
||||
PullRequestOptions,
|
||||
RepoBuild,
|
||||
@@ -62,7 +63,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
projectName: string,
|
||||
repoName: string,
|
||||
options?: PullRequestOptions,
|
||||
): Promise<{ items: PullRequest[] }> {
|
||||
): Promise<{ items: GitTag[] }> {
|
||||
const queryString = new URLSearchParams();
|
||||
if (options?.top) {
|
||||
queryString.append('top', options.top.toString());
|
||||
@@ -74,7 +75,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
projectName,
|
||||
)}/${encodeURIComponent(repoName)}?${queryString}`;
|
||||
|
||||
const items = await this.get<PullRequest[]>(urlSegment);
|
||||
const items = await this.get<GitTag[]>(urlSegment);
|
||||
return { items };
|
||||
}
|
||||
|
||||
|
||||
@@ -35,39 +35,14 @@ import { useGitTags } from '../../hooks/useGitTags';
|
||||
|
||||
const columns: TableColumn[] = [
|
||||
{
|
||||
title: 'ID',
|
||||
field: 'pullRequestId',
|
||||
title: 'Tag',
|
||||
field: 'name',
|
||||
highlight: false,
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
title: 'Title',
|
||||
field: 'title',
|
||||
width: 'auto',
|
||||
render: (row: Partial<PullRequest>) => (
|
||||
<Box display="flex" alignItems="center">
|
||||
<Link to={row.link ?? ''}>{row.title}</Link>
|
||||
{row.isDraft && (
|
||||
<Box paddingLeft={1}>
|
||||
<Chip
|
||||
label="Draft"
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
size="small"
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: 'Source',
|
||||
field: 'sourceRefName',
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
title: 'Target',
|
||||
field: 'targetRefName',
|
||||
title: 'Commit',
|
||||
field: 'peeledObjectId',
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
@@ -75,16 +50,6 @@ const columns: TableColumn[] = [
|
||||
field: 'createdBy',
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
title: 'Created',
|
||||
field: 'creationDate',
|
||||
width: 'auto',
|
||||
render: (row: Partial<PullRequest>) =>
|
||||
(row.creationDate
|
||||
? DateTime.fromISO(row.creationDate)
|
||||
: DateTime.now()
|
||||
).toRelative(),
|
||||
},
|
||||
];
|
||||
|
||||
type PullRequestTableProps = {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
PullRequest,
|
||||
GitTag,
|
||||
PullRequestOptions,
|
||||
PullRequestStatus,
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
@@ -33,7 +33,7 @@ export function useGitTags(
|
||||
defaultLimit?: number,
|
||||
requestedStatus?: PullRequestStatus,
|
||||
): {
|
||||
items?: PullRequest[];
|
||||
items?: GitTag[];
|
||||
loading: boolean;
|
||||
error?: Error;
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user