更新系统页面和更新功能
- 更新 admin-frontend 系统页面和更新 API - 更新 routes 和 services 中的更新逻辑 - 重新构建前端静态资源
This commit is contained in:
@@ -20,8 +20,7 @@ export async function requestUpdateCheck() {
|
||||
return data
|
||||
}
|
||||
|
||||
export async function requestUpdateRun() {
|
||||
const { data } = await api.post('/update/run', {})
|
||||
export async function requestUpdateRun(payload = {}) {
|
||||
const { data } = await api.post('/update/run', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ const updateStatusError = ref('')
|
||||
const updateResult = ref(null)
|
||||
const updateLog = ref('')
|
||||
const updateLogTruncated = ref(false)
|
||||
const updateBuildNoCache = ref(false)
|
||||
let updatePollTimer = null
|
||||
|
||||
const weekdaysOptions = [
|
||||
@@ -316,10 +317,11 @@ async function onCheckUpdate() {
|
||||
async function onRunUpdate() {
|
||||
const status = updateStatus.value
|
||||
const remote = status?.remote_commit ? shortCommit(status.remote_commit) : '-'
|
||||
const buildFlags = updateBuildNoCache.value ? '\n\n构建选项: 强制重建(--no-cache)' : ''
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定开始“一键更新”吗?\n\n目标版本: ${remote}\n\n更新将会重建并重启服务,页面可能短暂不可用;系统会先备份数据库。`,
|
||||
`确定开始“一键更新”吗?\n\n目标版本: ${remote}${buildFlags}\n\n更新将会重建并重启服务,页面可能短暂不可用;系统会先备份数据库。`,
|
||||
'一键更新确认',
|
||||
{ confirmButtonText: '开始更新', cancelButtonText: '取消', type: 'warning' },
|
||||
)
|
||||
@@ -329,7 +331,7 @@ async function onRunUpdate() {
|
||||
|
||||
updateActionLoading.value = true
|
||||
try {
|
||||
const res = await requestUpdateRun()
|
||||
const res = await requestUpdateRun({ build_no_cache: updateBuildNoCache.value ? 1 : 0 })
|
||||
ElMessage.success(res?.message || '已提交更新请求')
|
||||
startUpdatePolling()
|
||||
setTimeout(() => loadUpdateInfo(), 800)
|
||||
@@ -498,6 +500,11 @@ onBeforeUnmount(stopUpdatePolling)
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div class="row-actions" style="align-items: center">
|
||||
<el-checkbox v-model="updateBuildNoCache">强制重建(--no-cache)</el-checkbox>
|
||||
<div class="help" style="margin-top: 0">依赖变更或构建异常时建议开启(更新会更慢)。</div>
|
||||
</div>
|
||||
|
||||
<div class="row-actions">
|
||||
<el-button @click="loadUpdateInfo" :disabled="updateActionLoading">刷新更新信息</el-button>
|
||||
<el-button @click="onCheckUpdate" :loading="updateActionLoading">检查更新</el-button>
|
||||
|
||||
Reference in New Issue
Block a user