Skip to content

Commit

Permalink
i18n and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1666204 committed Jun 17, 2024
1 parent 15d726b commit 79bb399
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 12 deletions.
1 change: 1 addition & 0 deletions ui/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"postinstall": "max setup",
"lint": "eslint src",
"oic:clear": "oic --configPath ./must.cjs --clear",
"oic:extract": "oic --configPath ./must.cjs --extract --translate",
"oic:extract": "oic --configPath ./must.cjs --extract",
"prepare": "cd .. && husky ui/.husky",
"setup": "max setup",
"start": "npm run dev"
Expand Down
8 changes: 7 additions & 1 deletion ui/src/i18n/strings/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1021,5 +1021,11 @@
"src.pages.OBProxy.Detail.Overview.D537DD35": "参数设置",
"src.pages.OBProxy.Detail.Overview.8A75D872": "请选择",
"src.pages.OBProxy.Detail.Overview.8E87D135": "添加",
"src.components.CustomFormItem.2C6315A1": "请输入"
"src.components.CustomFormItem.2C6315A1": "请输入",
"src.pages.OBProxy.New.2C466A93": "基本信息",
"src.pages.OBProxy.New.0AE478F2": "请选择",
"src.pages.OBProxy.Detail.Overview.A9BB34D6": "操作成功!",
"src.pages.OBProxy.Detail.Overview.FEBB24FF": "删除列表中的参数并不会将原来已经设置的参数复原,如果需要参数立即生效,请覆盖参数为原值或者重启集群",
"src.pages.OBProxy.Detail.Overview.A6701513": "请输入",
"src.pages.OBProxy.Detail.Overview.4AB0B6DC": "基本信息"
}
5 changes: 2 additions & 3 deletions ui/src/pages/Cluster/Detail/Monitor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { getClusterDetailReq } from '@/services';
import { PageContainer } from '@ant-design/pro-components';
import { useParams } from '@umijs/max';
import { useRequest } from 'ahooks';
import { useEffect,useState } from 'react';
import { useEffect, useState } from 'react';
import BasicInfo from '../Overview/BasicInfo';

import { getFilterData } from '@/components/MonitorDetail/helper';


export default function Monitor() {
const { ns, name, clusterName } = useParams();
const [filterData, setFilterData] = useState<Monitor.FilterDataType>({
Expand All @@ -35,7 +34,7 @@ export default function Monitor() {
);

useEffect(() => {
getClusterDetail({ ns:ns!, name:name! });
getClusterDetail({ ns: ns!, name: name! });
}, []);
return (
<PageContainer>
Expand Down
12 changes: 11 additions & 1 deletion ui/src/pages/OBProxy/Detail/Overview/BasicInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ export default function BasicInfo({
style,
}: BasicInfoProps) {
return (
<Card style={style} title={<h2 style={{ marginBottom: 0 }}>基本信息</h2>}>
<Card
style={style}
title={
<h2 style={{ marginBottom: 0 }}>
{intl.formatMessage({
id: 'src.pages.OBProxy.Detail.Overview.4AB0B6DC',
defaultMessage: '基本信息',
})}
</h2>
}
>
<Descriptions column={3}>
<Descriptions.Item
label={intl.formatMessage({
Expand Down
20 changes: 17 additions & 3 deletions ui/src/pages/OBProxy/Detail/Overview/ConfigDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export default function ConfigDrawer({
}
const res = await obproxy.patchOBProxy(namespace!, name!, values);
if (res.successful) {
message.success('操作成功!');
message.success(
intl.formatMessage({
id: 'src.pages.OBProxy.Detail.Overview.A9BB34D6',
defaultMessage: '操作成功!',
}),
);
submitCallback && submitCallback();
onClose();
}
Expand Down Expand Up @@ -203,7 +208,11 @@ export default function ConfigDrawer({
</CustomFormItem>
<p style={titleStyle}>
<IconTip
tip="删除列表中的参数并不会将原来已经设置的参数复原,如果需要参数立即生效,请覆盖参数为原值或者重启集群"
tip={intl.formatMessage({
id: 'src.pages.OBProxy.Detail.Overview.FEBB24FF',
defaultMessage:
'删除列表中的参数并不会将原来已经设置的参数复原,如果需要参数立即生效,请覆盖参数为原值或者重启集群',
})}
content={intl.formatMessage({
id: 'src.pages.OBProxy.Detail.Overview.D537DD35',
defaultMessage: '参数设置',
Expand Down Expand Up @@ -249,7 +258,12 @@ export default function ConfigDrawer({
</Col>
<Col span={11}>
<CustomFormItem name={[name, 'value']}>
<Input placeholder="请输入" />
<Input
placeholder={intl.formatMessage({
id: 'src.pages.OBProxy.Detail.Overview.A6701513',
defaultMessage: '请输入',
})}
/>
</CustomFormItem>
</Col>
<Col
Expand Down
17 changes: 14 additions & 3 deletions ui/src/pages/OBProxy/New/BasicConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ export default function BasicConfig({ form }: BasicConfigProps) {
if (selectCluster && !form.getFieldValue('namespace')) {
try {
form.setFieldValue('namespace', JSON.parse(selectCluster).namespace);
form.validateFields(['namespace'])
form.validateFields(['namespace']);
} catch (err) {
console.error('err:', err);
}
}
}, [selectCluster]);
return (
<Card title={'基本信息'}>
<Card
title={intl.formatMessage({
id: 'src.pages.OBProxy.New.2C466A93',
defaultMessage: '基本信息',
})}
>
<Row gutter={[16, 32]}>
<Col span={8}>
<TooltipPretty
Expand Down Expand Up @@ -117,7 +122,13 @@ export default function BasicConfig({ form }: BasicConfigProps) {
},
]}
>
<Select placeholder="请选择" options={clisterList} />
<Select
placeholder={intl.formatMessage({
id: 'src.pages.OBProxy.New.0AE478F2',
defaultMessage: '请选择',
})}
options={clisterList}
/>
</Form.Item>
</Col>
<Col span={8}>
Expand Down

0 comments on commit 79bb399

Please sign in to comment.