diff --git a/dashboard/src2/objects/site.js b/dashboard/src2/objects/site.js index 0bd7e9c..bf3ca91 100644 --- a/dashboard/src2/objects/site.js +++ b/dashboard/src2/objects/site.js @@ -15,7 +15,7 @@ import router from '../router'; import { getRunningJobs } from '../utils/agentJob'; import { confirmDialog, icon, renderDialog } from '../utils/components'; import dayjs from '../utils/dayjs'; -import { bytes, date, userCurrency } from '../utils/format'; +import { bytes, date, userCurrency, getStatusLabel, getDeployTypeLabel } from '../utils/format'; import { getToastErrorMessage } from '../utils/toast'; import { getDocResource } from '../utils/resource'; import { trialDays } from '../utils/site'; @@ -917,12 +917,18 @@ export default { label: '类型', fieldname: 'deploy_type', width: 0.3, + format(value) { + return getDeployTypeLabel(value); + } }, { label: '状态', fieldname: 'status', type: 'Badge', width: 0.5, + format(value) { + return getStatusLabel(value); + } }, // { // label: '备份', diff --git a/dashboard/src2/utils/format.js b/dashboard/src2/utils/format.js index 491fcda..b5f86e7 100644 --- a/dashboard/src2/utils/format.js +++ b/dashboard/src2/utils/format.js @@ -223,3 +223,36 @@ export function formatValue(value, type) { return value; } } + +export const statusMap = { + 'Active': '激活', + 'Inactive': '未激活', + 'Suspended': '已暂停', + 'Broken': '损坏', + 'Archived': '已归档', + 'Pending': '待处理', + 'Installing': '安装中', + 'Running': '运行中', + 'Success': '成功', + 'Failure': '失败' +}; + +export const deployTypeMap = { + 'Migrate': '迁移', + 'Update': '更新', + 'Install': '安装', + 'Uninstall': '卸载', + 'Backup': '备份', + 'Restore': '恢复', + 'Upgrade': '升级', + 'Downgrade': '降级', + 'Rollback': '回滚', +}; + +export function getStatusLabel(status) { + return statusMap[status] || status; +} + +export function getDeployTypeLabel(type) { + return deployTypeMap[type] || type; +}