From 1d2bc545c6e081f9ce0270ae12d61eecdaadab0e Mon Sep 17 00:00:00 2001 From: litesun Date: Mon, 12 Apr 2021 12:24:23 +0800 Subject: [PATCH 1/4] feat: adding a retry mechanism to FE testing (#1752) --- web/cypress.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/cypress.json b/web/cypress.json index 88b22c07b4..9fb0b6162e 100644 --- a/web/cypress.json +++ b/web/cypress.json @@ -3,5 +3,9 @@ "viewportHeight": 1080, "baseUrl": "http://localhost:8000", "video": true, - "videoUploadOnPasses": false + "videoUploadOnPasses": false, + "retries": { + "runMode": 3, + "openMode": 0 + } } From afc3df96c0f7d86bfd20c57957444fe4d7185b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=9A=E8=87=B4=E8=BF=9C?= Date: Mon, 12 Apr 2021 14:48:52 +0800 Subject: [PATCH 2/4] chore: support SPA 404 fallback (#1750) --- netlify.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netlify.toml b/netlify.toml index 17f612e61f..944163d9d9 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,3 +2,8 @@ from = "/apisix/*" to = "http://139.217.190.60/apisix/:splat" status = 200 + +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 From eede8939499a758fa8aa489eb34f49363b889bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=9A=E8=87=B4=E8=BF=9C?= Date: Mon, 12 Apr 2021 15:55:10 +0800 Subject: [PATCH 3/4] chore: refactor upstream form module (#1726) --- .../fixtures/export-route-dataset.json | 6 +- web/src/components/Plugin/UI/plugin.tsx | 2 +- web/src/components/Upstream/UpstreamForm.tsx | 761 +++--------------- .../components/Upstream/components/Nodes.tsx | 125 +++ .../Upstream/components/PassHost.tsx | 88 ++ .../Upstream/components/Retries.tsx | 39 + .../components/Upstream/components/Scheme.tsx | 62 ++ .../Upstream/components/TimeUnit.tsx | 21 + .../Upstream/components/Timeout.tsx | 49 ++ .../components/Upstream/components/Type.tsx | 112 +++ .../Upstream/components/UpstreamSelector.tsx | 69 ++ .../active-check/Healthy/Interval.tsx | 54 ++ .../active-check/Healthy/Successes.tsx | 50 ++ .../components/active-check/Healthy/index.ts | 23 + .../Upstream/components/active-check/Host.tsx | 61 ++ .../components/active-check/HttpPath.tsx | 55 ++ .../Upstream/components/active-check/Port.tsx | 43 + .../components/active-check/ReqHeaders.tsx | 81 ++ .../components/active-check/Timeout.tsx | 39 + .../Upstream/components/active-check/Type.tsx | 57 ++ .../active-check/Unhealthy/HttpFailures.tsx | 52 ++ .../active-check/Unhealthy/HttpStatuses.tsx | 74 ++ .../active-check/Unhealthy/Interval.tsx | 54 ++ .../active-check/Unhealthy/Timeouts.tsx | 38 + .../active-check/Unhealthy/index.ts | 27 + .../Upstream/components/active-check/index.ts | 36 + .../passive-check/Healthy/HttpStatuses.tsx | 76 ++ .../passive-check/Healthy/Successes.tsx | 49 ++ .../components/passive-check/Healthy/index.ts | 23 + .../components/passive-check/Type.tsx | 57 ++ .../passive-check/Unhealthy/HttpFailures.tsx | 52 ++ .../passive-check/Unhealthy/HttpStatuses.tsx | 75 ++ .../passive-check/Unhealthy/TcpFailures.tsx | 51 ++ .../passive-check/Unhealthy/Timeouts.tsx | 38 + .../passive-check/Unhealthy/index.ts | 27 + .../components/passive-check/index.ts | 25 + web/src/components/Upstream/constant.ts | 56 +- web/src/pages/Route/locales/zh-CN.ts | 2 +- web/src/pages/Upstream/locales/en-US.ts | 6 +- web/src/pages/Upstream/locales/zh-CN.ts | 8 +- 40 files changed, 1939 insertions(+), 684 deletions(-) create mode 100644 web/src/components/Upstream/components/Nodes.tsx create mode 100644 web/src/components/Upstream/components/PassHost.tsx create mode 100644 web/src/components/Upstream/components/Retries.tsx create mode 100644 web/src/components/Upstream/components/Scheme.tsx create mode 100644 web/src/components/Upstream/components/TimeUnit.tsx create mode 100644 web/src/components/Upstream/components/Timeout.tsx create mode 100644 web/src/components/Upstream/components/Type.tsx create mode 100644 web/src/components/Upstream/components/UpstreamSelector.tsx create mode 100644 web/src/components/Upstream/components/active-check/Healthy/Interval.tsx create mode 100644 web/src/components/Upstream/components/active-check/Healthy/Successes.tsx create mode 100644 web/src/components/Upstream/components/active-check/Healthy/index.ts create mode 100644 web/src/components/Upstream/components/active-check/Host.tsx create mode 100644 web/src/components/Upstream/components/active-check/HttpPath.tsx create mode 100644 web/src/components/Upstream/components/active-check/Port.tsx create mode 100644 web/src/components/Upstream/components/active-check/ReqHeaders.tsx create mode 100644 web/src/components/Upstream/components/active-check/Timeout.tsx create mode 100644 web/src/components/Upstream/components/active-check/Type.tsx create mode 100644 web/src/components/Upstream/components/active-check/Unhealthy/HttpFailures.tsx create mode 100644 web/src/components/Upstream/components/active-check/Unhealthy/HttpStatuses.tsx create mode 100644 web/src/components/Upstream/components/active-check/Unhealthy/Interval.tsx create mode 100644 web/src/components/Upstream/components/active-check/Unhealthy/Timeouts.tsx create mode 100644 web/src/components/Upstream/components/active-check/Unhealthy/index.ts create mode 100644 web/src/components/Upstream/components/active-check/index.ts create mode 100644 web/src/components/Upstream/components/passive-check/Healthy/HttpStatuses.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Healthy/Successes.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Healthy/index.ts create mode 100644 web/src/components/Upstream/components/passive-check/Type.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Unhealthy/HttpFailures.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Unhealthy/HttpStatuses.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Unhealthy/TcpFailures.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Unhealthy/Timeouts.tsx create mode 100644 web/src/components/Upstream/components/passive-check/Unhealthy/index.ts create mode 100644 web/src/components/Upstream/components/passive-check/index.ts diff --git a/web/cypress/fixtures/export-route-dataset.json b/web/cypress/fixtures/export-route-dataset.json index 133971fa7e..15f70fc0c1 100644 --- a/web/cypress/fixtures/export-route-dataset.json +++ b/web/cypress/fixtures/export-route-dataset.json @@ -38,13 +38,13 @@ "weight": 1 } ], - "retries": 1, "timeout": { "connect": 6, "read": 6, "send": 6 }, "type": "roundrobin", + "scheme": "http", "pass_host": "pass" } } @@ -90,13 +90,13 @@ "weight": 1 } ], - "retries": 1, "timeout": { "connect": 6, "read": 6, "send": 6 }, "type": "roundrobin", + "scheme": "http", "pass_host": "pass" } } @@ -141,13 +141,13 @@ "weight": 1 } ], - "retries": 1, "timeout": { "connect": 6, "read": 6, "send": 6 }, "type": "roundrobin", + "scheme": "http", "pass_host": "pass" } } diff --git a/web/src/components/Plugin/UI/plugin.tsx b/web/src/components/Plugin/UI/plugin.tsx index f13b31ae16..620f98b4e4 100644 --- a/web/src/components/Plugin/UI/plugin.tsx +++ b/web/src/components/Plugin/UI/plugin.tsx @@ -15,7 +15,7 @@ * limitations under the License. */ import React from 'react'; -import { FormInstance } from 'antd/es/form'; +import type { FormInstance } from 'antd/es/form'; import { Empty } from 'antd'; import { useIntl } from 'umi'; diff --git a/web/src/components/Upstream/UpstreamForm.tsx b/web/src/components/Upstream/UpstreamForm.tsx index 2d54f75562..7fade146cd 100644 --- a/web/src/components/Upstream/UpstreamForm.tsx +++ b/web/src/components/Upstream/UpstreamForm.tsx @@ -14,8 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, Col, Divider, Form, Input, InputNumber, Row, Select, Switch } from 'antd'; +import { Divider, Form, Switch } from 'antd'; import React, { useState, forwardRef, useImperativeHandle, useEffect } from 'react'; import { useIntl } from 'umi'; import type { FormInstance } from 'antd/es/form'; @@ -23,32 +22,15 @@ import type { FormInstance } from 'antd/es/form'; import { PanelSection } from '@api7-dashboard/ui'; import { transformRequest } from '@/pages/Upstream/transform'; import { DEFAULT_UPSTREAM } from './constant'; - -enum Type { - roundrobin = 'roundrobin', - chash = 'chash', - ewma = 'ewma', -} - -enum HashOn { - vars = 'vars', - header = 'header', - cookie = 'cookie', - consumer = 'consumer', -} - -enum HashKey { - remote_addr = 'remote_addr', - host = 'host', - uri = 'uri', - server_name = 'server_name', - server_addr = 'server_addr', - request_uri = 'request_uri', - query_string = 'query_string', - remote_port = 'remote_port', - hostname = 'hostname', - arg_id = 'arg_id', -} +import PassiveCheck from './components/passive-check'; +import ActiveCheck from './components/active-check' +import Nodes from './components/Nodes' +import Scheme from './components/Scheme'; +import Timeout from './components/Timeout'; +import Type from './components/Type'; +import UpstreamSelector from './components/UpstreamSelector'; +import Retries from './components/Retries'; +import PassHost from './components/PassHost'; type Upstream = { name?: string; @@ -65,12 +47,6 @@ type Props = { required?: boolean; }; -const removeBtnStyle = { - marginLeft: 20, - display: 'flex', - alignItems: 'center', -}; - const UpstreamForm: React.FC = forwardRef( ({ form, disabled, list = [], showSelector, required = true }, ref) => { const { formatMessage } = useIntl(); @@ -130,487 +106,102 @@ const UpstreamForm: React.FC = forwardRef( setReadonly(Boolean(upstream_id) || disabled); }, [list]); - const CHash = () => ( - <> - - - - - - - - ); - const TimeUnit = () => s; - const NodeList = () => ( - - {(fields, { add, remove }) => ( - <> - - {fields.map((field, index) => ( - - - - - - - - - - - - - - - - - - {!readonly && ( - remove(field.name)} /> - )} - - - ))} - - {!readonly && ( - - - - )} - - )} - - ); const ActiveHealthCheck = () => ( - <> - - - - - - - - - - - - - - - - - - - - - - - + + + + + + {formatMessage({ id: 'page.upstream.step.healthyCheck.healthy.status' })} - - - - - - - - - - - + + + {formatMessage({ id: 'page.upstream.step.healthyCheck.unhealthyStatus' })} - - - - - - - - - - - - - {(fields, { add, remove }) => ( - <> - {fields.map((field, index) => ( - - - - - - - - - {!readonly && fields.length > 1 && ( - { - remove(field.name); - }} - /> - )} - - - - ))} - {!readonly && ( - - - - )} - - )} - - + + + + + + + Others + + + ); + const InActiveHealthCheck = () => ( - <> + + + {formatMessage({ id: 'page.upstream.step.healthyCheck.healthy.status' })} - - {(fields, { add, remove }) => ( - <> - - {fields.map((field, index) => ( - - - - - - - - {!readonly && ( - { - remove(field.name); - }} - /> - )} - - - ))} - - {!readonly && ( - - - - )} - - )} - - - - - - + + + {formatMessage({ id: 'page.upstream.step.healthyCheck.unhealthyStatus' })} - - {(fields, { add, remove }) => ( + + + + + + + ); + + const HealthCheckComponent = () => { + const options = [ + { + label: formatMessage({ id: 'page.upstream.step.healthyCheck.active' }), + name: ['checks', 'active'], + component: ( <> - - {fields.map((field, index) => ( - - - - - - - - {!readonly && fields.length > 1 && ( - { - remove(field.name); - }} - /> - )} - - - ))} - - {!readonly && ( - - - - )} + + - )} - - - - - - - , + }, + ] + + return ( + - - - - - - ); + {options.map(({ label, name, component }) => ( +
+ + + + + {() => { + if (form.getFieldValue(name)) { + return component; + } + return null; + }} + +
+ ))} + + ) + } + return (
= forwardRef( }} > {showSelector && ( - { setReadonly(Boolean(next.upstream_id)); if (prev.upstream_id !== next.upstream_id) { @@ -637,173 +229,32 @@ const UpstreamForm: React.FC = forwardRef( } return prev.upstream_id !== next.upstream_id; }} - > - - + }} + /> )} {!hiddenForm && ( - <> - - - - - {() => { - if (form.getFieldValue('type') === 'chash') { - return ; - } - return null; - }} - - {NodeList()} - - - - - - - + + + - { - return prev.pass_host !== next.pass_host; - }} - > - {() => { - if (form.getFieldValue('pass_host') === 'rewrite') { - return ( - - - - ); - } - return null; - }} - - - {timeoutFields.map(({ label, name, desc = '' }) => ( - - - - - - + + + + {timeoutFields.map((item, index) => ( + ))} - - {[ - { - label: formatMessage({ id: 'page.upstream.step.healthyCheck.active' }), - name: ['checks', 'active'], - component: ( - <> - - - - ), - }, - { - label: formatMessage({ id: 'page.upstream.step.healthyCheck.passive' }), - name: ['checks', 'passive'], - component: , - }, - ].map(({ label, name, component }) => ( -
- - - - - {() => { - if (form.getFieldValue(name)) { - return component; - } - return null; - }} - -
- ))} -
- + +
)}
); diff --git a/web/src/components/Upstream/components/Nodes.tsx b/web/src/components/Upstream/components/Nodes.tsx new file mode 100644 index 0000000000..2a92d48787 --- /dev/null +++ b/web/src/components/Upstream/components/Nodes.tsx @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Input, Row, Col, InputNumber, Button } from 'antd' +import { useIntl } from 'umi' +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' + +import { removeBtnStyle } from '..' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + {(fields, { add, remove }) => ( + <> + + {fields.map((field, index) => ( + + + + + + + + + + + + + + + + + + {!readonly && ( + remove(field.name)} /> + )} + + + ))} + + {!readonly && ( + + + + )} + + )} + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/PassHost.tsx b/web/src/components/Upstream/components/PassHost.tsx new file mode 100644 index 0000000000..6102076eb8 --- /dev/null +++ b/web/src/components/Upstream/components/PassHost.tsx @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Input, Select } from 'antd' +import { useIntl } from 'umi' +import type { FormInstance } from 'antd/lib/form' + +type Props = { + form: FormInstance + readonly?: boolean +} + +const Component: React.FC = ({ form, readonly }) => { + const { formatMessage } = useIntl() + + const options = [ + { + value: "pass", + label: formatMessage({ id: 'page.upstream.step.pass-host.pass' }) + }, { + value: "node", + label: formatMessage({ id: 'page.upstream.step.pass-host.node' }) + }, { + value: "rewrite", + label: formatMessage({ id: 'page.upstream.step.pass-host.rewrite' }), + disabled: true + } + ] + + return ( + + + + + { + return prev.pass_host !== next.pass_host; + }} + > + {() => { + if (form.getFieldValue('pass_host') === 'rewrite') { + return ( + + + + ); + } + return null; + }} + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/Retries.tsx b/web/src/components/Upstream/components/Retries.tsx new file mode 100644 index 0000000000..a77ecefce7 --- /dev/null +++ b/web/src/components/Upstream/components/Retries.tsx @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/Scheme.tsx b/web/src/components/Upstream/components/Scheme.tsx new file mode 100644 index 0000000000..840d5e6d55 --- /dev/null +++ b/web/src/components/Upstream/components/Scheme.tsx @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Select } from 'antd' +import { useIntl } from 'umi' + +const options = [ + { + label: "HTTP", + value: "http" + }, { + label: "HTTPs", + value: "https" + }, { + label: "gRPC", + value: "grpc" + }, { + label: "gRPCs", + value: "grpcs" + } +] + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/TimeUnit.tsx b/web/src/components/Upstream/components/TimeUnit.tsx new file mode 100644 index 0000000000..292c0cfe7a --- /dev/null +++ b/web/src/components/Upstream/components/TimeUnit.tsx @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' + +const TimeUnit = () => s; + +export default TimeUnit diff --git a/web/src/components/Upstream/components/Timeout.tsx b/web/src/components/Upstream/components/Timeout.tsx new file mode 100644 index 0000000000..059b63a5f9 --- /dev/null +++ b/web/src/components/Upstream/components/Timeout.tsx @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +import TimeUnit from './TimeUnit' + +const Component: React.FC<{ + label: string; + desc: string; + name: string[]; + readonly?: boolean; +}> = ({ label, desc, name, readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/Type.tsx b/web/src/components/Upstream/components/Type.tsx new file mode 100644 index 0000000000..0a7ce25306 --- /dev/null +++ b/web/src/components/Upstream/components/Type.tsx @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Select } from 'antd' +import { useIntl } from 'umi' +import type { FormInstance } from 'antd/es/form' + +enum Type { + roundrobin = 'roundrobin', + chash = 'chash', + ewma = 'ewma', + // TODO: new type + // least_conn = 'least_conn' +} + +enum HashOn { + vars = 'vars', + header = 'header', + cookie = 'cookie', + consumer = 'consumer', + // TODO: new hash_on key + // vars_combinations = 'vars_combinations' +} + +enum HashKey { + remote_addr = 'remote_addr', + host = 'host', + uri = 'uri', + server_name = 'server_name', + server_addr = 'server_addr', + request_uri = 'request_uri', + query_string = 'query_string', + remote_port = 'remote_port', + hostname = 'hostname', + arg_id = 'arg_id', +} + +type Props = { + readonly?: boolean + form: FormInstance +} + +const CHash: React.FC> = ({ readonly }) => ( + <> + + + + + + + +); + +const Component: React.FC = ({ readonly, form }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + {() => { + if (form.getFieldValue('type') === 'chash') { + return ; + } + return null; + }} + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/UpstreamSelector.tsx b/web/src/components/Upstream/components/UpstreamSelector.tsx new file mode 100644 index 0000000000..1f8b2254e9 --- /dev/null +++ b/web/src/components/Upstream/components/UpstreamSelector.tsx @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Select } from 'antd' +import { useIntl } from 'umi' + +type Upstream = { + name?: string; + id?: string; +}; + +type Props = { + list?: Upstream[]; + disabled?: boolean; + required?: boolean; + shouldUpdate: (prev: any, next: any) => void; + onChange: (id: string) => void +} + +const Component: React.FC = ({ shouldUpdate, onChange, list = [], disabled, required }) => { + const { formatMessage } = useIntl() + + return ( + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Healthy/Interval.tsx b/web/src/components/Upstream/components/active-check/Healthy/Interval.tsx new file mode 100644 index 0000000000..47ca56e2ba --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Healthy/Interval.tsx @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' +import TimeUnit from '../../TimeUnit' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Healthy/Successes.tsx b/web/src/components/Upstream/components/active-check/Healthy/Successes.tsx new file mode 100644 index 0000000000..84fbccfd45 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Healthy/Successes.tsx @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Form, InputNumber } from 'antd' +import React from 'react' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Healthy/index.ts b/web/src/components/Upstream/components/active-check/Healthy/index.ts new file mode 100644 index 0000000000..cef27c1d31 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Healthy/index.ts @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Interval from './Interval' +import Successes from './Successes' + +export default { + Interval, + Successes +} diff --git a/web/src/components/Upstream/components/active-check/Host.tsx b/web/src/components/Upstream/components/active-check/Host.tsx new file mode 100644 index 0000000000..871000b7f2 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Host.tsx @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Input } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/HttpPath.tsx b/web/src/components/Upstream/components/active-check/HttpPath.tsx new file mode 100644 index 0000000000..4914a49e3d --- /dev/null +++ b/web/src/components/Upstream/components/active-check/HttpPath.tsx @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Input } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Port.tsx b/web/src/components/Upstream/components/active-check/Port.tsx new file mode 100644 index 0000000000..3d04e0756b --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Port.tsx @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/ReqHeaders.tsx b/web/src/components/Upstream/components/active-check/ReqHeaders.tsx new file mode 100644 index 0000000000..25fb8d6c9e --- /dev/null +++ b/web/src/components/Upstream/components/active-check/ReqHeaders.tsx @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Row, Col, Input, Button } from 'antd' +import { useIntl } from 'umi' +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' + +import { removeBtnStyle } from '../../constant' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + {(fields, { add, remove }) => ( + <> + + {fields.map((field, index) => ( + + + + + + + + {!readonly && fields.length > 1 && ( + { + remove(field.name); + }} + /> + )} + + + ))} + + {!readonly && ( + + + + )} + + )} + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Timeout.tsx b/web/src/components/Upstream/components/active-check/Timeout.tsx new file mode 100644 index 0000000000..4d294b7d05 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Timeout.tsx @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' +import TimeUnit from '../TimeUnit' + +type Props = { + readonly?: boolean +} + +const ActiveCheckTimeoutComponent: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + + ) +} + +export default ActiveCheckTimeoutComponent diff --git a/web/src/components/Upstream/components/active-check/Type.tsx b/web/src/components/Upstream/components/active-check/Type.tsx new file mode 100644 index 0000000000..e8b95c63fd --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Type.tsx @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Select } from 'antd' + +type Props = { + readonly?: boolean +} + +const options = [ + { + label: "HTTP", + value: "http" + }, { + label: "HTTPs", + value: "https" + }, { + label: "TCP", + value: "tcp" + } +] + +const ActiveCheckTypeComponent: React.FC = ({ readonly }) => { + return ( + + + + ) +} + +export default ActiveCheckTypeComponent diff --git a/web/src/components/Upstream/components/active-check/Unhealthy/HttpFailures.tsx b/web/src/components/Upstream/components/active-check/Unhealthy/HttpFailures.tsx new file mode 100644 index 0000000000..dbd411827e --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Unhealthy/HttpFailures.tsx @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Form, InputNumber } from 'antd' +import React from 'react' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Unhealthy/HttpStatuses.tsx b/web/src/components/Upstream/components/active-check/Unhealthy/HttpStatuses.tsx new file mode 100644 index 0000000000..0cdad520f6 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Unhealthy/HttpStatuses.tsx @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Row, Col, Button, InputNumber } from 'antd' +import { useIntl } from 'umi' +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' + +import { removeBtnStyle } from '@/components/Upstream' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + {(fields, { add, remove }) => ( + <> + + {fields.map((field, index) => ( + + + + + + + + {!readonly && ( + { + remove(field.name); + }} + /> + )} + + + ))} + + {!readonly && ( + + + + )} + + )} + + ) +} +export default Component diff --git a/web/src/components/Upstream/components/active-check/Unhealthy/Interval.tsx b/web/src/components/Upstream/components/active-check/Unhealthy/Interval.tsx new file mode 100644 index 0000000000..8052808ed9 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Unhealthy/Interval.tsx @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +import TimeUnit from '../../TimeUnit' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Unhealthy/Timeouts.tsx b/web/src/components/Upstream/components/active-check/Unhealthy/Timeouts.tsx new file mode 100644 index 0000000000..2f5af5fb4f --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Unhealthy/Timeouts.tsx @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => ( + + + + + +) + +export default Component diff --git a/web/src/components/Upstream/components/active-check/Unhealthy/index.ts b/web/src/components/Upstream/components/active-check/Unhealthy/index.ts new file mode 100644 index 0000000000..bb9b86951a --- /dev/null +++ b/web/src/components/Upstream/components/active-check/Unhealthy/index.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Timeouts from './Timeouts' +import Interval from './Interval' +import HttpStatuses from './HttpStatuses' +import HttpFailures from './HttpFailures' + +export default { + Timeouts, + Interval, + HttpStatuses, + HttpFailures +} diff --git a/web/src/components/Upstream/components/active-check/index.ts b/web/src/components/Upstream/components/active-check/index.ts new file mode 100644 index 0000000000..efc3046091 --- /dev/null +++ b/web/src/components/Upstream/components/active-check/index.ts @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Unhealthy from './Unhealthy' +import Healthy from './Healthy' + +import Timeout from './Timeout' +import Type from './Type' +import ReqHeaders from './ReqHeaders' +import Host from './Host' +import Port from './Port' +import HttpPath from './HttpPath' + +export default { + Unhealthy, + Healthy, + Timeout, + Type, + ReqHeaders, + Host, + Port, + HttpPath +} diff --git a/web/src/components/Upstream/components/passive-check/Healthy/HttpStatuses.tsx b/web/src/components/Upstream/components/passive-check/Healthy/HttpStatuses.tsx new file mode 100644 index 0000000000..f1b06d2105 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Healthy/HttpStatuses.tsx @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Row, Col, InputNumber, Button } from 'antd' +import { useIntl } from 'umi' +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' + +import { removeBtnStyle } from '@/components/Upstream/constant' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + {(fields, { add, remove }) => ( + <> + + {fields.map((field, index) => ( + + + + + + + + {!readonly && ( + { + remove(field.name); + }} + /> + )} + + + ))} + + {!readonly && ( + + + + )} + + )} + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Healthy/Successes.tsx b/web/src/components/Upstream/components/passive-check/Healthy/Successes.tsx new file mode 100644 index 0000000000..2ee3590fab --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Healthy/Successes.tsx @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Healthy/index.ts b/web/src/components/Upstream/components/passive-check/Healthy/index.ts new file mode 100644 index 0000000000..737fbf4e9e --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Healthy/index.ts @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import HttpStatuses from './HttpStatuses' +import Successes from './Successes' + +export default { + HttpStatuses, + Successes +} diff --git a/web/src/components/Upstream/components/passive-check/Type.tsx b/web/src/components/Upstream/components/passive-check/Type.tsx new file mode 100644 index 0000000000..d3401eeb2c --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Type.tsx @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Select } from 'antd' + +type Props = { + readonly?: boolean +} + +const PassiveCheckTypeComponent: React.FC = ({ readonly }) => { + const options = [ + { + label: "HTTP", + value: "http" + }, { + label: "HTTPs", + value: "https" + }, { + label: "TCP", + value: "tcp" + } + ] + + return ( + + + + ) +} + +export default PassiveCheckTypeComponent diff --git a/web/src/components/Upstream/components/passive-check/Unhealthy/HttpFailures.tsx b/web/src/components/Upstream/components/passive-check/Unhealthy/HttpFailures.tsx new file mode 100644 index 0000000000..3ba6154f39 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Unhealthy/HttpFailures.tsx @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Unhealthy/HttpStatuses.tsx b/web/src/components/Upstream/components/passive-check/Unhealthy/HttpStatuses.tsx new file mode 100644 index 0000000000..ba9ba75e3a --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Unhealthy/HttpStatuses.tsx @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, Row, Col, InputNumber, Button } from 'antd' +import { useIntl } from 'umi' +import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' + +import { removeBtnStyle } from '@/components/Upstream/constant' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + {(fields, { add, remove }) => ( + <> + + {fields.map((field, index) => ( + + + + + + + + {!readonly && fields.length > 1 && ( + { + remove(field.name); + }} + /> + )} + + + ))} + + {!readonly && ( + + + + )} + + )} + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Unhealthy/TcpFailures.tsx b/web/src/components/Upstream/components/passive-check/Unhealthy/TcpFailures.tsx new file mode 100644 index 0000000000..175d22f776 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Unhealthy/TcpFailures.tsx @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' +import { useIntl } from 'umi' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => { + const { formatMessage } = useIntl() + return ( + + + + + + ) +} + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Unhealthy/Timeouts.tsx b/web/src/components/Upstream/components/passive-check/Unhealthy/Timeouts.tsx new file mode 100644 index 0000000000..91b7b4fe62 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Unhealthy/Timeouts.tsx @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react' +import { Form, InputNumber } from 'antd' + +type Props = { + readonly?: boolean +} + +const Component: React.FC = ({ readonly }) => ( + + + + + +) + +export default Component diff --git a/web/src/components/Upstream/components/passive-check/Unhealthy/index.ts b/web/src/components/Upstream/components/passive-check/Unhealthy/index.ts new file mode 100644 index 0000000000..88ab9c2275 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/Unhealthy/index.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Timeouts from './Timeouts' +import HttpFailures from './HttpFailures' +import TcpFailures from './TcpFailures' +import HttpStatuses from './HttpStatuses' + +export default { + Timeouts, + HttpFailures, + TcpFailures, + HttpStatuses +} diff --git a/web/src/components/Upstream/components/passive-check/index.ts b/web/src/components/Upstream/components/passive-check/index.ts new file mode 100644 index 0000000000..f0637fd910 --- /dev/null +++ b/web/src/components/Upstream/components/passive-check/index.ts @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Healthy from './Healthy' +import Unhealthy from './Unhealthy' +import Type from './Type' + +export default { + Healthy, + Unhealthy, + Type +} diff --git a/web/src/components/Upstream/constant.ts b/web/src/components/Upstream/constant.ts index 58d8ed52d5..d4f243bbe3 100644 --- a/web/src/components/Upstream/constant.ts +++ b/web/src/components/Upstream/constant.ts @@ -16,6 +16,8 @@ */ export const DEFAULT_UPSTREAM = { upstream_id: '', + // NOTE: the following fields are the default configurations + // https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L325 nodes: [ { host: '', @@ -23,42 +25,66 @@ export const DEFAULT_UPSTREAM = { weight: 1 } ], - type: 'roundrobin', + retries: 0, timeout: { connect: 6, send: 6, read: 6, }, - retries: 1 + type: 'roundrobin', + checks: {}, + scheme: "http", + pass_host: "pass", + name: "", + desc: "" }; // NOTE: checks.active +// https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L40 export const DEFAULT_HEALTH_CHECK_ACTIVE = { - timeout: 0, - http_path: '/', - host: '', + type: "http", + timeout: 1, + concurrency: 10, + host: "", port: 80, + http_path: "", + https_verify_certificate: true, healthy: { interval: 1, - successes: 1 + http_statuses: [200, 302], + successes: 2 }, unhealthy: { interval: 1, - http_failures: 1, - req_headers: [] - } + http_statuses: [429, 404, 500, 501, 502, 503, 504, 505], + http_failures: 5, + tcp_failures: 2, + timeouts: 3 + }, + req_headers: [] } // NOTE: checks.passive export const DEFAULT_HEALTH_CHECK_PASSIVE = { + type: "http", healthy: { - http_statuses: [], - successes: 1 + http_statuses: [ + 200, 201, 202, 203, 204, 205, 206, 207, + 208, 226, 300, 301, 302, 303, 304, 305, + 306, 307, 308 + ], + successes: 5 }, unhealthy: { - http_statuses: [], - tcp_failures: 1, - timeouts: 1, - http_failures: 1 + http_statuses: [429, 500, 503], + tcp_failures: 2, + timeouts: 7, + http_failures: 5 } } + +export const removeBtnStyle = { + marginLeft: 20, + display: 'flex', + alignItems: 'center', +}; diff --git a/web/src/pages/Route/locales/zh-CN.ts b/web/src/pages/Route/locales/zh-CN.ts index ca97132d45..5d8adda1ba 100644 --- a/web/src/pages/Route/locales/zh-CN.ts +++ b/web/src/pages/Route/locales/zh-CN.ts @@ -36,7 +36,7 @@ export default { 'page.route.status': '状态', 'page.route.groupName': '分组名称', 'page.route.offline': '下线', - 'page.route.publish': '是否发布', + 'page.route.publish': '发布', 'page.route.published': '已发布', 'page.route.unpublished': '未发布', 'page.route.onlineDebug': '在线调试', diff --git a/web/src/pages/Upstream/locales/en-US.ts b/web/src/pages/Upstream/locales/en-US.ts index a78a16260a..bc078e2450 100644 --- a/web/src/pages/Upstream/locales/en-US.ts +++ b/web/src/pages/Upstream/locales/en-US.ts @@ -32,7 +32,6 @@ export default { 'page.upstream.step.description': 'Description', 'page.upstream.step.input.description': 'Please enter upstream\'s description', 'page.upstream.step.type': 'Algorithm', - 'page.upstream.step.create.node': 'Add Target', 'page.upstream.step.pass-host': 'Hostname', 'page.upstream.step.pass-host.pass': 'Keep the same Host from client request', 'page.upstream.step.pass-host.node': 'Use the domain or IP from Node List', @@ -65,12 +64,10 @@ export default { 'page.upstream.step.healthyCheck.successes': 'Successes', 'page.upstream.step.input.healthyCheck.successes': 'Please enter successes', 'page.upstream.step.healthyCheck.http_failures': 'HTTP Failures', - 'page.upstream.step.healthyCheck.active.create.req_headers': 'Add Request Headers', 'page.upstream.step.input.healthyCheck.http_failures': 'Please enter http failures', 'page.upstream.step.healthyCheck.active.req_headers': 'Request Headers', 'page.upstream.step.input.healthyCheck.active.req_headers': 'Please enter request headers', 'page.upstream.step.healthyCheck.passive': 'Passive', - 'page.upstream.step.healthyCheck.passive.create.http_statuses': 'Add HTTP Status', 'page.upstream.step.healthyCheck.passive.http_statuses': 'HTTP Status', 'page.upstream.step.input.healthyCheck.passive.http_statuses': 'Please enter http status', 'page.upstream.step.healthyCheck.passive.tcp_failures': 'TCP Failures', @@ -120,5 +117,6 @@ export default { 'page.upstream.checks.passive.healthy.successes.description': 'Number of successes to consider a target healthy', 'page.upstream.checks.passive.unhealthy.http_statuses.description': 'Which HTTP statuses to consider a success', 'page.upstream.checks.passive.unhealthy.http_failures.description': 'Number of HTTP failures to consider a target unhealthy', - 'page.upstream.checks.passive.unhealthy.tcp_failures.description': 'Number of TCP failures to consider a target unhealthy' + 'page.upstream.checks.passive.unhealthy.tcp_failures.description': 'Number of TCP failures to consider a target unhealthy', + 'page.upstream.scheme': 'Scheme' }; diff --git a/web/src/pages/Upstream/locales/zh-CN.ts b/web/src/pages/Upstream/locales/zh-CN.ts index 3049b97cac..58620ba6bf 100644 --- a/web/src/pages/Upstream/locales/zh-CN.ts +++ b/web/src/pages/Upstream/locales/zh-CN.ts @@ -32,8 +32,7 @@ export default { 'page.upstream.step.description': '描述', 'page.upstream.step.input.description': '请输入上游服务的描述', 'page.upstream.step.type': '负载均衡算法', - 'page.upstream.step.create.node': '增加目标节点', - 'page.upstream.step.pass-host': 'Host 转换', + 'page.upstream.step.pass-host': 'Host 请求头', 'page.upstream.step.pass-host.pass': '保持与客户端请求一致的 Host 请求头', 'page.upstream.step.pass-host.node': '使用上游节点列表中的域名或 IP', 'page.upstream.step.pass-host.rewrite': '自定义 Host 请求头(即将废弃)', @@ -65,12 +64,10 @@ export default { 'page.upstream.step.healthyCheck.successes': '成功次数', 'page.upstream.step.input.healthyCheck.successes': '请输入成功次数', 'page.upstream.step.healthyCheck.http_failures': '失败次数', - 'page.upstream.step.healthyCheck.active.create.req_headers': '增加请求头', 'page.upstream.step.input.healthyCheck.http_failures': '请输入失败次数', 'page.upstream.step.healthyCheck.active.req_headers': '请求头', 'page.upstream.step.input.healthyCheck.active.req_headers': '请输入请求头', 'page.upstream.step.healthyCheck.passive': '被动检查', - 'page.upstream.step.healthyCheck.passive.create.http_statuses': '增加状态码', 'page.upstream.step.healthyCheck.passive.http_statuses': '状态码', 'page.upstream.step.input.healthyCheck.passive.http_statuses': '请输入状态码', 'page.upstream.step.healthyCheck.passive.tcp_failures': 'TCP 失败次数', @@ -120,5 +117,6 @@ export default { 'page.upstream.checks.passive.healthy.successes.description': '通过被动健康检查观察到的正常代理流量的成功次数。如果达到该值,上游服务目标节点将被视为健康。', 'page.upstream.checks.passive.unhealthy.http_statuses.description': '当被动健康检查的探针返回值是 HTTP 状态码列表的某一个值时,代表不健康状态是由代理流量产生的。', 'page.upstream.checks.passive.unhealthy.http_failures.description': '由被动健康检查所观察,代理流量中 HTTP 失败的次数。如果达到此值,则认为上游服务目标节点是不健康的。', - 'page.upstream.checks.passive.unhealthy.tcp_failures.description': '被动健康检查所观察到的代理流量中 TCP 失败的次数。如果达到此值,则认为上游服务目标节点是不健康的。' + 'page.upstream.checks.passive.unhealthy.tcp_failures.description': '被动健康检查所观察到的代理流量中 TCP 失败的次数。如果达到此值,则认为上游服务目标节点是不健康的。', + 'page.upstream.scheme': '协议' }; From 36f371f0e623b4a9963db7537f2c62058c27b85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=9A=E8=87=B4=E8=BF=9C?= Date: Mon, 12 Apr 2021 16:39:33 +0800 Subject: [PATCH 4/4] chore: added i18n for RawDataEditor & Plugin Drawer (#1747) --- web/src/components/Plugin/PluginDetail.tsx | 47 ++++++++++++------- web/src/components/Plugin/UI/plugin.tsx | 2 +- web/src/components/Plugin/locales/en-US.ts | 4 ++ web/src/components/Plugin/locales/zh-CN.ts | 4 ++ .../RawDataEditor/RawDataEditor.tsx | 28 +++++------ web/src/locales/en-US.ts | 2 + web/src/locales/en-US/component.ts | 1 + web/src/locales/en-US/other.ts | 19 ++++++++ web/src/locales/zh-CN.ts | 2 + web/src/locales/zh-CN/component.ts | 1 + web/src/locales/zh-CN/other.ts | 19 ++++++++ 11 files changed, 96 insertions(+), 33 deletions(-) create mode 100644 web/src/locales/en-US/other.ts create mode 100644 web/src/locales/zh-CN/other.ts diff --git a/web/src/components/Plugin/PluginDetail.tsx b/web/src/components/Plugin/PluginDetail.tsx index 8dbdfe8376..a807b2d719 100644 --- a/web/src/components/Plugin/PluginDetail.tsx +++ b/web/src/components/Plugin/PluginDetail.tsx @@ -27,6 +27,8 @@ import { Alert, Space, Popconfirm, + Tooltip, + Input, } from 'antd'; import { useIntl } from 'umi'; import CodeMirror from '@uiw/react-codemirror'; @@ -105,13 +107,13 @@ const PluginDetail: React.FC = ({ const [codeMirrorMode, setCodeMirrorMode] = useState( codeMirrorModeList.JSON, ); - const modeOptions = [ + const modeOptions: { label: string; value: string }[] = [ { label: codeMirrorModeList.JSON, value: codeMirrorModeList.JSON }, { label: codeMirrorModeList.YAML, value: codeMirrorModeList.YAML }, ]; if (PLUGIN_UI_LIST.includes(name)) { - modeOptions.push({ label: codeMirrorModeList.UIForm, value: codeMirrorModeList.UIForm }); + modeOptions.push({ label: formatMessage({ id: 'component.plugin.form' }), value: codeMirrorModeList.UIForm }); } useEffect(() => { @@ -247,7 +249,7 @@ const PluginDetail: React.FC = ({ return ( <> = ({ border: 1px solid rgb(235, 237, 240); margin-top:10px; } + .ant-input[disabled] { + color: #000; + } `}
+ + + = ({ {type === 'global' && ( )} @@ -338,11 +346,26 @@ const PluginDetail: React.FC = ({ title="" subTitle={ pluginType === 'auth' && schemaType !== 'consumer' && (codeMirrorMode !== codeMirrorModeList.UIForm) ? ( - + ) : null } ghost={false} extra={[ + , + + + , , - , - ]} /> diff --git a/web/src/components/Plugin/UI/plugin.tsx b/web/src/components/Plugin/UI/plugin.tsx index 620f98b4e4..eb2e7c22cc 100644 --- a/web/src/components/Plugin/UI/plugin.tsx +++ b/web/src/components/Plugin/UI/plugin.tsx @@ -33,7 +33,7 @@ export const PluginForm: React.FC = ({ name, renderForm, form }) => { const { formatMessage } = useIntl(); - if (!renderForm) { return }; + if (!renderForm) { return }; switch (name) { case 'basic-auth': diff --git a/web/src/components/Plugin/locales/en-US.ts b/web/src/components/Plugin/locales/en-US.ts index dc733d39fe..c7c1c04d8c 100644 --- a/web/src/components/Plugin/locales/en-US.ts +++ b/web/src/components/Plugin/locales/en-US.ts @@ -21,4 +21,8 @@ export default { 'component.step.select.pluginTemplate.select.option': 'Custom', 'component.plugin.pluginTemplate.tip1': '1. When a route already have plugins field configured, the plugins in the plugin template will be merged into it.', 'component.plugin.pluginTemplate.tip2': '2. The same plugin in the plugin template will override one in the plugins', + 'component.plugin.form': 'Form', + 'component.plugin.format-codes.disable': 'Format JSON or YAML data', + 'component.plugin.editor': 'Plugin Editor', + 'component.plugin.noConfigurationRequired': 'Doesn\'t need configuration', }; diff --git a/web/src/components/Plugin/locales/zh-CN.ts b/web/src/components/Plugin/locales/zh-CN.ts index f563a29330..d54dba1dcf 100644 --- a/web/src/components/Plugin/locales/zh-CN.ts +++ b/web/src/components/Plugin/locales/zh-CN.ts @@ -21,4 +21,8 @@ export default { 'component.step.select.pluginTemplate.select.option': '手动配置', 'component.plugin.pluginTemplate.tip1': '1. 若路由已配置插件,则插件模板数据将与已配置的插件数据合并。', 'component.plugin.pluginTemplate.tip2': '2. 插件模板相同的插件会覆盖掉原有的插件。', + 'component.plugin.form': '表单', + 'component.plugin.format-codes.disable': '用于格式化 JSON 或 YAML 内容', + 'component.plugin.editor': '插件配置', + 'component.plugin.noConfigurationRequired': '本插件无需配置', }; diff --git a/web/src/components/RawDataEditor/RawDataEditor.tsx b/web/src/components/RawDataEditor/RawDataEditor.tsx index 3117bd2e95..880d00b901 100644 --- a/web/src/components/RawDataEditor/RawDataEditor.tsx +++ b/web/src/components/RawDataEditor/RawDataEditor.tsx @@ -146,18 +146,6 @@ const RawDataEditor: React.FC = ({ visible, readonly = true, type, data = } - onClick={() => { - window.open( - `https://apisix.apache.org/docs/apisix/admin-api#${type}`, - ); - }} - key={1} - > - Document - , , , { if (!result) { @@ -182,9 +170,21 @@ const RawDataEditor: React.FC = ({ visible, readonly = true, type, data = }); }}> , + , ]} />