Skip to content

Commit

Permalink
chore: add validate trigger and correct tip message for limit-count
Browse files Browse the repository at this point in the history
  • Loading branch information
lixingwang committed Jul 27, 2021
1 parent 33c735e commit d062dc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web/src/components/Plugin/UI/limit-count.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const RedisClusterForm: React.FC = () => {
<Form.Item
label="redis_cluster_name"
name="redis_cluster_name"
validateTrigger={['onChange', 'onBlur', 'onClick']}
rules={[{ required: true, message: `${formatMessage({ id: 'component.global.pleaseEnter' })} redis_cluster_name` }]}
tooltip={formatMessage({ id: 'component.pluginForm.limit-count.redis_cluster_name.tooltip' })}
>
Expand All @@ -129,7 +130,7 @@ const RedisClusterForm: React.FC = () => {
{...field}
noStyle
validateTrigger={['onChange', 'onBlur', 'onClick']}
rules={[{ required: true, message: `${formatMessage({ id: 'component.global.pleaseEnter' })} redis_cluster_name` }, { min: 2, message: formatMessage({ id: 'component.pluginForm.limit-count.atLeast2Characters.rule' }) }]}
rules={[{ required: true, message: `${formatMessage({ id: 'component.global.pleaseEnter' })} redis_cluster_node` }, { min: 2, message: formatMessage({ id: 'component.pluginForm.limit-count.atLeast2Characters.rule' }) }]}
>
<Input />
</Form.Item>
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/Plugin/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ export default {
// limit-count
'component.pluginForm.limit-count.count.tooltip': 'The specified number of requests threshold.',
'component.pluginForm.limit-count.time_window.tooltip': 'The time window in seconds before the request count is reset.',
'component.pluginForm.limit-count.key.tooltip': 'The user specified key to limit the count.Now accept those as key: "remote_addr"(client\'s IP), "server_addr"(server\'s IP), "X-Forwarded-For/X-Real-IP" in request header, "consumer_name"(consumer\'s username) and "service_id".',
'component.pluginForm.limit-count.key.tooltip': 'The user specified key to limit the count, now accept those as key: "remote_addr"(client\'s IP), "server_addr"(server\'s IP), "X-Forwarded-For/X-Real-IP" in request header, "consumer_name"(consumer\'s username) and "service_id".',
'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.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).',
'component.pluginForm.limit-count.redis_host.tooltip': 'When using the redis policy, this property specifies the address of the Redis server.',
'component.pluginForm.limit-count.redis_port.tooltip': 'When using the redis policy, this property specifies the port of the Redis server.',
'component.pluginForm.limit-count.redis_password.tooltip': 'When using the redis policy, this property specifies the password of the Redis server.',
'component.pluginForm.limit-count.redis_database.tooltip': 'When using the redis policy, this property specifies the database you selected of the Redis server, and only for non Redis cluster mode (single instance mode or Redis public cloud service that provides single entry).',
'component.pluginForm.limit-count.redis_timeout.tooltip': 'When using the redis policy, this property specifies the timeout in milliseconds of any command submitted to the Redis server.',
'component.pluginForm.limit-count.redis_cluster_nodes.tooltip': 'When using redis-cluster policy,This property is a list of addresses of Redis cluster service nodes (at least two nodes).',
'component.pluginForm.limit-count.redis_cluster_nodes.tooltip': 'When using redis-cluster policy, this property is a list of addresses of Redis cluster service nodes (at least two nodes).',
'component.pluginForm.limit-count.redis_cluster_name.tooltip': 'When using redis-cluster policy, this property is the name of Redis cluster service nodes.',
'component.pluginForm.limit-count.atLeast2Characters.rule': 'Please enter at least 2 characters',
};

0 comments on commit d062dc4

Please sign in to comment.