Files
aiops/frontend/src/pages/approval/ApprovalAppPage.tsx
T
attacker fef4997391 feat(i18n): Approval 审批模块全量国际化 — 11 文件硬编码中文改翻译键 + approval 命名空间(136 键)
迁移文件:
- pages/approval/: ApprovalWorkflowPage + ApprovalCategoryPage + 3 子页面(Resource/App/Permission)
- components/approval/: ApprovalFlow + ApprovalProcessTab + ApprovalCreateDialog + ApprovalDetailDialog + ApprovalTemplateTab + helpers

翻译键: approval 命名空间 136 键 (8 子组: category/step/status/col/editor/detail/flow/type/msg)
复用 common.* 通用键 (approve/reject/cancel/save/create/delete/edit/detail/close/loading 等)
zh-CN/en-US 完全对齐, 8 命名空间 (common/menu/header/login/dashboard/server/alert/approval)

模式: 组件内 useTranslation() + t(); 模块级常量/helpers 用 i18n.t()
labelKey 模式: STATUS_TABS/statusMap 从 label:string 改为 labelKey:string + i18n.t(config.labelKey)
2026-06-29 18:25:29 +08:00

28 lines
1.3 KiB
TypeScript

// 应用申请子页面 — 应用部署、版本发布申请
import { useTranslation } from 'react-i18next';
import { ApprovalCategoryPage, type FormField } from './ApprovalCategoryPage';
function ApprovalAppPage() {
const { t } = useTranslation();
const APP_FIELDS: FormField[] = [
{ key: 'app_name', label: 'App', type: 'text', placeholder: 'user-service', required: true },
{ key: 'git_url', label: 'Git URL', type: 'text', placeholder: 'https://github.com/org/repo.git', required: true },
{ key: 'branch', label: 'Branch', type: 'text', defaultValue: 'main', required: true },
{ key: 'language', label: 'Language', type: 'select', options: ['Java', 'Go', 'Python', 'Node.js', 'C++'], required: true },
{ key: 'http_port', label: 'HTTP Port', type: 'number', placeholder: '8080' },
{ key: 'env', label: 'Env', type: 'select', options: ['dev', 'staging', 'prod'], required: true },
{ key: 'replicas', label: 'Replicas', type: 'number', defaultValue: 2, required: true },
{ key: 'remark', label: 'Remark', type: 'textarea' },
];
return (
<ApprovalCategoryPage
category="app"
title={t('approval.appTitle')}
description={t('approval.appDesc')}
fields={APP_FIELDS}
templateCode="app_deploy"
/>
);
}
export { ApprovalAppPage };