diff --git a/src/types/devops.ts b/src/types/devops.ts index 34e12b6..35fd7e9 100644 --- a/src/types/devops.ts +++ b/src/types/devops.ts @@ -221,10 +221,25 @@ export interface ProjectRefCommit { authoredAt?: string } +export interface ProjectRefPullRequest { + number: number + title: string + state: string + merged: boolean + mergedAt?: string + mergeCommitSha?: string + headRef?: string + headSha?: string + baseRef?: string + authorName?: string + url?: string +} + export interface ProjectRefItem { name: string commitSha?: string commit?: ProjectRefCommit + pullRequest?: ProjectRefPullRequest } export interface PipelineStep { diff --git a/src/views/ReleaseCenterView.vue b/src/views/ReleaseCenterView.vue index d4cf752..a2abeb9 100644 --- a/src/views/ReleaseCenterView.vue +++ b/src/views/ReleaseCenterView.vue @@ -105,6 +105,28 @@ const selectedCommitMeta = computed(() => { return parts.join(' · ') }) +const selectedPullRequest = computed(() => selectedRefDetail.value?.pullRequest) + +const selectedPullRequestMeta = computed(() => { + const pullRequest = selectedPullRequest.value + + if (!pullRequest) { + return '' + } + + const branchText = + pullRequest.headRef && pullRequest.baseRef + ? `${pullRequest.headRef} -> ${pullRequest.baseRef}` + : '' + const parts = [ + branchText, + pullRequest.authorName, + formatCommitTime(pullRequest.mergedAt), + ].filter(Boolean) + + return parts.join(' · ') +}) + const canTrigger = computed(() => { if (!form.projectKey || !form.environment || !form.ref) { return false @@ -325,6 +347,22 @@ watch(refOptions, (options) => { {{ selectedCommitMessage || 'Gitea 未返回提交说明' }} {{ selectedCommitMeta }} +
+ + PR #{{ selectedPullRequest.number }} + + + {{ selectedPullRequest.title }} + + {{ selectedPullRequest.title }} + {{ selectedPullRequestMeta }} +
@@ -437,8 +475,18 @@ watch(refOptions, (options) => { align-items: center; } +.commit-secondary { + display: grid; + grid-template-columns: max-content minmax(0, 1fr) max-content; + gap: 8px; + align-items: center; + min-width: 0; +} + .commit-main strong, -.commit-preview small { +.commit-preview small, +.commit-secondary strong, +.commit-secondary :deep(.el-link) { min-width: 0; overflow: hidden; text-overflow: ellipsis; @@ -456,6 +504,26 @@ watch(refOptions, (options) => { font-size: 12px; } +.commit-secondary strong, +.commit-secondary :deep(.el-link__inner) { + overflow: hidden; + color: #0f766e; + font-size: 12px; + font-weight: 600; + text-overflow: ellipsis; + white-space: nowrap; +} + +@media (max-width: 520px) { + .commit-secondary { + grid-template-columns: max-content minmax(0, 1fr); + } + + .commit-secondary small { + grid-column: 1 / -1; + } +} + @media (max-width: 760px) { .form-grid { grid-template-columns: 1fr;