feat: 优化发布流程状态展示

This commit is contained in:
湛兮
2026-06-12 12:26:47 +08:00
parent 61e6c73f12
commit 0f92eb7b2b
4 changed files with 645 additions and 301 deletions
+118 -32
View File
@@ -19,7 +19,6 @@ const form = reactive({
environment: 'test' as EnvironmentName,
ref: '',
note: '发布验证',
confirmed: false,
})
const localStatus = ref<ReleaseStatus>('idle')
@@ -141,7 +140,7 @@ const canTrigger = computed(() => {
return false
}
return form.environment === 'production' ? form.confirmed : true
return true
})
const shownRun = computed(() => {
@@ -180,7 +179,7 @@ async function triggerRelease() {
productionConfirmation:
form.environment === 'production'
? {
confirmed: form.confirmed,
confirmed: true,
confirmedAt: new Date().toISOString(),
summary: '已确认 ref、回滚方案、通知对象和业务窗口',
}
@@ -293,7 +292,6 @@ function useFailedRun() {
form.environment = failed.environment
form.ref = failed.ref
form.note = `重试 ${failed.id}`
form.confirmed = failed.environment !== 'production'
localStatus.value = 'failed'
activeRun.value = failed
}
@@ -357,7 +355,7 @@ watch(refOptions, (options) => {
<div class="page-header">
<div>
<h1>发布中心</h1>
<p>选择项目、环境和 ref/tag,填写备注后触发发布;生产环境必须完成二次确认。</p>
<p>选择项目、环境和 ref/tag,填写备注后触发发布;生产环境会提交确认信息。</p>
</div>
<div class="toolbar">
<ElButton :icon="RefreshRight" @click="useFailedRun">载入最近失败</ElButton>
@@ -365,8 +363,8 @@ watch(refOptions, (options) => {
</div>
</div>
<div class="two-column">
<section class="panel">
<div class="release-layout">
<section class="panel release-params-panel">
<div class="panel-header">
<h2>发布参数</h2>
<span>通过后端创建发布单</span>
@@ -387,7 +385,7 @@ watch(refOptions, (options) => {
当前权限:{{ selectedProjectPermissionName }}
</div>
</ElFormItem>
<ElFormItem label="环境">
<ElFormItem label="环境" class="environment-field">
<ElSegmented
v-model="form.environment"
:options="environmentOptions"
@@ -433,20 +431,17 @@ watch(refOptions, (options) => {
</div>
</div>
</ElFormItem>
<ElFormItem label="备注">
<ElInput v-model="form.note" type="textarea" :rows="3" maxlength="120" show-word-limit />
<ElFormItem label="备注" class="note-field">
<ElInput v-model="form.note" type="textarea" :rows="2" maxlength="120" show-word-limit />
</ElFormItem>
</div>
<ElAlert
v-if="form.environment === 'production'"
class="danger-note"
title="生产发布需要二次确认:已确认 tag、回滚方案、通知对象和业务窗口。"
title="生产发布将提交确认信息,请确认 tag、回滚方案、通知对象和业务窗口。"
type="warning"
:closable="false"
/>
<ElCheckbox v-model="form.confirmed" class="confirm-line">
我确认本次发布参数、目标环境和通知范围无误
</ElCheckbox>
<div class="action-row">
<ElButton
type="primary"
@@ -471,7 +466,7 @@ watch(refOptions, (options) => {
</div>
</section>
<section class="panel">
<section class="panel current-run-panel">
<div class="panel-header">
<h2>当前发布单</h2>
<div class="toolbar compact-toolbar">
@@ -491,33 +486,106 @@ watch(refOptions, (options) => {
<RunExecutionDetails :run="shownRun" />
</div>
</section>
</div>
<section class="panel">
<div class="panel-header">
<h2>BPMN 流程状态</h2>
<span>step.bpmnNodeId 与 BPMN XML 节点 id 对齐后高亮</span>
</div>
<div class="panel-body">
<BpmnStatusViewer
v-if="platform.releaseProcessXml && shownRun"
:xml="platform.releaseProcessXml"
:steps="shownRun.steps"
/>
</div>
</section>
<section class="panel bpmn-status-panel">
<div class="panel-header">
<h2>BPMN 流程状态</h2>
<span>step.bpmnNodeId 与 BPMN XML 节点 id 对齐后高亮</span>
</div>
<div class="panel-body">
<BpmnStatusViewer
v-if="platform.releaseProcessXml && shownRun"
:xml="platform.releaseProcessXml"
:run="shownRun"
:steps="shownRun.steps"
/>
</div>
</section>
</div>
</div>
</template>
<style scoped>
.release-layout {
display: grid;
grid-template-columns: minmax(560px, 1fr) minmax(320px, 400px);
gap: 16px;
align-items: start;
}
.release-params-panel,
.current-run-panel,
.bpmn-status-panel {
min-width: 0;
}
.bpmn-status-panel {
grid-column: 1 / -1;
}
.current-run-panel {
display: flex;
height: 100%;
min-height: 0;
flex-direction: column;
}
.current-run-panel .panel-body {
flex: 1 1 auto;
min-height: 0;
max-height: clamp(320px, 42vh, 520px);
overflow: auto;
overscroll-behavior: contain;
}
.bpmn-status-panel .panel-body {
min-width: 0;
}
.current-run-panel :deep(.run-execution-details) {
gap: 12px;
}
.current-run-panel :deep(.detail-grid) {
grid-template-columns: 88px minmax(0, 1fr);
gap: 9px 10px;
font-size: 12px;
}
.current-run-panel :deep(.detail-grid dd) {
line-height: 1.45;
overflow-wrap: break-word;
}
.current-run-panel :deep(.failure-block) {
padding-top: 12px;
}
.release-params-panel .panel-body {
padding-bottom: 16px;
}
.form-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px 14px;
gap: 8px 16px;
align-items: start;
}
.confirm-line {
margin-top: 14px;
.note-field {
grid-column: 1 / -1;
}
.environment-field :deep(.el-segmented) {
width: 100%;
}
.environment-field :deep(.el-segmented__item) {
flex: 1 1 0;
}
.release-params-panel :deep(.el-form-item) {
margin-bottom: 14px;
}
.action-row {
@@ -602,8 +670,26 @@ watch(refOptions, (options) => {
}
@media (max-width: 760px) {
.release-layout {
grid-template-columns: 1fr;
}
.form-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 1180px) {
.release-layout {
grid-template-columns: 1fr;
}
.bpmn-status-panel {
grid-column: auto;
}
.current-run-panel .panel-body {
max-height: none;
}
}
</style>