diff --git a/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx b/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx index 5fd89c3c..9717d219 100644 --- a/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx +++ b/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx @@ -141,7 +141,7 @@ const themeToken = { setUserInfo(data.profile) dispatch({type:'UPDATE_USERDATA',userData:data.profile}) }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) } }) } @@ -157,10 +157,10 @@ const themeToken = { if(code === STATUS_CODE.SUCCESS){ dispatch({type:'LOGOUT'}) resetAccess() - // message.success(msg || RESPONSE_TIPS.logoutSuccess) + // message.success(msg || $t(RESPONSE_TIPS.logoutSuccess)) navigate('/login') }else{ - message.error(msg ||RESPONSE_TIPS.error) + message.error(msg ||$t(RESPONSE_TIPS.error)) } }) } diff --git a/frontend/packages/common/src/components/aoplatform/EditableTable.tsx b/frontend/packages/common/src/components/aoplatform/EditableTable.tsx index 72e5ed49..f5037bc2 100644 --- a/frontend/packages/common/src/components/aoplatform/EditableTable.tsx +++ b/frontend/packages/common/src/components/aoplatform/EditableTable.tsx @@ -1,11 +1,10 @@ import { EditableProTable } from "@ant-design/pro-components"; -import { Button } from "antd"; -import { useState, useEffect } from "react"; +import { useState, useEffect, useMemo } from "react"; import { v4 as uuidv4} from 'uuid'; -import WithPermission from "./WithPermission"; import { PageProColumns } from "./PageList"; -import { Icon } from "@iconify/react/dist/iconify.js"; import TableBtnWithPermission from "./TableBtnWithPermission"; +import { $t } from "@common/locales"; +import { useGlobalContext } from "@common/contexts/GlobalStateContext"; interface EditableTableProps { configFields: PageProColumns[]; @@ -26,10 +25,8 @@ const EditableTable = ({ className, extendsId, }: EditableTableProps) => { - // const [form] = Form.useForm(); - // const [isModalVisible, setIsModalVisible] = useState(false); const [configurations, setConfigurations] = useState<(T | {_id:string})[]>(value ||[{_id:'1234'}]); - // const [editingConfig, setEditingConfig] = useState(null); + const {state} = useGlobalContext() const [editableKeys, setEditableRowKeys] = useState(() => value?.map((item) => item._id) || ['1234'] @@ -43,10 +40,12 @@ const EditableTable = ({ return value } + const translatedColumns = useMemo(()=>configFields.map((x)=>({...x, title:$t(x.title as string)})),[state.language,configFields]) + return ( className={className} - columns={configFields} + columns={translatedColumns} rowKey="_id" value={configurations as T[]} size="small" diff --git a/frontend/packages/common/src/components/aoplatform/EditableTableWithModal.tsx b/frontend/packages/common/src/components/aoplatform/EditableTableWithModal.tsx index 21869652..76d4af89 100644 --- a/frontend/packages/common/src/components/aoplatform/EditableTableWithModal.tsx +++ b/frontend/packages/common/src/components/aoplatform/EditableTableWithModal.tsx @@ -1,16 +1,18 @@ -import {useEffect, useState} from 'react'; +import {useEffect, useMemo, useState} from 'react'; import { Button, Modal, Form, Table, FormInstance, TableProps, Divider } from 'antd'; import { v4 as uuidv4 } from 'uuid'; import { ColumnsType } from 'antd/es/table'; import WithPermission from './WithPermission'; import { $t } from '@common/locales'; import { COLUMNS_TITLE, VALIDATE_MESSAGE } from '@common/const/const'; +import { useGlobalContext } from '@common/contexts/GlobalStateContext'; +import TableBtnWithPermission from './TableBtnWithPermission'; export interface ConfigField { title: string; key: keyof T; component: React.ReactNode; - renderText?: (value: unknown, record: T) => React.ReactNode; + renderText?: (value: unknown, record: T) => string; required?: boolean; ellipsis?:boolean } @@ -36,6 +38,7 @@ const EditableTableWithModal = ({ const [isModalVisible, setIsModalVisible] = useState(false); const [configurations, setConfigurations] = useState(value ||[]); const [editingConfig, setEditingConfig] = useState(null); + const {state} = useGlobalContext() const showModal = (config?: T) => { if (config) { @@ -83,35 +86,37 @@ const EditableTableWithModal = ({ setConfigurations(value?.map((x)=>x._id ? x : {...x,_id:uuidv4()}) || []); }, [value]); - const columns: ColumnsType = configFields.map(({ title, key, renderText }) => ({ - title, - dataIndex: key as string, - key: key as string, - render: renderText ? (value, record) => renderText(value, record) : undefined, - ellipsis:true - })); + const columns = useMemo(()=>[ + ...configFields.map(({ title, key, renderText }) => ({ + title:$t(title), + dataIndex: key as string, + key: key as string, + render: renderText ? (value, record) => $t(renderText(value, record)) : undefined, + ellipsis:true + })), + ...(disabled ? []:[{ + title: COLUMNS_TITLE.operate, + key: 'action', + btnNums:2, + render: (_: unknown, record: T) => ( + <> +
+ {showModal(record)}} btnTitle='编辑'/> + + {handleDelete(record._id || '')}} btnTitle='删除'/> +
+ + ), + }] ) + ],[state.language, disabled, configFields]) - !disabled && columns.push({ - title: COLUMNS_TITLE.operate, - key: 'action', - btnNums:2, - render: (_: unknown, record: T) => ( - <> -
- - - -
- - ), - }); const formItems = configFields.map(({ title,key, component, required }) => { return ( {component} diff --git a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx index 15eea8a2..5e815fa6 100644 --- a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx +++ b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx @@ -1,12 +1,13 @@ -import {App, Col, Form, Input, Row, Table} from "antd"; -import {forwardRef, useEffect, useImperativeHandle} from "react"; +import {App, Col, Form, Input, Row, Table, Tooltip} from "antd"; +import {forwardRef, useEffect, useImperativeHandle, useMemo} from "react"; import {PublishApprovalInfoType, PublishApprovalModalHandle, PublishApprovalModalProps, PublishVersionTableListItem} from "@common/const/approval/type.tsx"; import {useFetch} from "@common/hooks/http.ts"; import {BasicResponse, FORM_ERROR_TIPS, PLACEHOLDER, RESPONSE_TIPS, STATUS_CODE, VALIDATE_MESSAGE} from "@common/const/const.tsx"; import WithPermission from "@common/components/aoplatform/WithPermission.tsx"; import { SYSTEM_PUBLISH_ONLINE_COLUMNS } from "@core/const/system/const.tsx"; import { $t } from "@common/locales"; -import { ApprovalApiColumns, ApprovalUpstreamColumns } from "@common/const/approval/const"; +import { ApprovalApiColumns, ApprovalStatusColorClass, ApprovalUpstreamColumns, ChangeTypeEnum } from "@common/const/approval/const"; +import { useGlobalContext } from "@common/contexts/GlobalStateContext"; export const PublishApprovalModalContent = forwardRef((props, ref) => { @@ -14,6 +15,7 @@ export const PublishApprovalModalContent = forwardRefPromise = (operate)=>{ if(type === 'view'){ @@ -22,19 +24,19 @@ export const PublishApprovalModalContent = forwardRef{ if(operate === 'refuse' && form.getFieldValue('opinion') === '' ){ form.setFields([{ - name:'opinion',errors:[FORM_ERROR_TIPS.refuseOpinion] + name:'opinion',errors:[$t(FORM_ERROR_TIPS.refuseOpinion)] }]) form.scrollToField('opinion') - return Promise.reject(RESPONSE_TIPS.refuseOpinion) + return Promise.reject($t(RESPONSE_TIPS.refuseOpinion)) } return fetchData>(`service/publish/${operate === 'pass' ? 'accept' : 'refuse'}`,{method: 'PUT',eoBody:({comments:value.opinion}), eoParams:{id:data!.id, project:serviceId},eoTransformKeys:['versionRemark']}).then(response=>{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) return Promise.resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - return Promise.reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + return Promise.reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> Promise.reject(errorInfo)) }).catch((err)=> {form.scrollToField(err.errorFields[0].name[0]); return Promise.reject(err)}) @@ -48,11 +50,11 @@ export const PublishApprovalModalContent = forwardRef{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(response) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> reject(errorInfo)) }).catch((errorInfo)=> reject(errorInfo)) @@ -65,11 +67,11 @@ export const PublishApprovalModalContent = forwardRef>('service/publish/execute',{method: 'PUT', eoParams:{project:serviceId,id:(data as PublishVersionTableListItem).flowId},eoTransformKeys:['versionRemark']}).then(response=>{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> reject(errorInfo)) }).catch((errorInfo)=> reject(errorInfo)) @@ -87,6 +89,39 @@ export const PublishApprovalModalContent = forwardRefApprovalUpstreamColumns.map((x)=>({ + ...x, + ...(x.dataIndex === 'type' ? {valueEnum:{ + 'static':{ + text:$t('静态上游') + } + }}:{}), + ...(x.dataIndex === 'change' ? { + render:(_,entity)=>( + + {$t(ChangeTypeEnum[entity.change as (keyof typeof ChangeTypeEnum)] || '-')} + {entity.change === 'error' ?$t('该 API 缺失(0)(1)(2)请先补充',[entity.proxyStatus == 1 && $t('转发信息,'),entity.docStatus == 1 && $t('文档信息,'),entity.upstreamStatus == 1 && $t('上游信息,')]):''} + ) + }:{}), + title: typeof x.title === 'string' ? $t(x.title) : x.title, + })),[state.language]) + + + const translatedApiColumns = useMemo(()=>ApprovalApiColumns.map((x)=>({ + ...x, + ...(x.dataIndex === 'change' ? { + render:(_,entity)=>( + + + {$t(ChangeTypeEnum[entity.change as (keyof typeof ChangeTypeEnum)] || '-')} + {entity.change === 'error' ?$t('该 API 缺失(0)(1)(2)请先补充',[entity.proxyStatus == 1 && $t('转发信息,'),entity.docStatus == 1 && $t('文档信息,'),entity.upstreamStatus == 1 && $t('上游信息,')]):''} + + ) + }:{} + ), + title: typeof x.title === 'string' ? $t(x.title) : x.title, +})),[state.language]) + return ( <> {!insideSystem && <> @@ -129,23 +164,23 @@ export const PublishApprovalModalContent = forwardRef - + - + } {$t('API 列表')}:
- + {/* {type !== 'add' && type !== 'publish' && - { form.setFields([ + { form.setFields([ { name: 'opinion', errors: [], // 设置为空数组来移除错误信息 diff --git a/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx b/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx index fc79139e..df982c22 100644 --- a/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx +++ b/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx @@ -39,20 +39,20 @@ export const SubscribeApprovalModalContent = forwardRef{ if(operate === 'refuse' && form.getFieldValue('opinion') === ''){ form.setFields([{ - name:'opinion',errors:[FORM_ERROR_TIPS.refuseOpinion] + name:'opinion',errors:[$t(FORM_ERROR_TIPS.refuseOpinion)] }]) form.scrollToField('opinion') - reject(RESPONSE_TIPS.refuseOpinion) + reject($t(RESPONSE_TIPS.refuseOpinion)) return } fetchData>(`${inSystem?'service/':''}approval/subscribe`,{method: 'POST',eoBody:({opinion:value.opinion,operate}), eoParams:(inSystem ? {apply:data!.id, team:teamId} : {id:data!.id,team:teamId})}).then(response=>{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> reject(errorInfo)) }).catch((errorInfo)=> reject(errorInfo)) @@ -99,9 +99,9 @@ export const SubscribeApprovalModalContent = forwardRef label={$t("审核意见")} name="opinion" - extra={FORM_ERROR_TIPS.refuseOpinion} + extra={$t(FORM_ERROR_TIPS.refuseOpinion)} > - { form.setFields([ + { form.setFields([ { name: 'opinion', errors: [], // 设置为空数组来移除错误信息 diff --git a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx index 4452ceab..789901c2 100644 --- a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx +++ b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx @@ -167,7 +167,7 @@ export const IntelligentPluginConfig = forwardRef>(type === 'add'?`dynamic/${moduleId}`:`dynamic/${moduleId}/config`,{method:type === 'add'? 'POST' : 'PUT',eoBody:form.values, eoParams:{...(type !== 'add' && {id:initFormValue.id})}}).then(response=>{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> reject(errorInfo)) }).catch((errorInfo:unknown)=> reject(errorInfo)) @@ -260,8 +260,8 @@ export const IntelligentPluginConfig = forwardRef{return{label:x.title, value:x.name}}) || []) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }) }) diff --git a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx index 8381052b..f4a2a4be 100644 --- a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx +++ b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx @@ -183,7 +183,7 @@ export default function IntelligentPluginList(){ setRenderSchema(resp.data.render) return Promise.resolve(resp.data.render) } - return Promise.reject(resp.msg || RESPONSE_TIPS.error) + return Promise.reject(resp.msg || $t(RESPONSE_TIPS.error)) }) } @@ -218,11 +218,11 @@ export default function IntelligentPluginList(){ fetchData>(`dynamic/${moduleId}/batch`,{method:'DELETE',eoParams:{ids:JSON.stringify([entity!.id])}}).then(response=>{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }) }) @@ -244,7 +244,7 @@ export default function IntelligentPluginList(){ } setCurDetail(data.info) }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) } }).finally(()=>setDrawerLoading(false)) break; @@ -259,25 +259,25 @@ export default function IntelligentPluginList(){ let content:string|React.ReactNode = '' switch (type){ case 'publish':{ - message.loading(RESPONSE_TIPS.operating) + message.loading($t(RESPONSE_TIPS.operating)) await fetchData>(`dynamic/${moduleId}/${entity!.status === $t('已发布') ? 'offline':'online'}`, { method: 'PUT', eoParams:{id:entity!.id}, }).then(response => { const {code, msg} = response if (code === STATUS_CODE.SUCCESS) { - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) return Promise.resolve(true) } else { - message.error(msg || RESPONSE_TIPS.error) - return Promise.reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + return Promise.reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> Promise.reject(errorInfo)) message.destroy() return;} case 'delete': title='删除' - content={DELETE_TIPS.default} + content={$t(DELETE_TIPS.default)} break; } diff --git a/frontend/packages/common/src/components/apispace/code-snippet/index.tsx b/frontend/packages/common/src/components/apispace/code-snippet/index.tsx index 7f8fadce..5fca8e4b 100644 --- a/frontend/packages/common/src/components/apispace/code-snippet/index.tsx +++ b/frontend/packages/common/src/components/apispace/code-snippet/index.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import { useEffect, useMemo } from 'react'; import { Cascader } from 'antd'; import CODE_LANG from '@common/const/code/const'; import type { DefaultOptionType } from 'antd/es/cascader'; @@ -13,6 +13,7 @@ import {Codebox} from "@common/components/postcat//api/Codebox"; import {Collapse} from "@common/components/postcat/api/Collapse"; import {Box} from "@mui/material"; import { $t } from '@common/locales'; +import { useGlobalContext } from '@common/contexts/GlobalStateContext'; type CodeSnippetCompoType = { title:string @@ -36,6 +37,7 @@ type CodeSnippetCompoType = { let isMultipart: boolean = false export default function CodeSnippetCompo({title,api, extraTitle, extraContent, minLines=15}: CodeSnippetCompoType) { + const {state } = useGlobalContext() // const [tokenState ] = useTokenBasicInfo() const pretreatmentRequestInfo = (apiDoc: ApiDetail) =>{ isMultipart = false @@ -190,13 +192,14 @@ type CodeSnippetCompoType = { const [placeholderTxt, setPlaceholderTxt] = useState($t('搜索编程语言...')) const [selectItemTxt, setSelectItemTxt ] = useState('') + const codeLangOptions = useMemo(()=>CODE_LANG.map(x=>({...x, label:$t(x.label as string)})),[state.language]) return ( <> {$t('编程语言')}: onChange(value as unknown as number[],record)} placeholder={placeholderTxt} value={lang} // 当前的值 diff --git a/frontend/packages/common/src/components/postcat/ApiEdit.tsx b/frontend/packages/common/src/components/postcat/ApiEdit.tsx index b83d8d82..1fe375eb 100644 --- a/frontend/packages/common/src/components/postcat/ApiEdit.tsx +++ b/frontend/packages/common/src/components/postcat/ApiEdit.tsx @@ -202,7 +202,7 @@ export default function ApiEdit({apiInfo,editorRef,loaded,serviceId, teamId}:{ap getData:()=>description })) return ( - setDescription(e.target.value)} placeholder={PLACEHOLDER.input}/> + setDescription(e.target.value)} placeholder={$t(PLACEHOLDER.input)}/> ) }) diff --git a/frontend/packages/common/src/components/postcat/api/Codebox/index.tsx b/frontend/packages/common/src/components/postcat/api/Codebox/index.tsx index 205585a1..0a60fb6c 100644 --- a/frontend/packages/common/src/components/postcat/api/Codebox/index.tsx +++ b/frontend/packages/common/src/components/postcat/api/Codebox/index.tsx @@ -128,7 +128,7 @@ export const Codebox = memo((props: CodeboxProps) => { const copyCode = async (): Promise => { if (editorRef.current) { await navigator.clipboard.writeText(editorRef.current.getValue()) - message.success(RESPONSE_TIPS.copySuccess) + message.success($t(RESPONSE_TIPS.copySuccess)) } } diff --git a/frontend/packages/common/src/const/approval/const.tsx b/frontend/packages/common/src/const/approval/const.tsx index 0f8eea2f..83f76bbc 100644 --- a/frontend/packages/common/src/const/approval/const.tsx +++ b/frontend/packages/common/src/const/approval/const.tsx @@ -1,14 +1,11 @@ import { ApprovalTableListItem, PublishTableListItem } from "./type"; -import { Tooltip } from "antd"; -import { $t } from "@common/locales"; import { PageProColumns } from "@common/components/aoplatform/PageList"; - export const TODO_LIST_COLUMN_NOT_INCLUDE_KEY:string[] = ['status','approver','approvalTime'] export const SUBSCRIBE_APPROVAL_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('申请时间'), + title:('申请时间'), dataIndex: 'applyTime', ellipsis:true, width:182, @@ -18,44 +15,44 @@ export const SUBSCRIBE_APPROVAL_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('申请时间'), + title:('申请时间'), dataIndex: 'applyTime', // sorter: true, ellipsis:true, @@ -79,13 +76,13 @@ export const SUBSCRIBE_APPROVAL_INNER_TODO_TABLE_COLUMN : PageProColumns{$t('申请人')}, + // title:('申请人', + title: ('申请人'), dataIndex: ['applier','name'], ellipsis: true, filters: true, @@ -94,7 +91,7 @@ export const SUBSCRIBE_APPROVAL_INNER_TODO_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('申请时间'), + title:('申请时间'), dataIndex: 'applyTime', // sorter: true, ellipsis:true, @@ -114,13 +111,13 @@ export const SUBSCRIBE_APPROVAL_INNER_DONE_TABLE_COLUMN : PageProColumns{$t('申请人')}, + // title:('申请人', + title: ('申请人'), dataIndex: ['applier','name'], ellipsis: true, filters: true, @@ -129,24 +126,20 @@ export const SUBSCRIBE_APPROVAL_INNER_DONE_TABLE_COLUMN : PageProColumns{$t('拒绝')}], - [2,{$t('通过')}], - ]), }, { - title:$t('审批人'), + title:('审批人'), dataIndex: ['approver','name'], ellipsis: true, width:88, @@ -156,7 +149,7 @@ export const SUBSCRIBE_APPROVAL_INNER_DONE_TABLE_COLUMN : PageProColumns( - - - {ChangeTypeEnum[entity.change as (keyof typeof ChangeTypeEnum)] || '-'} - {entity.change === 'error' ?$t('该 API 缺失(0)(1)(2)请先补充',[entity.proxyStatus == 1 && $t('转发信息,'),entity.docStatus == 1 && $t('文档信息,'),entity.upstreamStatus == 1 && $t('上游信息,')]):''} - - ) } ] export const ApprovalUpstreamColumns = [ { - title:$t('上游类型'), + title:('上游类型'), dataIndex:'type', ellipsis:true, - valueEnum:{ - 'static':{ - text:$t('静态上游') - } - } }, { - title:$t('地址'), + title:('地址'), dataIndex:'addr', render:(text:string[])=>(<>{text.join(',')}), ellipsis:true }, { - title:$t('类型'), - dataIndex:'change', - render:(_,entity)=>( - - {ChangeTypeEnum[entity.change as (keyof typeof ChangeTypeEnum)] || '-'} - {entity.change === 'error' ?$t('该 API 缺失(0)(1)(2)请先补充',[entity.proxyStatus == 1 && $t('转发信息,'),entity.docStatus == 1 && $t('文档信息,'),entity.upstreamStatus == 1 && $t('上游信息,')]):''} - ) + title:('类型'), + dataIndex:'change' } ] -const PublishStatusEnum = { - 'apply': $t('待审批'), - 'accept' : $t('审批通过'), - 'done' : $t('已发布'), - 'stop': $t('发布终止'), - 'close': $t('已关闭'), - 'refuse' : $t('已拒绝'), - 'error' : $t('发布异常'), - 'publishing' : $t('发布中') +export const PublishStatusEnum = { + 'apply': ('待审批'), + 'accept' : ('审批通过'), + 'done' : ('已发布'), + 'stop': ('发布终止'), + 'close': ('已关闭'), + 'refuse' : ('已拒绝'), + 'error' : ('发布异常'), + 'publishing' : ('发布中') } export const PUBLISH_APPROVAL_VERSION_INNER_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('发布版本'), + title:('发布版本'), dataIndex: 'version', ellipsis:true, width:160, fixed:'left' }, { - title:$t('版本说明'), + title:('版本说明'), dataIndex: 'remark', ellipsis:true }, { - title:$t('创建版本时间'), + title:('创建版本时间'), dataIndex: 'createTime', ellipsis:true, sorter: (a,b)=> { @@ -310,24 +286,15 @@ export const PUBLISH_APPROVAL_VERSION_INNER_TABLE_COLUMN : PageProColumns{PublishApplyStatusEnum.accept || '-'}], - ['apply',{PublishApplyStatusEnum.apply || '-'}], - ['running',{PublishApplyStatusEnum.running || '-'}], - ['none',{PublishApplyStatusEnum.none || '-'}], - ['refuse',{PublishApplyStatusEnum.refuse || '-'}], - ['publishing',{PublishApplyStatusEnum.publishing || '-'}], - ['error',{PublishApplyStatusEnum.error || '-'}], - ]) + valueType: 'select' }, { - title:$t('创建人'), + title:('创建人'), dataIndex: ['creator','name'], ellipsis: true, width:88, @@ -340,50 +307,40 @@ export const PUBLISH_APPROVAL_VERSION_INNER_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('申请时间'), + title:('申请时间'), dataIndex: 'applyTime', ellipsis:true, width:182, fixed:'left', }, { - title:$t('审核时间'), + title:('审核时间'), dataIndex: 'approveTime', ellipsis:true, width:182, }, { - title:$t('版本号'), + title:('版本号'), dataIndex: 'version', ellipsis:true }, { - title:$t('版本说明'), + title:('版本说明'), dataIndex: 'remark', ellipsis:true }, { - title:$t('发布状态'), + title:('发布状态'), dataIndex: 'status', - ellipsis:true, - valueEnum:new Map([ - ['apply',{PublishStatusEnum.apply || '-'}], - ['accept',{PublishStatusEnum.accept || '-'}], - ['done',{PublishStatusEnum.done || '-'}], - ['stop',{PublishStatusEnum.stop || '-'}], - ['close',{PublishStatusEnum.close || '-'}], - ['refuse',{PublishStatusEnum.refuse || '-'}], - ['publishing',{PublishStatusEnum.publishing || '-'}], - ['error',{PublishStatusEnum.error || '-'}], - ]) + ellipsis:true }, { - title:$t('备注'), + title:('备注'), dataIndex: 'comments', ellipsis:true }, { - title:$t('申请人'), + title:('申请人'), dataIndex: ['applicant','name'], ellipsis: true, width:88, @@ -393,7 +350,7 @@ export const PUBLISH_APPROVAL_RECORD_INNER_TABLE_COLUMN : PageProColumns[] = [ { - title:$t('申请时间'), + title:('申请时间'), dataIndex: 'applyTime', ellipsis:true, width:182, @@ -416,17 +373,17 @@ export const PUBLISH_APPROVAL_TABLE_COLUMN : PageProColumns = { code:number @@ -36,36 +35,36 @@ export const routerKeyMap = new Map([ } export const VALIDATE_MESSAGE = { - required: $t('必填项'), - email:$t('不是有效邮箱地址') + required: ('必填项'), + email:('不是有效邮箱地址') } export const PLACEHOLDER = { - input:$t('请输入'), - select:$t('请选择'), - startWithAlphabet:$t('英文数字下划线任意一种,首字母必须为英文'), - specialStartWithAlphabet:$t('支持字母开头、英文数字中横线下划线组合') + input:('请输入'), + select:('请选择'), + startWithAlphabet:('英文数字下划线任意一种,首字母必须为英文'), + specialStartWithAlphabet:('支持字母开头、英文数字中横线下划线组合') } export const FORM_ERROR_TIPS = { - refuseOpinion: $t('选择拒绝时,审批意见为必填'), - clusterTest:$t('无法连接集群,请检查集群地址是否正确或防火墙配置'), + refuseOpinion: ('选择拒绝时,审批意见为必填'), + clusterTest:('无法连接集群,请检查集群地址是否正确或防火墙配置'), } export const RESPONSE_TIPS = { - success: $t('操作成功'), - error: $t('操作失败'), - operating:$t('正在操作'), - loading:$t('正在加载数据'), - dataError:$t('获取数据失败'), - loginSuccess: $t('登录成功'), - logoutSuccess:$t('退出成功,将跳转至登录页'), - refuseOpinion: $t('未填写审核意见'), - copySuccess:$t('复制成功'), - copyError:$t('复制失败,请手动复制') + success: ('操作成功'), + error: ('操作失败'), + operating:('正在操作'), + loading:('正在加载数据'), + dataError:('获取数据失败'), + loginSuccess: ('登录成功'), + logoutSuccess:('退出成功,将跳转至登录页'), + refuseOpinion: ('未填写审核意见'), + copySuccess:('复制成功'), + copyError:('复制失败,请手动复制') } export const DELETE_TIPS = { - default:$t('该数据删除后将无法找回,请确认是否删除?') + default:('该数据删除后将无法找回,请确认是否删除?') } \ No newline at end of file diff --git a/frontend/packages/common/src/contexts/GlobalStateContext.tsx b/frontend/packages/common/src/contexts/GlobalStateContext.tsx index c5df0d83..5648d241 100644 --- a/frontend/packages/common/src/contexts/GlobalStateContext.tsx +++ b/frontend/packages/common/src/contexts/GlobalStateContext.tsx @@ -128,8 +128,8 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => { resolve(data.response) getGlobalAccessPromise = null }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(data.msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(data.msg || $t(RESPONSE_TIPS.error)) } }) ) @@ -143,7 +143,7 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => { setAccessData(prevData => new Map(prevData).set('team', data.access)) setTeamDataFlushed(true) }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) } }) } diff --git a/frontend/packages/common/src/hooks/copy.ts b/frontend/packages/common/src/hooks/copy.ts index e39352d8..351e5495 100644 --- a/frontend/packages/common/src/hooks/copy.ts +++ b/frontend/packages/common/src/hooks/copy.ts @@ -9,7 +9,7 @@ const useCopyToClipboard = () => { const copyToClipboard = (text: string) => { if (navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(text)?.then(() => { - message.success(RESPONSE_TIPS.copySuccess) + message.success($t(RESPONSE_TIPS.copySuccess)) setIsCopied(true) }) .catch((error) => { @@ -29,7 +29,7 @@ const useCopyToClipboard = () => { textArea.select(); new Promise((resolve, reject) => { if(document.execCommand('copy')) { - message.success(RESPONSE_TIPS.copySuccess) + message.success($t(RESPONSE_TIPS.copySuccess)) setIsCopied(true) resolve() } else { diff --git a/frontend/packages/common/src/locales/scan/newJson/en-GB.json b/frontend/packages/common/src/locales/scan/newJson/en-GB.json index e7efcc3f..64e12f66 100644 --- a/frontend/packages/common/src/locales/scan/newJson/en-GB.json +++ b/frontend/packages/common/src/locales/scan/newJson/en-GB.json @@ -12,5 +12,7 @@ "K27924db": "应用管理员", "K8dc5c723": "驱动名称", "K9919285b": "服务类型", + "Kf14d159b": "次", + "K753e8aeb": "次/秒", "K396e56ab": "报文量" } diff --git a/frontend/packages/common/src/locales/scan/newJson/zh-CN.json b/frontend/packages/common/src/locales/scan/newJson/zh-CN.json index e7efcc3f..64e12f66 100644 --- a/frontend/packages/common/src/locales/scan/newJson/zh-CN.json +++ b/frontend/packages/common/src/locales/scan/newJson/zh-CN.json @@ -12,5 +12,7 @@ "K27924db": "应用管理员", "K8dc5c723": "驱动名称", "K9919285b": "服务类型", + "Kf14d159b": "次", + "K753e8aeb": "次/秒", "K396e56ab": "报文量" } diff --git a/frontend/packages/common/src/locales/scan/zh-CN.json b/frontend/packages/common/src/locales/scan/zh-CN.json index 9e26dfee..dc722f82 100644 --- a/frontend/packages/common/src/locales/scan/zh-CN.json +++ b/frontend/packages/common/src/locales/scan/zh-CN.json @@ -1 +1,602 @@ -{} \ No newline at end of file +{ + "Kc0e5ef9f": "工作空间", + "K3863c722": "我的", + "K4de11e23": "首页", + "Kfe93ef35": "应用", + "Kb58e0c3f": "服务", + "Kc9e489f5": "团队", + "K61c89f5f": "API 市场", + "K16d71239": "仪表盘", + "K714c192d": "运行视图", + "Kd57dfe97": "系统拓扑图", + "K3fe97dcc": "系统设置", + "K67ef3525": "组织", + "K74aef1ad": "成员", + "Kf644225f": "角色", + "K958da71f": "服务分类管理", + "Kf270ca55": "运维与集成", + "Ke93d36ed": "集群", + "K9708a557": "监控报表", + "K481e8a05": "证书", + "Kca53edd0": "日志", + "Kb283e720": "资源", + "K631d646f": "Open API", + "K6535ff9c": "账号设置", + "Kf15499b4": "退出登录", + "Kabbd6e6": "文档", + "K1196b104": "APIPark - 企业API数据开放平台", + "K1f42de3": "HTTP 状态码", + "K4770dff4": "系统状态码", + "Kf89e58f1": "描述", + "K9e53c664": "提交", + "Kf8e7294c": "上一步", + "Ka0451c97": "取消", + "Kb1dedda3": "关闭", + "Kb2fc7600": "添加配置", + "K4e07217d": "编辑配置", + "K4ea968fe": "编辑(0)", + "Ka7aaaeb": "添加(0)", + "Kaff78ecf": "请输入Key", + "K65d46535": "请输入Value", + "Kc14b2ea3": "返回", + "K11d3633a": "ID", + "Kbff43de3": "名称", + "K16ca79ef": "Driver", + "K7a369eef": "已发布", + "Kcfa1a4d2": "下线", + "K771dc3b7": "上线", + "K530f5951": "查看", + "Kecbd7449": "删除", + "K1cbe2507": "确认", + "K48325b6": "搜索(0)名称", + "Ka1d885c1": "添加", + "Kad207008": "编辑", + "Ke4b7722": "简体中文", + "Kd185073d": "English", + "K1ff96ff": "申请系统", + "K9bf855d6": "所属团队", + "K11b994ed": "申请人", + "K939baba7": "申请时间", + "Kdab2e63b": "版本号", + "K8b29c460": "版本说明", + "K36a72ad1": "API 列表", + "K54e44357": "上游列表", + "Kb8e8e6f5": "备注", + "K1ab0ae5b": "申请原因", + "K53c00c3c": "审核意见", + "K7edf331d": "时间", + "Kef45b208": "1小时", + "K9dbf22b8": "24小时", + "K820fbfab": "3天", + "Kd6d28fc": "7天", + "K3d7465f7": "文件日志", + "Kc87167a0": "HTTP日志", + "K80ef19d3": "Kafka文件日志", + "K398cc3c5": "NSQ文件日志", + "K2bcdb54": "Syslog文件日志", + "K23fda291": "暂无操作权限,请联系管理员分配。", + "K4618cb0a": "微信小程序", + "Ka854f511": "获取文件,需填路径", + "Kaa11a695": "暂不支持生成非 HTTPS 或非 HTTP 协议的代码示例", + "Kbe46924e": "搜索编程语言...", + "Ke8e4f258": "编程语言", + "K29c07a47": "成功示例", + "K1f5c814d": "失败示例", + "K4ef022d7": "默认 text/html;charset=UTF-8", + "Kd061b5bf": "暂未填写示例", + "Kc14cec33": "Binary", + "K48b4d9e3": "请求头部", + "Kcd347eaf": "请求体", + "K9e100bfe": "Query 参数", + "K3e9f12fd": "REST 参数", + "K2bfa290c": "API Request Editor", + "Kb36d111a": "返回头部", + "K980bde79": "返回值", + "Kb04d201a": "更多设置", + "Kee74f5b4": "添加子参数", + "Kc7d3106c": "向下添加行", + "Keaabd222": "标签", + "K8ad2c50e": "参数名", + "K67d68dd1": "类型", + "K29245f47": "必需", + "Ke32cbcd3": "示例", + "Kc13936c6": "输入 URL 或 cURL", + "Ka1ede006": "HTTP", + "K152ac44e": "参数位置", + "K1660ae72": "匹配类型", + "K91ced765": "参数值", + "K5b265628": "操作类型", + "K1826982d": "新增或修改", + "Kd65b55f5": "匹配参数值", + "K15f35bf2": "转发上游路径", + "K79dec0dd": "请求超时时间", + "K7d465645": "绑定上游服务", + "K63a6404d": "重试时间", + "K47740727": "转发上游请求头", + "K2b605d42": "More", + "K1df9fbd5": "导入", + "K5e85df18": "导入格式", + "K9eaf7885": "全量替换", + "Kf8c3a80b": "在末端插入", + "Kd96b2d7d": "增量更新", + "Kf2fc08eb": "请求头", + "Ka45f1d8": "Rest 参数", + "K94bb113a": "大小", + "K359919b5": "另存为文件", + "K38bf1b90": "响应", + "K59f4186e": "响应头", + "K5f1e23fd": "正文", + "Kf404ef7d": "发送(Enter)", + "K2dbfd648": "中止", + "Kacabc771": "秒", + "K13ae6a93": "复制", + "Ke54a14a3": "格式化", + "K43934f6d": "搜索", + "K741decac": "替代", + "Kd507abff": "确定", + "Kca2d1624": "The (0) must not be negative.", + "K792b255a": "The (0) must be greater than or equal to the (1).", + "Kf0bed26d": "值枚举", + "K633a03ca": "枚举", + "Kd2766caf": "最小长度", + "Kd6d52485": "最大长度", + "Kea15f66c": "最小值", + "K1af340ff": "最大值", + "K68691e16": "将文件拖拽至此处上传,或点击选择文件上传", + "Kcec46ae": "上传文件", + "K760fb044": "已选择文件", + "Kea2bdee0": "请填写接口名称", + "K49053438": "详细说明", + "K148f6fa4": "高级匹配", + "K3ae4c789": "转发配置", + "K2f4d0a37": "请求参数", + "Kde2d6dbd": "返回示例", + "K70e6069c": "测试 API", + "Ke4603448": "请求 Header", + "K89fd86b3": "请求 Body", + "K8747e3c4": "请求示例代码", + "K8613e6e7": "响应示例", + "Kab1c2159": "响应 Header", + "Kd2be51d1": "响应 Body", + "K831aa6c0": "申请方-应用", + "K58ca9485": "申请服务", + "K283f55b4": "服务所属系统", + "Kd60d204": "服务所属团队", + "K3a9a3b75": "审批状态", + "K4f57b2de": "审批人", + "K31dabc6b": "审批时间", + "K8582af3f": "拒绝", + "K54e27f57": "通过", + "K7eeca185": "审批完成", + "Kd4061161": "发布审批中", + "K823bfe63": "在线", + "K97ddb3f8": "-", + "Kc9315fa1": "已拒绝", + "K3fbe7511": "发布异常", + "Ke64e695c": "发布中", + "K17f93984": "API 名称", + "K1365fe45": "请求方式", + "Kc380335f": "路径", + "K4ee62e8": "该 API 缺失(0)(1)(2)请先补充", + "K385591f3": "转发信息,", + "K68415c14": "文档信息,", + "K133b75e9": "上游信息,", + "Kad98e030": "上游类型", + "Kdeed8399": "静态上游", + "K78b1ca25": "地址", + "K6208054": "待审批", + "K1be7f021": "审批通过", + "K677a4959": "发布终止", + "Kfd6d2d3d": "已关闭", + "K9d7e880a": "发布版本", + "K855135f": "创建版本时间", + "Kcbf39b82": "版本状态", + "K339d15b5": "创建人", + "K7194cea2": "审核时间", + "K69827c60": "发布状态", + "K1644b775": "新增", + "K4fdf4dcc": "变更", + "K33d66e26": "无变更", + "K9b70c007": "缺失字段", + "Kd85208a3": "驳回", + "K8adf7f8b": "审核中", + "Kad6aa439": "已订阅", + "K3118fdb0": "取消订阅", + "K9a68443b": "取消申请", + "K18307d56": "手动添加", + "K705fe9f5": "订阅申请", + "Kbc96ebec": "申请方应用", + "K1f89176d": "申请方所属团队", + "Kfe731dfc": "操作", + "K71661ee8": "必填项", + "Kcbee3f8": "不是有效邮箱地址", + "K442cfba1": "请输入", + "K3bb646e4": "请选择", + "Ka4ecfa40": "英文数字下划线任意一种,首字母必须为英文", + "K39686a7f": "支持字母开头、英文数字中横线下划线组合", + "K4d6a0190": "选择拒绝时,审批意见为必填", + "K37318b68": "无法连接集群,请检查集群地址是否正确或防火墙配置", + "K7f0c746d": "操作成功", + "K6a365d01": "操作失败", + "K978062b6": "正在操作", + "Kca7bd6d4": "正在加载数据", + "K3c93b77e": "获取数据失败", + "Ke108c369": "登录成功", + "K9168d3e": "退出成功,将跳转至登录页", + "K2f8a7ab7": "未填写审核意见", + "Kb858d78a": "复制成功", + "K26e85d15": "复制失败,请手动复制", + "K5cfdd950": "该数据删除后将无法找回,请确认是否删除?", + "K2a3f24ac": "默认工作表", + "K7e1ab4b0": "至", + "Kf1b166e7": "详情", + "K28555332": "暂不支持带有双斜杠//的url", + "Keb9fcdad": "用户名", + "Kc654b275": "邮箱", + "Kbe2ecc69": "部门", + "K759fb403": "状态", + "K52c8a730": "启用", + "K718c9310": "禁用", + "K2c5882be": "绑定域名", + "K1cc07937": "过期日期", + "K8b7c2592": "更新者", + "Keefda53d": "更新时间", + "K9f3db3ca": "集群名称", + "Ke7487049": "集群 ID", + "Kb660ffe8": "节点名称", + "Kf12b3034": "管理地址", + "K867e6faf": "服务地址", + "K37348a5e": "集群同步地址", + "K151d2bb7": "环境名称", + "Kfa744afd": "集群数量", + "K23a3bd72": "异常", + "Ke039b9b5": "正常", + "K5c123bad": "角色名称", + "K76036e25": "HTTP 请求头", + "K8d4cbf50": "Cookie", + "K44607e3f": "全等匹配", + "Kc287500a": "前缀匹配", + "Kfc0b1147": "后缀匹配", + "Ka4a92043": "子串匹配", + "K30b2e44f": "非等匹配", + "Kb1587991": "空值匹配", + "K1e97dbd8": "存在匹配", + "Kc8ee3e62": "不存在匹配", + "K87c5a801": "区分大小写的正则匹配", + "K95f062f1": "不区分大小写的正则匹配", + "Kfbd230a5": "任意匹配", + "K413b9869": "服务名称", + "K1e84ad04": "服务 ID", + "K72b0c0b3": "API 数量", + "Kf7200cd9": "负责人", + "Kefaf9956": "创建时间", + "K98db2cb9": "申请状态", + "Ke792d01c": "所属服务", + "K61b62ace": "来源", + "Ke63767cf": "添加时间", + "K3a67ea90": "订阅方", + "K442937c4": "订阅时间", + "K34111022": "协议/方法", + "K62d10724": "URL", + "Ka9481f95": "创建者", + "Kf88d56fd": "上游 ID", + "K11a92fb2": "更新人", + "K2c2bc64f": "动态服务发现", + "Kc9a2a716": "HTTPS", + "Ka7f8266f": "带权轮询", + "Kd17edabd": "IP Hash", + "Kaeba0229": "透传客户端请求 Host", + "K6d7e2fd0": "使用上游服务 Host", + "K31332633": "重写 Host", + "Ke65db976": "权重", + "Kf966b12d": "内部服务:可通过网关访问,但不展示在服务广场", + "Kfc939e49": "公开服务:可通过网关访问,展示在服务广场,可被其他应用订阅", + "Ke96ccf45": " ", + "K5582ac8": "请求路径", + "K92485dd1": "所有 API", + "Ke64e43a": "隐藏鉴权信息", + "K1a78e6f0": "过期时间", + "K40bbb0a3": "服务ID", + "K9919285b": "服务类型", + "K63938137": "公开服务", + "Kfb20a12": "内部服务", + "Kedd64e4d": "停用", + "Ka29b346f": "地址(IP 端口或域名)", + "K63b1e0dc": "权重(0-999)", + "K74ab00a3": "已审批", + "Kea996156": "发布申请记录", + "Kbea7d266": "所属系统", + "Ka36c13cc": "调用系统名称", + "Kd78d73a7": "调用服务名称", + "K73c144eb": "当前系统名称", + "K285bd65e": "被调用服务名称", + "K5cbab635": "被调用系统名称", + "K93c2696e": "上线结果", + "K43fcaf94": "成功", + "Kc71c6a9": "上线失败", + "K56c686f8": "失败", + "K3ba29a85": "API", + "Kda8d5ea1": "上游", + "Kdefa9caa": "使用说明", + "K36856e71": "发布", + "K6382bbfd": "订阅管理", + "K2eef4e4": "订阅审批", + "Ka97bd9e5": "订阅方管理", + "K5974bf24": "管理", + "K3fa5c4c3": "调用拓扑图", + "Kb5c7b82d": "设置", + "K2472615e": "服务数量", + "Kc02aa5f1": "API数量", + "Ke08ff808": "添加日期", + "Kd7d84192": "姓名", + "Kc88e03b6": "团队角色", + "Kdf35c48c": "所有成员", + "K3818f03d": "审批", + "K56b4254f": "发布申请", + "Kd518ba3e": "Hello!欢迎使用 APIPark", + "Ke66e4182": "你能通过 APIPark 快速在企业内部构建 API 开放门户/市场,享受极致的转发性能、API 可观测、服务治理、多租户管理、订阅审批流程等诸多好处。", + "Kedd41c18": "如果你喜欢我们的产品,欢迎给我们 Star 或提供产品反馈意见。", + "Kef02fd87": "快速入门", + "K43a3b38d": "我们提供了一些任务来帮你快速了解 APIPark", + "Kc8239422": "团队中包含了人员、应用和服务,不同团队之间的应用和服务数据是隔离的,可用于管理企业内部不同的部门/项目组/团队。", + "Kd5be0cd7": "服务内包含一组 API,并且可以发布到 API 市场被其他团队使用。", + "K4ea67613": "应用是申请服务和调用 API 的身份,可以在 API 市场申请调用服务,并且每个应用拥有独立的 API 访问鉴权。", + "Ka4748416": "检索服务和 API", + "K383e17e5": "你可以在 API 市场中查看所有公开的服务。", + "K8f7808e6": "订阅服务", + "Kb0755523": "如果需要调用某个服务的 API,需要先订阅该服务,并且等待提供服务的团队审批后才可发起 API 请求。", + "Kd28a1aa5": "审批订阅申请", + "K4472e361": "提供服务的团队可以审批来自其他团队的订阅申请,审批通过后的应用才可发起 API请求。", + "K297d8563": "仪表盘中提供了多种统计图表,帮助我们了解 API 的运行情况。", + "K48f7e21f": "了解更多功能", + "Ka3626c8c": "隐藏快速入门", + "Kd2c1a316": "登录", + "Kf076f63c": "请输入账号", + "K80a560a1": "账号", + "K25c895d5": "请输入密码", + "K551b0348": "密码", + "K192b3e38": "访客模式", + "K91aa4801": "您可通过访客模式查看所有页面和功能,但是无法编辑数据。访客模式仅用于了解产品功能,您可以在正式产品中关闭该功能。", + "K480045ce": "Version (0)-(1)", + "Kadee8e49": "日志配置", + "K3453272": "APIPark 提供详尽的 API 调用日志,帮助企业监控、分析和审计 API 的运行状况。", + "K33c76dbc": "部门名称", + "K84829ca9": "父部门 ID", + "K4d7fc74b": "子部门名称", + "Ka16e6c44": "未激活、已禁用的成员无法加入到部门", + "Ked03ba97": "请选择成员需要新加入的部门", + "K5e237e06": "name", + "K184d3473": "添加账号", + "K1ecb35f2": "编辑成员信息", + "Ke6f00b44": "加入部门", + "K501cb1e7": "确定删除成员?此操作无法恢复,确认操作?", + "Kf20863b5": "成员与部门", + "K5f27a546": "输入用户名、邮箱查找成员", + "K26c698bb": "添加部门", + "Kb9cf2a7d": "添加子部门", + "Kc83551f5": "重命名", + "K3f1077c9": "设置成员和对应的角色,成员只能够看到权限范围内的功能和数据。", + "Kdce62a6": "搜索部门", + "K8ef69ee2": "密钥", + "Kba3507d6": "上传密钥", + "K93ac0f23": "密钥文件的后缀名一般为 .key 的文件内容", + "K7cdd1331": "上传证书", + "K6d91905d": "证书文件的后缀名一般为 .crt 或 .pem 的文件内容", + "Kd0f6ded7": "添加证书", + "Ke5732d60": "修改证书", + "K3ca07a70": "证书管理", + "Kdb927f83": "通过为 API 服务配置和管理 SSL 证书,企业可以加密数据传输,防止敏感信息被窃取或篡改。", + "K877985b7": "修改配置", + "Kdf66a675": "设置访问 API 的集群,让 API 在分布式环境中稳定运行,并且能够根据业务需求进行灵活扩展和优化。", + "Kaf074220": "未配置", + "K5878440c": "集群地址", + "K5e9022f8": "下一步", + "Kdbafd6f9": "设置监控报表的数据来源,设置完成之后即可获得详细的API调用统计图表。", + "K1358acf": "统计图表", + "K8fa58214": "数据源", + "K62dabdf6": "地址(IP:端口)", + "K2db12335": "组织(Organization)", + "K8e7a0f80": "资源配置", + "Kabfe9512": "保存", + "K95c3fd8b": "设置角色的权限范围。", + "K138facd3": "系统级别角色", + "K6eac768d": "添加角色", + "Kb9c2cf02": "团队级别角色", + "Kb4ceecea": "添加子分类", + "K67479e88": "修改分类名称", + "K2bc75e2c": "添加分类", + "Kab4aab44": "重命名分类", + "K8e0e6977": "设置服务可选择的分类,方便团队成员快速找到API。", + "Ke595a20a": "分类名称", + "K9679728f": "父分类 ID", + "K9b2d08fd": "子分类名称", + "Kf14e76e5": "副本", + "K2e050340": "API 基础信息", + "K90f3c02f": "转发规则设置", + "K6ea8d549": "编辑文档", + "Kff5c18ac": "最后编辑人", + "K2eb99415": "转发规则", + "Ke93388fd": "编辑 API", + "K1b1ae3b0": "复制 API", + "K84aabfd4": "添加 API", + "K6a662463": "输入名称、URL 查找 API", + "K59bc6280": "API 详情", + "K2a16c93b": "单位:ms,最小值:1", + "K469e475a": "重试次数", + "Kd568e15c": "发布结果", + "K35f990b0": "查看详情", + "Kdbc1f6cb": "申请发布", + "Kb6860a3f": "回滚", + "Ka3494f4b": "请确认是否回滚?", + "Kb397a99f": "撤销申请", + "K7d401c0f": "请确认是否撤销申请?", + "Ke1b79b93": "终止发布", + "Ka2449180": "请确认是否终止发布?", + "K2cb02f38": "新建版本", + "Ka9c08390": "只允许上传PNG、JPG或SVG格式的图片", + "Kcf756b7a": "API 调用前缀", + "K43d101a": "选填,作为服务内所有API的前缀,比如host/{service_name}/{api_path},一旦保存无法修改", + "Kdc840242": "图标", + "K427a5bd5": "仅支持 .png .jpg .jpeg .svg 格式的图片文件, 大于 1KB 的文件将被压缩", + "K44bc352d": "Logo", + "Kf52a584d": "所属服务分类", + "K72b21be5": "设置服务展示在服务市场中的哪个分类下", + "Kde6bae17": "删除服务", + "K885ea699": "删除操作不可恢复,请谨慎操作!", + "K617f34f1": "最近一次更新者", + "K6ebca204": "最近一次更新时间", + "K39ab0358": "新增订阅方", + "K2d6658ed": "添加服务", + "K7b8f623f": "输入名称、ID、所属团队、负责人查找服务", + "Kdd9b5008": "后端默认使用的IP地址", + "K6bc47edb": "请求协议", + "Kc9acdb25": "负载均衡", + "K632dba5c": "转发 Host", + "Kc1f08a63": "重写域名", + "K628f6851": "超时时间", + "Kaff62621": "超时重试次数", + "Kc41ca30e": "调用频率限制", + "K813e1c0a": "团队名称", + "K692f5aa6": "团队 ID", + "K5de0bc2": "团队 ID(team_id)可用于检索团队,一旦保存无法修改。", + "Ka63dd985": "团队负责人", + "Ka6bcd272": "负责人对团队内的团队、服务、成员有管理权限", + "Ka2012bdd": "删除团队", + "Kbde1f3d": "服务数据清除后,方可删除", + "K395acc14": "移除成员", + "Kec46a57f": "添加成员", + "K48724410": "输入姓名查找", + "Kb9052305": "搜索用户名、邮箱", + "K5ece3bac": "设置团队和成员,然后你可以在团队内创建服务和应用、订阅API,成员只能看到所属团队内的服务和应用。", + "K510cdd27": "添加团队", + "K9244ae14": "输入名称、ID、负责人查找团队", + "Kc7b24b4b": "配置团队", + "Kecb51e2c": "旧密码", + "K8266bcf2": "新密码", + "Ka9aef039": "确认密码", + "Kcf42dcda": "两次密码不一致", + "Kf876a42d": "修改密码", + "K8ed884f": "管理个人账号", + "K9be8e1d7": "API调用统计", + "K521ab28e": "选择服务", + "Kcc8265e1": "选择API", + "K8aefc1e4": "请输入请求路径进行搜索", + "K50d471b2": "重置", + "Kee8ae330": "查询", + "Ka2c794a2": "导出", + "Kaf70c3b": "退出全屏", + "Kd22841a4": "(0)调用详情", + "K1512e983": "应用调用统计", + "Kb4d2007f": "请选择应用", + "K8c7f2d2e": "调用趋势", + "K657c3452": "(0)-(1)调用趋势", + "Kc04efb87": "调用量统计", + "Keb98266e": "加入总体数据对比", + "K18c2ed46": "(0)调用量", + "Kc3741830": "(0)调用成功率", + "Ka6aa5863": "请求总数", + "K9eaef42": "请求成功率", + "K7082a4af": "转发总数", + "K1ce386fb": "转发成功率", + "K87d6877e": "4xx", + "K4c8a54db": "5xx", + "Kd566283e": "调用总体趋势", + "Kd23a0be6": "请求报文量", + "Kec3e8361": "响应报文量", + "Ke6250744": "4XX", + "K2d79d4e1": "5XX", + "Kcf6553c6": "服务调用统计", + "Kffcfe375": "请选择服务", + "Ka65f739c": "调用详情", + "K89b7ac79": "API 请求量 Top10", + "Kc0915603": "应用调用量 Top10", + "Kf90b54": "服务被调用量 Top10", + "Kfb26388": "暂无请求统计数据", + "Kc8cbd8f8": "请求统计", + "K8dece48": "暂无转发统计数据", + "K1ee32434": "转发统计", + "Kcd125e4d": "暂无调用量统计数据", + "Kaa114e8b": "暂无报文量统计数据", + "K3ad84406": "报文量统计", + "K19a3ebe0": "请求成功数", + "Kcaa8259": "转发成功数", + "K888f038f": "失败状态码数", + "K42d2bef2": "平均响应时间(ms)", + "K9197c994": "最大响应时间(ms)", + "K7c2f3fee": "最小响应时间(ms)", + "K3d85ea54": "平均请求流量(KB)", + "Keec09d32": "最大请求流量(KB)", + "K3786b48": "最小请求流量(KB)", + "K5168eb63": "应用名称", + "K546e46f": "应用 ID", + "K4a1a14": "监控总览", + "K69741ea7": "服务被调用统计", + "K9c8d9933": "API 调用统计", + "K28cf9613": "每分钟", + "K18f25019": "每5分钟", + "Kf00f01ca": "每小时", + "Kfcda87fc": "每天", + "K29ec75dc": "每周", + "K145e4941": "亿", + "Ke6a935d": "万", + "K8f7abcab": "次", + "K146477a8": "服务标签", + "K4de0af74": "服务分类", + "Kcce1af60": "订阅的服务", + "Kb6e9328f": "访问授权", + "Kb7e869a4": "应用管理", + "Kd59290a2": "搜索分类或标签", + "K6b75bdbc": "暂无API数据", + "Kd8a7a689": "搜索或选择应用", + "K4b15d6f5": "申请理由", + "Kb71b5a13": "鉴权类型", + "K4d1465ee": "Iss", + "K5dcd7ed8": "签名算法", + "K5b0eedd3": "Secret", + "K44f4ffe1": "RSA 公钥", + "Kc5ecd7d9": "用户名 JsonPath", + "K417d85cf": "校验字段", + "K3b82fe1d": "是否 Base64 加密", + "K49b5f4a3": "AK", + "K31418470": "SK", + "Kbfeb5297": "APIKey", + "K95764d1d": "删除应用", + "K217cb125": "鉴权详情", + "K2bb63eca": "添加鉴权", + "Kd74d69b7": "编辑鉴权", + "K9cbe1e0": "修改", + "Kd23d1716": "添加授权", + "K9dfa2c97": "永不过期", + "Kfa920c0": "到期时间", + "Kbeb4e991": "审批详情", + "Ked811bb1": "请确认是否取消订阅?", + "K50c39a62": "取消订阅申请", + "K1856c229": "请确认是否取消订阅申请?", + "K66ea2f0": "搜索服务", + "Kfeb2559b": "审批中", + "Ka2b6d281": "API 文档", + "K667bbbe7": "添加应用", + "Ka4b45550": "暂无服务描述", + "K3c7b175f": "订阅的服务数量:已通过 (0) 个,申请中 (1) 个", + "K850b4b2d": "状态码", + "Kbe3e9335": "退出测试", + "K370a3eb2": "服务市场", + "Kf7ec36d": "服务详情", + "K59cdbec3": "介绍", + "K4aa9ed2c": "申请", + "K6c060779": "服务信息", + "K8723422e": "接入应用", + "Kb97544cb": "供应方", + "Kb32f0afe": "分类", + "K81634069": "版本", + "K96a2f1c8": "无标签", + "K93d5a66e": "接入应用数量", + "K3e770a75": "鉴权 Token", + "K96059c69": "关联标签", + "K32263abd": "添加 Open API", + "K7829bb78": "配置 Open API", + "Kcdf76005": "Open API", + "Ke2601944": "调用服务", + "K8504bca8": "放大", + "K693c1b41": "缩小" + } \ No newline at end of file diff --git a/frontend/packages/core/src/App.tsx b/frontend/packages/core/src/App.tsx index ea2255b4..75c15bfb 100644 --- a/frontend/packages/core/src/App.tsx +++ b/frontend/packages/core/src/App.tsx @@ -7,11 +7,12 @@ import { StyleProvider } from '@ant-design/cssinjs'; import zhCN from 'antd/locale/zh_CN'; import enUS from 'antd/locale/en_US'; import useInitializeMonaco from "@common/hooks/useInitializeMonaco"; -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import 'dayjs/locale/zh-cn'; import dayjs from 'dayjs'; import { useGlobalContext } from '@common/contexts/GlobalStateContext'; import i18next from 'i18next'; +import { $t } from '@common/locales'; type Locale = ConfigProviderProps['locale']; @@ -150,13 +151,18 @@ function App() { setLocal(state.language === 'cn' ? zhCN : enUS); },[state.language]) + const validateMessages = useMemo(()=>({ + required: $t('必填项'), + email:$t('不是有效邮箱地址')} + ),[state.language]) return ( + theme={antdComponentThemeToken} + form={{validateMessages }}> diff --git a/frontend/packages/core/src/const/member/const.tsx b/frontend/packages/core/src/const/member/const.tsx index 3413bb59..4aedb8d4 100644 --- a/frontend/packages/core/src/const/member/const.tsx +++ b/frontend/packages/core/src/const/member/const.tsx @@ -43,9 +43,5 @@ export const MEMBER_TABLE_COLUMNS: PageProColumns[] = [ valueType: 'select', filters: true, onFilter: true, - valueEnum:new Map([ - [true,{('启用')}], - [false,{('禁用')}], - ]) } ]; diff --git a/frontend/packages/core/src/const/partitions/const.tsx b/frontend/packages/core/src/const/partitions/const.tsx index 1734c392..65fefaf7 100644 --- a/frontend/packages/core/src/const/partitions/const.tsx +++ b/frontend/packages/core/src/const/partitions/const.tsx @@ -3,6 +3,7 @@ import { ColumnType } from "antd/es/table"; import CopyAddrList from "@common/components/aoplatform/CopyAddrList"; import { PageProColumns } from "@common/components/aoplatform/PageList"; +import { $t } from "@common/locales"; export const PARTITION_CERT_TABLE_COLUMNS: PageProColumns[] = [ @@ -55,88 +56,6 @@ export const PARTITION_CERT_TABLE_COLUMNS: PageProColumns[] = [ - { - title:('集群名称'), - dataIndex: 'name', - ellipsis:true, - width:160, - fixed:'left', - sorter: (a,b)=> { - return a.name.localeCompare(b.name) - }, - }, - { - title:('集群 ID'), - dataIndex: 'id', - width: 140, - ellipsis:true - }, - { - title:('状态'), - dataIndex: 'status', - ellipsis:true, - valueType: 'select', - filters: true, - onFilter: true, - valueEnum: new Map([ - [0, 异常], - [1,正常], - ]) - }, - { - title: ('描述'), - dataIndex: 'description', - ellipsis:true - } -]; - - -export const PARTITION_CLUSTER_NODE_COLUMNS: PageProColumns[] = [ - { - title:('节点名称'), - dataIndex: 'name', - ellipsis:true, - fixed:'left', - sorter: (a,b)=> { - return a.name.localeCompare(b.name) - }, - }, - { - title:('管理地址'), - dataIndex: 'managerAddress', - ellipsis:true, - width:200, - render:(_,entity)=>() - }, - { - title:('服务地址'), - dataIndex: 'serviceAddress', - ellipsis:true, - width:230, - render:(_,entity)=>() - }, - { - title:('集群同步地址'), - dataIndex: 'peerAddress', - ellipsis:true, - width:230, - render:(_,entity)=>() - }, - { - title:('状态'), - dataIndex: 'status', - ellipsis:true, - width:86, - valueType: 'select', - filters: true, - onFilter: true, - valueEnum: new Map([ - [0, 异常], - [1,正常], - ]) - }, -]; export const NODE_MODAL_COLUMNS:ColumnType[] = [ {title:('名称'), dataIndex:'name',width:200, diff --git a/frontend/packages/core/src/const/system/const.tsx b/frontend/packages/core/src/const/system/const.tsx index bdadaeab..7356b7c0 100644 --- a/frontend/packages/core/src/const/system/const.tsx +++ b/frontend/packages/core/src/const/system/const.tsx @@ -12,6 +12,7 @@ import dayjs from 'dayjs'; import { Link } from "react-router-dom"; import { PageProColumns } from "@common/components/aoplatform/PageList"; +import { $t } from "@common/locales"; export enum SubscribeEnum{ Rejected = 0, @@ -141,83 +142,6 @@ export const SYSTEM_TABLE_COLUMNS: PageProColumns[] = [ } ]; -export const SYSTEM_SUBSERVICE_TABLE_COLUMNS: PageProColumns[] = [ - { - title:('服务名称'), - dataIndex: ['service','name'], - ellipsis:true, - width:160, - fixed:'left', - sorter: (a,b)=> { - return a.service.name.localeCompare(b.service.name) - }, - }, - { - title:('服务 ID'), - dataIndex: ['service','name'], - width: 140, - ellipsis:true - }, - { - title:('申请状态'), - dataIndex: 'applyStatus', - ellipsis:{ - showTitle:true - }, - width:80, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:new Map([ - [0,{('驳回')}], - [1,{('审核中')}], - [2,{('已订阅')}], - [3,{('取消订阅')}], - [4,{('取消申请')}], - ]) - }, - { - title:('所属服务'), - dataIndex: ['project','name'], - ellipsis:true - }, - { - title:('所属团队'), - dataIndex: ['team','name'], - ellipsis:true - }, - { - title:('申请人'), - dataIndex: ['applier','name'], - ellipsis: true, - width:88, - filters: true, - onFilter: true, - valueType: 'select', - filterSearch: true, - }, - { - title:('来源'), - dataIndex: 'from', - ellipsis: true, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:new Map([ - [0,{('手动添加')}], - [1,{('订阅申请')}], - ]) - }, - { - title:('添加时间'), - dataIndex: 'createTime', - ellipsis:true, - width:182, - sorter: (a,b)=> { - return a.createTime.localeCompare(b.createTime) - }, - }, -]; export const SYSTEM_SUBSCRIBER_TABLE_COLUMNS: PageProColumns[] = [ @@ -254,10 +178,6 @@ export const SYSTEM_SUBSCRIBER_TABLE_COLUMNS: PageProColumns{('手动添加')}], - [1,{('订阅申请')}], - ]) }, { title:('订阅时间'), @@ -318,7 +238,7 @@ export const MATCH_CONFIG:ConfigField[] = [ return { label:value, value:key} })}/>, renderText: (value:keyof typeof MatchPositionEnum) => { - return (<>{MatchPositionEnum[value]}) + return MatchPositionEnum[value] }, required: true, ellipsis:true @@ -326,7 +246,7 @@ export const MATCH_CONFIG:ConfigField[] = [ title:('参数名'), key: 'key', component: , - renderText: (value: unknown) => <>{value}, + renderText: (value: unknown) => value, required: true }, { title:('匹配类型'), @@ -335,7 +255,7 @@ export const MATCH_CONFIG:ConfigField[] = [ return { label:value, value:key} })}/>, renderText: (value:keyof typeof MatchTypeEnum) => { - return (<>{MatchTypeEnum[value]}) + return MatchTypeEnum[value] }, required: true }, { @@ -343,7 +263,7 @@ export const MATCH_CONFIG:ConfigField[] = [ key: 'pattern', component: , renderText: (value: string) => { - return (<>{value}) + return value }, required: true } @@ -465,7 +385,7 @@ export const UpstreamDriverEnum = { 'discoveries':('动态服务发现'), } -export const typeOptions = [ +export const UPSTREAM_TYPE_OPTIONS = [ { label: ('静态上游'), value: 'static' }, // { label: ('动态服务发现', value: 'discoveries' }, ]; @@ -474,18 +394,18 @@ export const schemeOptions = [ { label:('HTTPS'), value:'HTTPS'}, { label:('HTTP'), value:'HTTP'}, ] -export const balanceOptions = [ +export const UPSTREAM_BALANCE_OPTIONS = [ { label: ('带权轮询'), value: 'round-robin' }, { label: ('IP Hash'), value: 'ip-hash' }, ]; -export const passHostOptions = [ +export const UPSTREAM_PASS_HOST_OPTIONS = [ { label:('透传客户端请求 Host'), value:'pass'}, { label:('使用上游服务 Host'), value:'node'}, { label:('重写 Host'), value:'rewrite'}, ] -export const proxyHeaderTypeOptions =[ +export const UPSTREAM_PROXY_HEADER_TYPE_OPTIONS =[ {label:('新增或修改'), value: 'ADD' }, { label: ('删除'), value: 'DELETE' } ] @@ -494,9 +414,8 @@ export const PROXY_HEADER_CONFIG:ConfigField[] = [ { title:('操作类型'), key: 'optType', - component: , renderText: (value: string) => { - return (<>{value}) + return value }, required: true }, { @@ -512,7 +431,7 @@ export const PROXY_HEADER_CONFIG:ConfigField[] = [ key: 'value', component: , renderText: (value: string) => { - return (<>{value}) + return value }, required: true } @@ -529,7 +448,7 @@ export const NODE_CONFIG:ConfigField[] = [ key: 'address', component: , renderText: (value: string) => { - return (<>{value}) + return value }, required: true }, { @@ -537,13 +456,13 @@ export const NODE_CONFIG:ConfigField[] = [ key: 'weight', component: , renderText: (value: string) => { - return (<>{value}) + return value }, required: true } ] -export const visualizations = [ +export const SERVICE_VISUALIZATION_OPTIONS = [ {label:('内部服务:可通过网关访问,但不展示在服务广场'),value:'inner'}, {label:('公开服务:可通过网关访问,展示在服务广场,可被其他应用订阅'),value:'public'}]; @@ -594,162 +513,6 @@ export const apiModalColumn:ColumnsType = [ ] -export const SYSTEM_AUTHORITY_TABLE_COLUMNS: PageProColumns[] = [ - { - title:('名称'), - dataIndex: 'name', - ellipsis:true, - width:160, - fixed:'left', - sorter: (a,b)=> { - return a.name.localeCompare(b.name) - }, - }, - { - title:('类型'), - dataIndex: 'driver', - ellipsis:true, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:{ - basic:{ - text:'Basic' - }, - apikey:{ - text:'Apikey' - } - } - }, - { - title:('隐藏鉴权信息'), - dataIndex: 'hideCredential', - ellipsis:{ - showTitle:true - }, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:new Map([ - [true,], - [false,], - ]) - }, - { - title:('过期时间'), - dataIndex: 'expireTime', - ellipsis:true, - width:182, - render:(_: React.ReactNode, entity: SystemAuthorityTableListItem) => ( - 0 ? 'text-status_fail' : ''}>{entity.expireTime === 0 ? '永不过期' :dayjs(entity.expireTime * 1000).format('YYYY-MM-DD hh:mm:ss')} - ), - sorter: (a,b)=> { - return a.expireTime - b.expireTime - }, - }, - { - title:('更新者'), - dataIndex: ['updater','name'], - ellipsis: true, - width:88, - filters: true, - onFilter: true, - valueType: 'select', - filterSearch: true, - }, - { - title:('创建时间'), - key: 'createTime', - dataIndex: 'createTime', - width:182, - ellipsis:true, - sorter: (a,b)=> { - return a.createTime.localeCompare(b.createTime) - }, - }, -]; - - -export const SYSTEM_MYSERVICE_TABLE_COLUMNS: PageProColumns[] = [ - { - title:('服务名称'), - dataIndex: 'name', - ellipsis:true, - width:160, - fixed:'left', - sorter: (a,b)=> { - return a.name.localeCompare(b.name) - }, - }, - { - title:('服务ID'), - dataIndex: 'id', - width: 140, - ellipsis:true - }, - { - title:('服务类型'), - dataIndex: 'serviceType', - ellipsis:{ - showTitle:true - }, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:{ - 'public':{ - text:('公开服务') - }, - 'inner':{ - text:('内部服务') - } - } - }, - { - title:('API 数量'), - dataIndex: 'apiNum', - sorter: (a,b)=> { - return a.apiNum - b.apiNum - }, - }, - { - title:('状态'), - dataIndex: 'status', - ellipsis:{ - showTitle:true - }, - filters: true, - onFilter: true, - valueType: 'select', - valueEnum:{ - 'on':{('启用')} , - 'off':{('停用')} - } - }, - { - title:('更新时间'), - key: 'updateTime', - dataIndex: 'updateTime', - ellipsis:true, - width:182, - sorter: (a,b)=> { - return a.updateTime.localeCompare(b.updateTime) - }, - }, - { - title:('创建时间'), - key: 'createTime', - dataIndex: 'createTime', - width:182, - ellipsis:true, - sorter: (a,b)=> { - return a.createTime.localeCompare(b.createTime) - }, - }, -]; - - - export const SYSTEM_UPSTREAM_GLOBAL_CONFIG_TABLE_COLUMNS: PageProColumns[] = [ { title:('地址(IP 端口或域名)'), @@ -761,8 +524,7 @@ export const SYSTEM_UPSTREAM_GLOBAL_CONFIG_TABLE_COLUMNS: PageProColumns { if (code === STATUS_CODE.SUCCESS) { dispatch({type:'LOGIN'}) - // message.success(RESPONSE_TIPS.loginSuccess); + // message.success($t(RESPONSE_TIPS.loginSuccess)); const callbackUrl = new URLSearchParams(window.location.search).get('callbackUrl'); if (callbackUrl && callbackUrl !== 'null') { navigate(callbackUrl); @@ -102,7 +102,7 @@ const Login:FC = ()=> { return (
-
+
prev ? false : prev) return {data:data.approvals, success: true} }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) return {data:[], success:false} } }).catch(() => { @@ -77,7 +77,7 @@ export default function ApprovalList({pageType,pageStatus}:{pageType:'subscribe' }, [pageType,pageStatus]); const openModal = async(type:'approval'|'view',entity:ApprovalTableListItem)=>{ - message.loading(RESPONSE_TIPS.loading) + message.loading($t(RESPONSE_TIPS.loading)) const {code,data,msg} = await fetchData>(`approval/${pageType}`,{method:'GET',eoParams:{id:entity!.id},eoTransformKeys:['apply_project','apply_team','apply_time','approval_time']}) message.destroy() if(code === STATUS_CODE.SUCCESS){ @@ -116,7 +116,7 @@ export default function ApprovalList({pageType,pageStatus}:{pageType:'subscribe' }, }) }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) return } } @@ -132,7 +132,7 @@ export default function ApprovalList({pageType,pageStatus}:{pageType:'subscribe' }) setMemberValueEnum(tmpValueEnum) }else{ - message.error(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) } } diff --git a/frontend/packages/core/src/pages/guide/Guide.tsx b/frontend/packages/core/src/pages/guide/Guide.tsx index 5e5a5d40..d05b623f 100644 --- a/frontend/packages/core/src/pages/guide/Guide.tsx +++ b/frontend/packages/core/src/pages/guide/Guide.tsx @@ -27,7 +27,7 @@ export default function Guide(){
} showBorder={false} scrollPage={false} - contentClassName=" pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B" + contentClassName=" w-full pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B" > {showGuide && { } return Promise.resolve(data.dynamics) }else{ - message.error(msg || RESPONSE_TIPS.error) - return Promise.reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + return Promise.reject(msg || $t(RESPONSE_TIPS.error)) } }) } diff --git a/frontend/packages/core/src/pages/member/MemberDropdownModal.tsx b/frontend/packages/core/src/pages/member/MemberDropdownModal.tsx index c6e09ee5..89c8fef8 100644 --- a/frontend/packages/core/src/pages/member/MemberDropdownModal.tsx +++ b/frontend/packages/core/src/pages/member/MemberDropdownModal.tsx @@ -37,7 +37,7 @@ export const MemberDropdownModal = forwardRef{ if(!url || !method){ - reject(RESPONSE_TIPS.error) + reject($t(RESPONSE_TIPS.error)) return } form.validateFields().then((value)=>{ @@ -50,11 +50,11 @@ export const MemberDropdownModal = forwardRef{ const {code,msg} = response if(code === STATUS_CODE.SUCCESS){ - message.success(msg || RESPONSE_TIPS.success) + message.success(msg || $t(RESPONSE_TIPS.success)) resolve(true) }else{ - message.error(msg || RESPONSE_TIPS.error) - reject(msg || RESPONSE_TIPS.error) + message.error(msg || $t(RESPONSE_TIPS.error)) + reject(msg || $t(RESPONSE_TIPS.error)) } }).catch((errorInfo)=> reject(errorInfo)) }).catch((errorInfo)=> reject(errorInfo)) @@ -72,7 +72,7 @@ export const MemberDropdownModal = forwardRef