Skip to content

Commit

Permalink
chore: update Service module (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
juzhiyuan authored Apr 14, 2021
1 parent 419128d commit f9e1006
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
21 changes: 9 additions & 12 deletions web/src/pages/Service/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ const Page: React.FC = (props) => {
(serviceId ? update(serviceId, data) : create(data))
.then(() => {
notification.success({
message: `${
serviceId
? formatMessage({ id: 'component.global.edit' })
: formatMessage({ id: 'component.global.create' })
} ${formatMessage({ id: 'menu.service' })} ${formatMessage({
id: 'component.status.success',
})}`,
message: `${serviceId
? formatMessage({ id: 'component.global.edit' })
: formatMessage({ id: 'component.global.create' })
} ${formatMessage({ id: 'menu.service' })} ${formatMessage({
id: 'component.status.success',
})}`,
});
history.push('/service/list');
})
Expand Down Expand Up @@ -115,11 +114,9 @@ const Page: React.FC = (props) => {
return (
<>
<PageHeaderWrapper
title={`${
(props as any).match.params.serviceId
? formatMessage({ id: 'component.global.edit' })
: formatMessage({ id: 'component.global.create' })
} ${formatMessage({ id: 'menu.service' })}`}
title={(props as any).match.params.serviceId
? formatMessage({ id: 'page.service.configure' })
: formatMessage({ id: 'page.service.create' })}
>
<Card bordered={false}>
<Steps current={step - 1} style={{ marginBottom: '25px' }}>
Expand Down
5 changes: 2 additions & 3 deletions web/src/pages/Service/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Page: React.FC = () => {
];

return (
<PageHeaderWrapper title={formatMessage({ id: 'page.service.list' })}>
<PageHeaderWrapper title={formatMessage({ id: 'page.service.list' })} content={formatMessage({ id: 'page.service.description' })}>
<ProTable<ServiceModule.ResponseBody>
actionRef={ref}
rowKey="id"
Expand All @@ -129,12 +129,11 @@ const Page: React.FC = () => {
<PlusOutlined />
{formatMessage({ id: 'component.global.create' })}
</Button>,
<Button type="primary" onClick={() => {
<Button type="default" onClick={() => {
setVisible(true);
setEditorMode('create');
setRawData({});
}}>
<PlusOutlined />
{formatMessage({ id: 'component.global.data.editor' })}
</Button>,
]}
Expand Down
11 changes: 8 additions & 3 deletions web/src/pages/Service/components/Step1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ const Step1: React.FC<ServiceModule.Step1PassProps> = ({
return (
<>
<Form {...FORM_LAYOUT} form={form}>
<Form.Item name="name" label={formatMessage({ id: 'component.global.name' })}>
<Input disabled={disabled} />
<Form.Item name="name" label={formatMessage({ id: 'component.global.name' })} required rules={[
{
required: true,
message: formatMessage({ id: 'page.service.fields.name.required' })
}
]}>
<Input disabled={disabled} placeholder={formatMessage({ id: 'page.service.fields.name.required' })} />
</Form.Item>
<Form.Item name="desc" label={formatMessage({ id: 'component.global.description' })}>
<Input.TextArea disabled={disabled} />
<Input.TextArea disabled={disabled} placeholder={formatMessage({ id: 'component.global.description.required' })} />
</Form.Item>
</Form>
<UpstreamForm
Expand Down
5 changes: 4 additions & 1 deletion web/src/pages/Service/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ export default {
'page.service.steps.stepTitle.basicInformation': 'Basic Information',
'page.service.steps.stepTitle.pluginConfig': 'Plugin Config',
'page.service.steps.stepTitle.preview': 'Preview',
'page.service.list': 'Service List'
'page.service.list': 'Service List',
'page.service.description': 'A service consists of a combination of public plugin configuration and upstream target information in a route. Services are associated with Routes and Upstreams, and a service can correspond to a set of upstream nodes and can be bound by multiple routes.',
'page.service.create': 'Create Service',
'page.service.configure': 'Configure Service'
};
6 changes: 5 additions & 1 deletion web/src/pages/Service/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ export default {
'page.service.steps.stepTitle.basicInformation': '基本信息',
'page.service.steps.stepTitle.pluginConfig': '插件配置',
'page.service.steps.stepTitle.preview': '预览',
'page.service.list': '服务列表'
'page.service.list': '服务列表',
'page.service.description': '服务由路由中公共的插件配置、上游目标信息组合而成。服务与路由、上游关联,一个服务可对应一组上游节点、可被多条路由绑定。',
'page.service.fields.name.required': '请输入服务名称',
'page.service.create': '创建服务',
'page.service.configure': '配置服务'
};

0 comments on commit f9e1006

Please sign in to comment.