Add ticket pull request visibility
This commit is contained in:
@@ -36,6 +36,15 @@ const visibleRepositoryBranches = computed(() =>
|
||||
),
|
||||
);
|
||||
|
||||
const visibleRepositoryPullRequests = computed(() =>
|
||||
props.repositoryPullRequests.filter(
|
||||
(repositoryPullRequest) =>
|
||||
repositoryPullRequest.pull_requests.length > 0 ||
|
||||
repositoryPullRequest.error !== null ||
|
||||
!repositoryPullRequest.repository_connection.has_personal_access,
|
||||
),
|
||||
);
|
||||
|
||||
const breadcrumbs: BreadcrumbItem[] = [
|
||||
{
|
||||
title: 'Projects',
|
||||
@@ -687,6 +696,135 @@ const formatDateTime = (value: string): string => {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card class="h-fit">
|
||||
<CardHeader>
|
||||
<CardTitle>Pull requests</CardTitle>
|
||||
<CardDescription>
|
||||
Matching pull requests are detected from linked
|
||||
repositories by checking whether the source
|
||||
branch starts with this ticket key.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent class="space-y-4">
|
||||
<div
|
||||
v-if="
|
||||
visibleRepositoryPullRequests.length === 0
|
||||
"
|
||||
class="rounded-xl border border-dashed border-border px-4 py-6 text-sm text-muted-foreground"
|
||||
>
|
||||
No matching pull requests were found across the
|
||||
linked repositories you can access.
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-3">
|
||||
<div
|
||||
v-for="repositoryPullRequest in visibleRepositoryPullRequests"
|
||||
:key="
|
||||
repositoryPullRequest
|
||||
.repository_connection.id
|
||||
"
|
||||
class="rounded-xl border border-border px-4 py-4"
|
||||
>
|
||||
<div
|
||||
class="flex flex-wrap items-center gap-2"
|
||||
>
|
||||
<Badge variant="secondary">
|
||||
{{
|
||||
repositoryPullRequest
|
||||
.repository_connection
|
||||
.provider_label
|
||||
}}
|
||||
</Badge>
|
||||
<span class="font-medium">
|
||||
{{
|
||||
repositoryPullRequest
|
||||
.repository_connection
|
||||
.repository_full_name
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p
|
||||
class="mt-2 text-sm text-muted-foreground"
|
||||
>
|
||||
{{
|
||||
repositoryPullRequest
|
||||
.repository_connection.base_url
|
||||
}}
|
||||
</p>
|
||||
|
||||
<div
|
||||
v-if="
|
||||
!repositoryPullRequest
|
||||
.repository_connection
|
||||
.has_personal_access
|
||||
"
|
||||
class="mt-3 space-y-3"
|
||||
>
|
||||
<p
|
||||
class="text-sm text-muted-foreground"
|
||||
>
|
||||
Connect a matching Git account in
|
||||
your user settings to inspect pull
|
||||
requests for this repository.
|
||||
</p>
|
||||
|
||||
<Button as-child variant="outline" size="sm">
|
||||
<Link :href="editGitConnections()">
|
||||
Open Git connections
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else-if="repositoryPullRequest.error"
|
||||
class="mt-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900/70 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
>
|
||||
{{ repositoryPullRequest.error }}
|
||||
</div>
|
||||
|
||||
<div v-else class="mt-3 space-y-3">
|
||||
<div
|
||||
v-for="pullRequest in repositoryPullRequest.pull_requests"
|
||||
:key="pullRequest.html_url"
|
||||
class="rounded-xl border border-border/70 px-4 py-3"
|
||||
>
|
||||
<div
|
||||
class="flex flex-wrap items-center gap-2"
|
||||
>
|
||||
<Badge variant="outline">
|
||||
#{{ pullRequest.number }}
|
||||
</Badge>
|
||||
<Badge variant="secondary">
|
||||
{{
|
||||
pullRequest.status
|
||||
}}
|
||||
</Badge>
|
||||
<a
|
||||
:href="pullRequest.html_url"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
class="font-medium text-foreground transition hover:text-primary"
|
||||
>
|
||||
{{ pullRequest.title }}
|
||||
</a>
|
||||
</div>
|
||||
<p
|
||||
class="mt-2 text-sm text-muted-foreground"
|
||||
>
|
||||
Source branch:
|
||||
{{
|
||||
pullRequest.source_branch
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card class="h-fit">
|
||||
<CardHeader>
|
||||
<CardTitle>Child tickets</CardTitle>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export type TicketPullRequestModel = {
|
||||
html_url: string;
|
||||
number: string;
|
||||
source_branch: string;
|
||||
status: string;
|
||||
title: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { RepositoryConnectionModel } from '@/types/models/repository-connection-model';
|
||||
import type { TicketPullRequestModel } from '@/types/models/ticket-pull-request-model';
|
||||
|
||||
export type TicketRepositoryPullRequestModel = {
|
||||
error: string | null;
|
||||
pull_requests: TicketPullRequestModel[];
|
||||
repository_connection: RepositoryConnectionModel;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import type { TicketRepositoryBranchModel } from '@/types/models/ticket-reposito
|
||||
import type { TicketLinkModel } from '@/types/models/ticket-link-model';
|
||||
import type { TicketLinkTypeModel } from '@/types/models/ticket-link-type-model';
|
||||
import type { TicketReferenceModel } from '@/types/models/ticket-reference-model';
|
||||
import type { TicketRepositoryPullRequestModel } from '@/types/models/ticket-repository-pull-request-model';
|
||||
import type { TicketModel } from '@/types/models/ticket-model';
|
||||
import type { TicketPriorityModel } from '@/types/models/ticket-priority-model';
|
||||
import type { TicketTreeNodeModel } from '@/types/models/ticket-tree-node-model';
|
||||
@@ -103,6 +104,7 @@ export type ProjectTicketPageProps = {
|
||||
parentTicketOptions: TicketReferenceModel[];
|
||||
project: ProjectModel;
|
||||
repositoryBranches: TicketRepositoryBranchModel[];
|
||||
repositoryPullRequests: TicketRepositoryPullRequestModel[];
|
||||
status?: string | null;
|
||||
ticket: TicketModel;
|
||||
ticketFieldDefinitions: TicketFieldDefinitionModel[];
|
||||
|
||||
Reference in New Issue
Block a user