This is an automated email from the ASF dual-hosted git repository.
juzhiyuan 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 6d2445e fix: add rejected_msg field to limit-count plugin form (#2328)
6d2445e is described below
commit 6d2445e198892c47e4c91f8aa9d55723872ae00f
Author: oil欧呦 <[email protected]>
AuthorDate: Sun Feb 27 20:29:31 2022 +0800
fix: add rejected_msg field to limit-count plugin form (#2328)
---
.../route/create-route-with-limit-count-plugin-form.spec.js | 3 +++
web/src/components/Plugin/UI/limit-count.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-count-plugin-form.spec.js
b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
index e2a2ad4..1dad2aa 100644
---
a/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
+++
b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
@@ -35,6 +35,7 @@ context('Create and delete route with limit-count form', ()
=> {
redis_timeout: '#time_window',
key: '#key',
rejected_code: '#rejected_code',
+ rejected_msg: '#rejected_msg',
policy: '#policy',
group: '#group',
redis_host: '#redis_host',
@@ -52,6 +53,7 @@ context('Create and delete route with limit-count form', ()
=> {
submitSuccess: 'Submit Successfully',
port: '80',
weight: 1,
+ rejected_msg: 'Requests are too frequent, please try again later.',
redisClusterName: 'Please Enter redis_cluster_name',
redisClusterNode: 'Please Enter redis_cluster_node',
};
@@ -86,6 +88,7 @@ context('Create and delete route with limit-count form', ()
=> {
cy.get(selector.count).type(1);
cy.get(selector.time_window).type(1);
cy.get(selector.rejected_code).type(500);
+ cy.get(selector.rejected_msg).type(data.rejected_msg);
cy.get(selector.group).type('test_group');
cy.get(selector.drawer).within(() => {
cy.contains('Submit').click({
diff --git a/web/src/components/Plugin/UI/limit-count.tsx
b/web/src/components/Plugin/UI/limit-count.tsx
index 51ecd53..15eb595 100644
--- a/web/src/components/Plugin/UI/limit-count.tsx
+++ b/web/src/components/Plugin/UI/limit-count.tsx
@@ -306,6 +306,13 @@ const LimitCount: 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
initialValue={policy}
label="policy"
name="policy"
diff --git a/web/src/components/Plugin/locales/en-US.ts
b/web/src/components/Plugin/locales/en-US.ts
index c7cefd9..f87b8da 100644
--- a/web/src/components/Plugin/locales/en-US.ts
+++ b/web/src/components/Plugin/locales/en-US.ts
@@ -130,6 +130,8 @@ export default {
'component.pluginForm.limit-count.key.tooltip': 'The user specified key to
limit the count.',
'component.pluginForm.limit-count.rejected_code.tooltip':
'The HTTP status code returned when the request exceeds the threshold is
rejected, default 503.',
+ 'component.pluginForm.limit-count.rejected_msg.tooltip':
+ 'The response body returned when the request exceeds the threshold is
rejected.',
'component.pluginForm.limit-count.policy.tooltip':
'The rate-limiting policies to use for retrieving and incrementing the
limits. Available values are local(the counters will be stored locally
in-memory on the node) and redis(counters are stored on a Redis server and will
be shared across the nodes, usually use it to do the global speed limit) and
redis-cluster(the same function as redis, only use Redis cluster pattern).',
'component.pluginForm.limit-count.allow_degradation.tooltip':
diff --git a/web/src/components/Plugin/locales/zh-CN.ts
b/web/src/components/Plugin/locales/zh-CN.ts
index 77d8a1d..41ed113 100644
--- a/web/src/components/Plugin/locales/zh-CN.ts
+++ b/web/src/components/Plugin/locales/zh-CN.ts
@@ -122,6 +122,7 @@ export default {
'用来做请求计数的有效值。例如,可以使用主机名(或服务器区域)作为关键字,以便限制每个主机名规定时间内的请求次数。我们也可以使用客户端地址作为关键字,这样我们就可以避免单个客户端规定时间内多次的连接我们的服务。',
'component.pluginForm.limit-count.rejected_code.tooltip':
'当请求超过阈值被拒绝时,返回的 HTTP 状态码。',
+ 'component.pluginForm.limit-count.rejected_msg.tooltip':
'当请求超过阈值被拒绝时,返回的响应体。',
'component.pluginForm.limit-count.policy.tooltip':
'用于检索和增加限制的速率限制策略。可选的值有:local(计数器被以内存方式保存在节点本地,默认选项) 和 redis(计数器保存在 Redis
服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速);以及redis-cluster,跟 redis 功能一样,只是使用 redis 集群方式。',
'component.pluginForm.limit-count.allow_degradation.tooltip':