feat: 展示发布 PR 来源信息
This commit is contained in:
@@ -221,10 +221,25 @@ export interface ProjectRefCommit {
|
|||||||
authoredAt?: string
|
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 {
|
export interface ProjectRefItem {
|
||||||
name: string
|
name: string
|
||||||
commitSha?: string
|
commitSha?: string
|
||||||
commit?: ProjectRefCommit
|
commit?: ProjectRefCommit
|
||||||
|
pullRequest?: ProjectRefPullRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PipelineStep {
|
export interface PipelineStep {
|
||||||
|
|||||||
@@ -105,6 +105,28 @@ const selectedCommitMeta = computed(() => {
|
|||||||
return parts.join(' · ')
|
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(() => {
|
const canTrigger = computed(() => {
|
||||||
if (!form.projectKey || !form.environment || !form.ref) {
|
if (!form.projectKey || !form.environment || !form.ref) {
|
||||||
return false
|
return false
|
||||||
@@ -325,6 +347,22 @@ watch(refOptions, (options) => {
|
|||||||
<strong>{{ selectedCommitMessage || 'Gitea 未返回提交说明' }}</strong>
|
<strong>{{ selectedCommitMessage || 'Gitea 未返回提交说明' }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<small v-if="selectedCommitMeta">{{ selectedCommitMeta }}</small>
|
<small v-if="selectedCommitMeta">{{ selectedCommitMeta }}</small>
|
||||||
|
<div v-if="selectedPullRequest" class="commit-secondary">
|
||||||
|
<ElTag size="small" type="success" effect="plain">
|
||||||
|
PR #{{ selectedPullRequest.number }}
|
||||||
|
</ElTag>
|
||||||
|
<ElLink
|
||||||
|
v-if="selectedPullRequest.url"
|
||||||
|
:href="selectedPullRequest.url"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
:underline="false"
|
||||||
|
>
|
||||||
|
{{ selectedPullRequest.title }}
|
||||||
|
</ElLink>
|
||||||
|
<strong v-else>{{ selectedPullRequest.title }}</strong>
|
||||||
|
<small v-if="selectedPullRequestMeta">{{ selectedPullRequestMeta }}</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="备注">
|
<ElFormItem label="备注">
|
||||||
@@ -437,8 +475,18 @@ watch(refOptions, (options) => {
|
|||||||
align-items: center;
|
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-main strong,
|
||||||
.commit-preview small {
|
.commit-preview small,
|
||||||
|
.commit-secondary strong,
|
||||||
|
.commit-secondary :deep(.el-link) {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -456,6 +504,26 @@ watch(refOptions, (options) => {
|
|||||||
font-size: 12px;
|
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) {
|
@media (max-width: 760px) {
|
||||||
.form-grid {
|
.form-grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
|||||||
Reference in New Issue
Block a user