From 287a666e1b2bb155e86aa88ebace201d1e8a51f6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 19 三月 2026 13:26:02 +0800
Subject: [PATCH] #AI.国际化
---
rsf-admin/src/page/system/aiMcpMount/AiMcpMountForm.jsx | 48 +++++++++++++++++++++++++++---------------------
1 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/rsf-admin/src/page/system/aiMcpMount/AiMcpMountForm.jsx b/rsf-admin/src/page/system/aiMcpMount/AiMcpMountForm.jsx
index 7e1deee..b11f4d1 100644
--- a/rsf-admin/src/page/system/aiMcpMount/AiMcpMountForm.jsx
+++ b/rsf-admin/src/page/system/aiMcpMount/AiMcpMountForm.jsx
@@ -5,6 +5,7 @@
SelectInput,
TextInput,
useNotify,
+ useTranslate,
} from "react-admin";
import { Alert, Button, Grid, Stack, Typography } from "@mui/material";
import StatusSelectInput from "@/page/components/StatusSelectInput";
@@ -18,6 +19,7 @@
const AiMcpDraftTestSection = ({ formData, readOnly }) => {
const notify = useNotify();
+ const translate = useTranslate();
const [loading, setLoading] = useState(false);
const [result, setResult] = useState(null);
@@ -26,11 +28,11 @@
try {
const data = await validateDraftMcpConnectivity(formData);
setResult(data);
- notify(data?.message || "鑽夌杩為�氭�ф祴璇曞畬鎴�");
+ notify(data?.message || translate("ai.mcp.connectivity.success"));
} catch (error) {
const nextResult = {
healthStatus: "UNHEALTHY",
- message: error?.message || "鑽夌杩為�氭�ф祴璇曞け璐�",
+ message: error?.message || translate("ai.mcp.connectivity.failed"),
};
setResult(nextResult);
notify(nextResult.message, { type: "error" });
@@ -48,10 +50,10 @@
<Grid item xs={12}>
<Stack direction="row" spacing={1} alignItems="center">
<Button variant="outlined" onClick={handleValidate} disabled={loading}>
- {loading ? "娴嬭瘯涓�..." : "淇濆瓨鍓嶆祴璇�"}
+ {loading ? translate("ai.common.testing") : translate("ai.mcp.form.testBeforeSave")}
</Button>
<Typography variant="body2" color="text.secondary">
- 鐢ㄥ綋鍓嶈崏绋块厤缃洿鎺ユ牎楠岃繛閫氭�э紝涓嶄細钀藉簱銆�
+ {translate("ai.mcp.form.testDescription")}
</Typography>
</Stack>
</Grid>
@@ -68,16 +70,19 @@
);
};
-const AiMcpMountForm = ({ readOnly = false }) => (
+const AiMcpMountForm = ({ readOnly = false }) => {
+ const translate = useTranslate();
+
+ return (
<Grid container spacing={2} width={{ xs: "100%", xl: "80%" }}>
<Grid item xs={12}>
- <Typography variant="h6">MCP 鎸傝浇閰嶇疆</Typography>
+ <Typography variant="h6">{translate("ai.mcp.form.sections.main")}</Typography>
</Grid>
<Grid item xs={12} md={6}>
- <TextInput source="name" label="鍚嶇О" fullWidth disabled={readOnly} />
+ <TextInput source="name" label="common.field.name" fullWidth disabled={readOnly} />
</Grid>
<Grid item xs={12} md={6}>
- <SelectInput source="transportType" label="浼犺緭绫诲瀷" choices={transportChoices} fullWidth disabled={readOnly} />
+ <SelectInput source="transportType" label="ai.mcp.fields.transportType" choices={transportChoices} fullWidth disabled={readOnly} />
</Grid>
<FormDataConsumer>
{({ formData }) => (
@@ -87,7 +92,7 @@
<Grid item xs={12}>
<SelectInput
source="builtinCode"
- label="鍐呯疆 MCP"
+ label="ai.mcp.fields.builtinCode"
choices={[
{ id: "RSF_WMS", name: "RSF_WMS" },
{ id: "RSF_WMS_STOCK", name: "RSF_WMS_STOCK" },
@@ -103,7 +108,7 @@
{formData.transportType === "SSE_HTTP" && (
<>
<Grid item xs={12}>
- <TextInput source="serverUrl" label="鏈嶅姟鍦板潃" fullWidth disabled={readOnly} />
+ <TextInput source="serverUrl" label="ai.mcp.fields.serverUrl" fullWidth disabled={readOnly} />
</Grid>
<Grid item xs={12}>
<TextInput source="endpoint" label="SSE Endpoint" fullWidth disabled={readOnly} />
@@ -116,7 +121,7 @@
{formData.transportType === "STDIO" && (
<>
<Grid item xs={12}>
- <TextInput source="command" label="鍛戒护" fullWidth disabled={readOnly} />
+ <TextInput source="command" label="ai.mcp.fields.command" fullWidth disabled={readOnly} />
</Grid>
<Grid item xs={12}>
<TextInput source="argsJson" label="Args JSON" fullWidth multiline minRows={4} disabled={readOnly} />
@@ -133,39 +138,40 @@
<NumberInput source="requestTimeoutMs" label="Timeout(ms)" fullWidth disabled={readOnly} />
</Grid>
<Grid item xs={12} md={4}>
- <NumberInput source="sort" label="鎺掑簭" fullWidth disabled={readOnly} />
+ <NumberInput source="sort" label="ai.mcp.fields.sort" fullWidth disabled={readOnly} />
</Grid>
<Grid item xs={12} md={4}>
<StatusSelectInput disabled={readOnly} />
</Grid>
<Grid item xs={12}>
- <TextInput source="memo" label="澶囨敞" fullWidth multiline minRows={3} disabled={readOnly} />
+ <TextInput source="memo" label="common.field.memo" fullWidth multiline minRows={3} disabled={readOnly} />
</Grid>
<FormDataConsumer>
{({ formData }) => <AiMcpDraftTestSection formData={formData} readOnly={readOnly} />}
</FormDataConsumer>
<Grid item xs={12}>
- <Typography variant="h6">杩愯鎬佷俊鎭�</Typography>
+ <Typography variant="h6">{translate("ai.mcp.form.sections.runtime")}</Typography>
</Grid>
<Grid item xs={12} md={4}>
- <TextInput source="healthStatus" label="鍋ュ悍鐘舵��" fullWidth disabled />
+ <TextInput source="healthStatus" label="ai.mcp.fields.healthStatus" fullWidth disabled />
</Grid>
<Grid item xs={12} md={4}>
- <TextInput source="lastInitElapsedMs" label="鏈�杩戝垵濮嬪寲鑰楁椂(ms)" fullWidth disabled />
+ <TextInput source="lastInitElapsedMs" label="ai.mcp.fields.lastInitElapsedMs" fullWidth disabled />
</Grid>
<Grid item xs={12} md={4}>
- <TextInput source="lastTestTime$" label="鏈�杩戞祴璇曟椂闂�" fullWidth disabled />
+ <TextInput source="lastTestTime$" label="ai.mcp.fields.lastTestTime" fullWidth disabled />
</Grid>
<Grid item xs={12}>
- <TextInput source="lastTestMessage" label="鏈�杩戞祴璇曠粨鏋�" fullWidth multiline minRows={3} disabled />
+ <TextInput source="lastTestMessage" label="ai.mcp.fields.lastTestMessage" fullWidth multiline minRows={3} disabled />
</Grid>
<Grid item xs={12} md={6}>
- <TextInput source="updateBy" label="鏈�杩戞洿鏂颁汉" fullWidth disabled />
+ <TextInput source="updateBy" label="ai.common.lastUpdatedBy" fullWidth disabled />
</Grid>
<Grid item xs={12} md={6}>
- <TextInput source="updateTime$" label="鏈�杩戞洿鏂版椂闂�" fullWidth disabled />
+ <TextInput source="updateTime$" label="ai.common.lastUpdatedAt" fullWidth disabled />
</Grid>
</Grid>
-);
+ );
+};
export default AiMcpMountForm;
--
Gitblit v1.9.1