juzhiyuan commented on a change in pull request #1732:
URL: https://github.com/apache/apisix-dashboard/pull/1732#discussion_r611145371



##########
File path: web/src/components/Plugin/UI/limit-req.tsx
##########
@@ -0,0 +1,77 @@
+/*
+ * 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 type { FormInstance } from 'antd/es/form';
+import { Form, InputNumber, Select } from 'antd';
+
+type Props = {
+  form: FormInstance;
+  ref?: any;
+};
+
+export const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 4,
+  },
+  wrapperCol: {
+    span: 8
+  },
+};
+
+const LimitReq: React.FC<Props> = ({ form }) => {
+  return (
+    <Form
+      form={form}
+      {...FORM_ITEM_LAYOUT}
+    >
+      <Form.Item
+        label="rate"
+        name="rate"
+        required
+      >
+        <InputNumber min={1} required></InputNumber>

Review comment:
       ```suggestion
           <InputNumber min={1} required />
   ```

##########
File path: web/src/components/Plugin/UI/limit-req.tsx
##########
@@ -0,0 +1,77 @@
+/*
+ * 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 type { FormInstance } from 'antd/es/form';
+import { Form, InputNumber, Select } from 'antd';
+
+type Props = {
+  form: FormInstance;
+  ref?: any;
+};
+
+export const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 4,
+  },
+  wrapperCol: {
+    span: 8
+  },
+};
+
+const LimitReq: React.FC<Props> = ({ form }) => {
+  return (
+    <Form
+      form={form}
+      {...FORM_ITEM_LAYOUT}
+    >
+      <Form.Item
+        label="rate"
+        name="rate"
+        required
+      >
+        <InputNumber min={1} required></InputNumber>
+      </Form.Item>
+      <Form.Item
+        label="burst"
+        name="burst"
+        required
+      >
+        <InputNumber min={0} required></InputNumber>
+      </Form.Item>
+      <Form.Item
+        label="key"
+        required
+        name="key"
+      >
+        <Select>
+          {["remote_addr", "server_addr", "http_x_real_ip", 
"http_x_forwarded_for", "consumer_name"].map(item => {
+            return <Select.Option value={item}>{item}</Select.Option>

Review comment:
       ```suggestion
               return <Select.Option value={item} 
key={item}>{item}</Select.Option>
   ```

##########
File path: web/src/components/Plugin/UI/limit-req.tsx
##########
@@ -0,0 +1,77 @@
+/*
+ * 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 type { FormInstance } from 'antd/es/form';
+import { Form, InputNumber, Select } from 'antd';
+
+type Props = {
+  form: FormInstance;
+  ref?: any;
+};
+
+export const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 4,
+  },
+  wrapperCol: {
+    span: 8
+  },
+};
+
+const LimitReq: React.FC<Props> = ({ form }) => {
+  return (
+    <Form
+      form={form}
+      {...FORM_ITEM_LAYOUT}
+    >
+      <Form.Item
+        label="rate"
+        name="rate"
+        required
+      >
+        <InputNumber min={1} required></InputNumber>
+      </Form.Item>
+      <Form.Item
+        label="burst"
+        name="burst"
+        required
+      >
+        <InputNumber min={0} required></InputNumber>

Review comment:
       ```suggestion
           <InputNumber min={0} required />
   ```

##########
File path: web/src/components/Plugin/UI/limit-req.tsx
##########
@@ -0,0 +1,77 @@
+/*
+ * 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 type { FormInstance } from 'antd/es/form';
+import { Form, InputNumber, Select } from 'antd';
+
+type Props = {
+  form: FormInstance;
+  ref?: any;
+};
+
+export const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 4,
+  },
+  wrapperCol: {
+    span: 8
+  },
+};
+
+const LimitReq: React.FC<Props> = ({ form }) => {
+  return (
+    <Form
+      form={form}
+      {...FORM_ITEM_LAYOUT}
+    >
+      <Form.Item
+        label="rate"
+        name="rate"
+        required
+      >
+        <InputNumber min={1} required></InputNumber>
+      </Form.Item>
+      <Form.Item
+        label="burst"
+        name="burst"
+        required
+      >
+        <InputNumber min={0} required></InputNumber>
+      </Form.Item>
+      <Form.Item
+        label="key"
+        required
+        name="key"
+      >
+        <Select>
+          {["remote_addr", "server_addr", "http_x_real_ip", 
"http_x_forwarded_for", "consumer_name"].map(item => {
+            return <Select.Option value={item}>{item}</Select.Option>
+          })}
+        </Select>
+      </Form.Item>
+      <Form.Item
+        label="rejected_code"
+        name="rejected_code"
+        initialValue={503}
+      >
+        <InputNumber min={200} max={599}></InputNumber>

Review comment:
       ```suggestion
           <InputNumber min={200} max={599} />
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to