feat: 补齐运行记录重试入口
This commit is contained in:
@@ -93,6 +93,10 @@ const canSyncJenkins = computed(() => {
|
||||
return shownRun.value?.status === 'queued' || shownRun.value?.status === 'running'
|
||||
})
|
||||
|
||||
const canCancelShownRun = computed(() => shownRun.value?.status === 'queued' || shownRun.value?.status === 'running')
|
||||
|
||||
const canRetryShownRun = computed(() => shownRun.value?.status === 'failed' || shownRun.value?.status === 'canceled')
|
||||
|
||||
async function triggerRelease() {
|
||||
submitting.value = true
|
||||
try {
|
||||
@@ -285,10 +289,10 @@ watch(refOptions, (options) => {
|
||||
>
|
||||
触发发布
|
||||
</ElButton>
|
||||
<ElButton :icon="VideoPause" :disabled="localStatus !== 'queued' || submitting" @click="cancelRelease">
|
||||
<ElButton :icon="VideoPause" :disabled="!canCancelShownRun || submitting" @click="cancelRelease">
|
||||
取消
|
||||
</ElButton>
|
||||
<ElButton :icon="CircleClose" :disabled="localStatus !== 'failed' || submitting" @click="retryRelease">
|
||||
<ElButton :icon="CircleClose" :disabled="!canRetryShownRun || submitting" @click="retryRelease">
|
||||
重试
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
+27
-1
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* 运行记录页展示历史发布单、Jenkins 同步入口和后端步骤流转图。
|
||||
*/
|
||||
import { RefreshRight } from '@element-plus/icons-vue'
|
||||
import { CircleClose, RefreshRight } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { computed, ref } from 'vue'
|
||||
import BpmnStatusViewer from '../components/BpmnStatusViewer.vue'
|
||||
@@ -23,6 +23,10 @@ const canSyncSelectedRun = computed(() => {
|
||||
return canSyncRun(selectedRun.value)
|
||||
})
|
||||
|
||||
const canRetrySelectedRun = computed(() => {
|
||||
return canRetryRun(selectedRun.value)
|
||||
})
|
||||
|
||||
const canSyncAnyRun = computed(() => platform.runs.some((run) => canSyncRun(run)))
|
||||
|
||||
function canSyncRun(run?: ReleaseRun): boolean {
|
||||
@@ -32,6 +36,10 @@ function canSyncRun(run?: ReleaseRun): boolean {
|
||||
)
|
||||
}
|
||||
|
||||
function canRetryRun(run?: ReleaseRun): boolean {
|
||||
return run?.status === 'failed' || run?.status === 'canceled'
|
||||
}
|
||||
|
||||
async function syncSelectedRun() {
|
||||
if (!selectedRun.value) {
|
||||
return
|
||||
@@ -42,6 +50,16 @@ async function syncSelectedRun() {
|
||||
ElMessage.success('已同步 Jenkins 状态')
|
||||
}
|
||||
|
||||
async function retrySelectedRun() {
|
||||
if (!selectedRun.value) {
|
||||
return
|
||||
}
|
||||
|
||||
const run = await platform.retryDeployRun(selectedRun.value)
|
||||
selectedRunId.value = run.id
|
||||
ElMessage.success('已提交重试发布单')
|
||||
}
|
||||
|
||||
async function syncAllJenkinsRuns() {
|
||||
syncingAll.value = true
|
||||
try {
|
||||
@@ -125,6 +143,14 @@ async function syncAllJenkinsRuns() {
|
||||
>
|
||||
同步 Jenkins
|
||||
</ElButton>
|
||||
<ElButton
|
||||
size="small"
|
||||
:icon="CircleClose"
|
||||
:disabled="!canRetrySelectedRun"
|
||||
@click="retrySelectedRun"
|
||||
>
|
||||
重试
|
||||
</ElButton>
|
||||
<StatusPill :state="selectedRun.status" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user