Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basic support Apache APISIX 2.11 #2233

Merged
merged 16 commits into from
Dec 3, 2021
41 changes: 40 additions & 1 deletion web/src/pages/Route/components/Step1/ProxyRewrite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import React from 'react';
import Form from 'antd/es/form';
import { Button, Input, Radio, Row, Col } from 'antd';
import { Button, Input, Radio, Row, Col, Select } from 'antd';
import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
import { useIntl } from 'umi';

Expand Down Expand Up @@ -279,6 +279,44 @@ const ProxyRewrite: React.FC<RouteModule.Step1PassProps> = ({ form, disabled })
);
};

const MethodRewriteType: React.FC = () => {
const methods = [
'GET',
'POST',
'PUT',
'DELETE',
'PATCH',
'OPTIONS',
'HEAD',
'TRACE',
'MKCOL',
'COPY',
'MOVE',
'PROPFIND',
'LOCK',
'UNLOCK',
];
return (
<React.Fragment>
<Form.Item
label={formatMessage({ id: 'page.route.form.itemLabel.methodRewrite' })}
name={['proxyRewrite', 'method']}
wrapperCol={{ span: 3 }}
initialValue=""
>
<Select>
<Select.Option value="">
{formatMessage({ id: 'page.route.select.option.methodRewriteNone' })}
</Select.Option>
{methods.map((method) => (
<Select.Option value={method}>{method}</Select.Option>
bzp2010 marked this conversation as resolved.
Show resolved Hide resolved
))}
</Select>
</Form.Item>
</React.Fragment>
);
};

const Headers: React.FC = () => {
return (
<Form.List name={['proxyRewrite', 'kvHeaders']} initialValue={[{}]}>
Expand Down Expand Up @@ -351,6 +389,7 @@ const ProxyRewrite: React.FC<RouteModule.Step1PassProps> = ({ form, disabled })
<SchemeComponent />
<URIRewriteType />
<HostRewriteType />
<MethodRewriteType />
<Headers />
</PanelSection>
);
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Route/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default {
'page.route.unpublished': 'UnPublished',

'page.route.select.option.inputManually': 'Input Manually',
'page.route.select.option.methodRewriteNone': 'Not modify',
'page.route.form.itemLabel.domainNameOrIp': 'Domain Name/IP',
'page.route.form.itemExtraMessage.domainNameOrIp':
'When using Domain Name, it will analysis the local: /etc/resolv.conf by default',
Expand All @@ -110,6 +111,7 @@ export default {
'page.route.form.itemLabel.template': 'Template',
'page.route.form.itemLabel.URIRewriteType': 'URI Override',
'page.route.form.itemLabel.hostRewriteType': 'Host Override',
'page.route.form.itemLabel.methodRewriteType': 'Method Override',
'page.route.form.itemLabel.redirectURI': 'Redirect URI',
'page.route.input.placeholder.newPath': 'For example: /foo/bar/index.html',

Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Route/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default {
'page.route.form.itemLabel.redirectCustom': '自定义重定向',
'page.route.form.itemLabel.URIRewriteType': '路径改写',
'page.route.form.itemLabel.hostRewriteType': '域名改写',
'page.route.form.itemLabel.methodRewrite': 'HTTP 方法改写',
'page.route.form.itemLabel.headerRewrite': '请求头改写',
'page.route.form.itemLabel.redirectURI': '重定向路径',
'page.route.form.itemExtraMessage.domain': '路由匹配的域名列表。支持泛域名,如:*.test.com',
Expand All @@ -97,6 +98,7 @@ export default {
'page.route.select.option.redirect301': '301(永久重定向)',
'page.route.select.option.redirect302': '302(临时重定向)',
'page.route.select.option.inputManually': '手动填写',
'page.route.select.option.methodRewriteNone': '不改写',

// steps
'page.route.steps.stepTitle.defineApiRequest': '设置路由信息',
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/Route/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const transformProxyRewrite2Formdata = (pluginsData: any) => {
case 'uri':
case 'regex_uri':
case 'host':
case 'method':
proxyRewriteData[key] = pluginsData[key];
break;
case 'headers':
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/Route/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ declare namespace RouteModule {
uri?: string;
regex_uri?: string[];
host?: string;
method?: string;
kvHeaders?: Kvobject[];
headers?: Record<string, string>;
};
Expand Down