This is an automated email from the ASF dual-hosted git repository.

bzp2010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 03a6cc1  fix: add rejected_msg field to limit-req plugin form (#2312)
03a6cc1 is described below

commit 03a6cc16bbe5d72d011bb007f063a45bd9ded2c0
Author: oil欧呦 <[email protected]>
AuthorDate: Thu Feb 17 11:17:18 2022 +0800

    fix: add rejected_msg field to limit-req plugin form (#2312)
---
 .../integration/route/create-route-with-limit-req-form.spec.js     | 3 +++
 web/src/components/Plugin/UI/limit-req.tsx                         | 7 +++++++
 web/src/components/Plugin/locales/en-US.ts                         | 2 ++
 web/src/components/Plugin/locales/zh-CN.ts                         | 1 +
 4 files changed, 13 insertions(+)

diff --git 
a/web/cypress/integration/route/create-route-with-limit-req-form.spec.js 
b/web/cypress/integration/route/create-route-with-limit-req-form.spec.js
index d8f8c22..a6fd8a5 100644
--- a/web/cypress/integration/route/create-route-with-limit-req-form.spec.js
+++ b/web/cypress/integration/route/create-route-with-limit-req-form.spec.js
@@ -34,6 +34,7 @@ context('Create and delete route with limit-req form', () => {
     rate: '#rate',
     burst: '#burst',
     key: '#key',
+    rejected_msg: '#rejected_msg',
   };
 
   const data = {
@@ -42,6 +43,7 @@ context('Create and delete route with limit-req form', () => {
     port: '80',
     weight: 1,
     key: 'remote_addr',
+    rejected_msg: 'Requests are too frequent, please try again later.',
   };
 
   beforeEach(() => {
@@ -92,6 +94,7 @@ context('Create and delete route with limit-req form', () => {
     cy.get(selector.rate).type(1);
     cy.get(selector.burst).type(0);
     cy.get(selector.key).type(data.key);
+    cy.get(selector.rejected_msg).type(data.rejected_msg);
     cy.get(selector.drawer).within(() => {
       cy.contains('Submit').click({
         force: true,
diff --git a/web/src/components/Plugin/UI/limit-req.tsx 
b/web/src/components/Plugin/UI/limit-req.tsx
index f055f6e..529340a 100644
--- a/web/src/components/Plugin/UI/limit-req.tsx
+++ b/web/src/components/Plugin/UI/limit-req.tsx
@@ -103,6 +103,13 @@ const LimitReq: React.FC<Props> = ({ form, schema }) => {
         />
       </Form.Item>
       <Form.Item
+        label="rejected_msg"
+        name="rejected_msg"
+        tooltip={formatMessage({ id: 
'component.pluginForm.limit-req.rejected_msg.tooltip' })}
+      >
+        <Input />
+      </Form.Item>
+      <Form.Item
         label="nodelay"
         name="nodelay"
         valuePropName="checked"
diff --git a/web/src/components/Plugin/locales/en-US.ts 
b/web/src/components/Plugin/locales/en-US.ts
index 1ec4b1b..365e5b3 100644
--- a/web/src/components/Plugin/locales/en-US.ts
+++ b/web/src/components/Plugin/locales/en-US.ts
@@ -111,6 +111,8 @@ export default {
   'component.pluginForm.limit-req.key.tooltip': 'The user specified key to 
limit the rate.',
   'component.pluginForm.limit-req.rejected_code.tooltip':
     'The HTTP status code returned when the request exceeds the threshold is 
rejected.',
+  'component.pluginForm.limit-req.rejected_msg.tooltip':
+    'The response body returned when the request exceeds the threshold is 
rejected.',
   'component.pluginForm.limit-req.nodelay.tooltip':
     'If nodelay flag is true, bursted requests will not get delayed',
 
diff --git a/web/src/components/Plugin/locales/zh-CN.ts 
b/web/src/components/Plugin/locales/zh-CN.ts
index 094af63..43f38c4 100644
--- a/web/src/components/Plugin/locales/zh-CN.ts
+++ b/web/src/components/Plugin/locales/zh-CN.ts
@@ -104,6 +104,7 @@ export default {
   'component.pluginForm.limit-req.key.tooltip': '用来做请求计数的依据',
   'component.pluginForm.limit-req.rejected_code.tooltip':
     '当请求超过阈值被拒绝时,返回的 HTTP 状态码。',
+  'component.pluginForm.limit-req.rejected_msg.tooltip': '当请求超过阈值被拒绝时,返回的响应体。',
   'component.pluginForm.limit-req.nodelay.tooltip': '开启后突发的请求不会延迟',
 
   'component.plugin.form': '表单',

Reply via email to