Skip to content

Commit 2ac7fb8

Browse files
authored
fix: improve Route module (#1634)
1 parent 9c27b57 commit 2ac7fb8

File tree

7 files changed

+28
-17
lines changed

7 files changed

+28
-17
lines changed

web/src/pages/Route/Create.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@
112112
}
113113

114114
.stepForm {
115-
max-width: 700px;
116-
margin: 40px auto 0;
115+
margin-top: 40px;
117116
:global {
118117
.ant-form-item-with-help {
119118
margin-bottom: 24px;

web/src/pages/Route/Create.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,9 @@ const Page: React.FC<Props> = (props) => {
269269
return (
270270
<>
271271
<PageHeaderWrapper
272-
title={`${(props as any).match.params.rid
273-
? formatMessage({ id: 'component.global.edit' })
274-
: formatMessage({ id: 'component.global.create' })
275-
} ${formatMessage({ id: 'menu.routes' })}`}
272+
title={(props as any).match.params.rid
273+
? formatMessage({ id: 'page.route.editRoute' })
274+
: formatMessage({ id: 'page.route.createRoute' })}
276275
>
277276
<Card bordered={false}>
278277
<Steps current={step - 1} className={styles.steps}>

web/src/pages/Route/List.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ const Page: React.FC = () => {
266266
<Select
267267
mode="tags"
268268
style={{ width: '100%' }}
269+
placeholder={formatMessage({ id: 'component.global.pleaseChoose' })}
269270
tagRender={(props) => {
270271
const { value, closable, onClose } = props;
271272
return (
@@ -307,7 +308,11 @@ const Page: React.FC = () => {
307308
}
308309

309310
return (
310-
<Select style={{ width: '100%' }} allowClear>
311+
<Select
312+
style={{ width: '100%' }}
313+
placeholder={formatMessage({ id: 'component.global.pleaseChoose' })}
314+
allowClear
315+
>
311316
{Object.keys(labelList)
312317
.filter((item) => item === 'API_VERSION')
313318
.map((key) => {
@@ -344,7 +349,13 @@ const Page: React.FC = () => {
344349
}
345350

346351
return (
347-
<Select style={{ width: '100%' }} allowClear>
352+
<Select
353+
style={{ width: '100%' }}
354+
placeholder={
355+
`${formatMessage({ id: 'page.route.unpublished' })}/${formatMessage({ id: 'page.route.published' })}`
356+
}
357+
allowClear
358+
>
348359
<Option key={RouteStatus.Offline} value={RouteStatus.Offline}>
349360
{formatMessage({ id: 'page.route.unpublished' })}
350361
</Option>

web/src/pages/Route/components/Step3/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import React, { useState } from 'react';
1818
import { Radio, Tooltip } from 'antd';
1919
import { QuestionCircleOutlined } from '@ant-design/icons';
20-
import { isChrome } from 'react-device-detect';
20+
import { isChrome, isChromium, isEdgeChromium } from 'react-device-detect';
2121
import { useIntl } from 'umi';
2222

2323
import PluginOrchestration from '@/components/PluginOrchestration';
@@ -42,7 +42,8 @@ const Page: React.FC<Props> = ({ data, onChange, readonly = false, isForceHttps
4242
const { plugins = {}, script = {}, plugin_config_id = '' } = data;
4343

4444
// NOTE: Currently only compatible with chrome
45-
const disableDraw = !isChrome || isForceHttps || isProxyEnable;
45+
const useSupportBrowser = isChrome || isEdgeChromium || isChromium;
46+
const disableDraw = !useSupportBrowser || isForceHttps || isProxyEnable;
4647

4748
const type = Object.keys(script || {}).length === 0 || disableDraw ? 'NORMAL' : 'DRAW';
4849

@@ -72,7 +73,7 @@ const Page: React.FC<Props> = ({ data, onChange, readonly = false, isForceHttps
7273
title={() => {
7374
// NOTE: forceHttps do not support DRAW mode
7475
const titleArr: string[] = [];
75-
if (!isChrome) {
76+
if (!useSupportBrowser) {
7677
titleArr.push(formatMessage({id: 'page.route.tooltip.pluginOrchOnlySuportChrome'}));
7778
}
7879
if (isForceHttps) {

web/src/pages/Route/constants.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ export const HTTP_METHOD_OPTION_LIST: HttpMethod[] = [
2626

2727
export const FORM_ITEM_LAYOUT = {
2828
labelCol: {
29-
span: 6,
30-
},
31-
wrapperCol: {
32-
span: 18,
33-
},
29+
span: 3,
30+
}
3431
};
3532

3633
export const FORM_ITEM_WITHOUT_LABEL = {
3734
wrapperCol: {
3835
xs: { span: 24, offset: 0 },
39-
sm: { span: 20, offset: 6 },
36+
sm: { span: 20, offset: 3 },
4037
},
4138
};
4239

web/src/pages/Route/locales/en-US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export default {
3636
'page.route.service': 'Service',
3737
'page.route.instructions': 'Instructions',
3838
'page.route.import': 'Import',
39+
'page.route.createRoute': 'Create Route',
40+
'page.route.editRoute': 'Edit Route',
3941

4042
'page.route.input.placeholder.parameterNameHttpHeader': 'Request header name, for example: HOST',
4143
'page.route.input.placeholder.parameterNameRequestParameter': 'Parameter name, for example: id',

web/src/pages/Route/locales/zh-CN.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export default {
4444
'page.route.service': '服务',
4545
'page.route.instructions': '说明',
4646
'page.route.import': '导入',
47+
'page.route.createRoute': '创建路由',
48+
'page.route.editRoute': '编辑路由',
4749

4850
// button
4951
'page.route.button.returnList': '返回路由列表',

0 commit comments

Comments
 (0)