Skip to content

Commit

Permalink
feat: add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
LiteSun committed Apr 13, 2021
1 parent 9461c24 commit b722526
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web/src/components/Plugin/UI/limit-req.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const LimitReq: React.FC<Props> = ({ form }) => {
required: true,
message: `${formatMessage({ id: 'component.global.pleaseEnter' })} rate`
}]}
tooltip={formatMessage({ id: 'component.pluginForm.limit-req.rate.tooltip' })}
validateTrigger={['onChange', 'onBlur', 'onClick']}
>
<InputNumber min={1} required />
Expand All @@ -58,6 +59,7 @@ const LimitReq: React.FC<Props> = ({ form }) => {
required: true,
message: `${formatMessage({ id: 'component.global.pleaseEnter' })} burst`
}]}
tooltip={formatMessage({ id: 'component.pluginForm.limit-req.burst.tooltip' })}
validateTrigger={['onChange', 'onBlur', 'onClick']}
>
<InputNumber min={0} required />
Expand All @@ -69,6 +71,7 @@ const LimitReq: React.FC<Props> = ({ form }) => {
required: true,
message: `${formatMessage({ id: 'component.global.pleaseChoose' })} key`
}]}
tooltip={formatMessage({ id: 'component.pluginForm.limit-req.key.tooltip' })}
validateTrigger={['onChange', 'onBlur', 'onClick']}
>
<Select>
Expand All @@ -81,6 +84,7 @@ const LimitReq: React.FC<Props> = ({ form }) => {
label="rejected_code"
name="rejected_code"
initialValue={503}
tooltip={formatMessage({ id: 'component.pluginForm.limit-req.rejected_code.tooltip' })}
>
<InputNumber min={200} max={599} />
</Form.Item>
Expand Down
5 changes: 5 additions & 0 deletions web/src/components/Plugin/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default {
'component.pluginForm.limit-conn.default_conn_delay.tooltip': 'the latency seconds of request when concurrent requests exceeding conn but below (conn + burst).',
'component.pluginForm.limit-conn.key.tooltip': 'to limit the concurrency level.For example, one can use the host name (or server zone) as the key so that we limit concurrency per host name. Otherwise, we can also use the client address as the key so that we can avoid a single client from flooding our service with too many parallel connections or requests.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).',
'component.pluginForm.limit-conn.rejected_code.tooltip': 'returned when the request exceeds conn + burst will be rejected.',
// limit-req
'component.pluginForm.limit-req.rate.tooltip': 'The specified request rate (number per second) threshold. Requests exceeding this rate (and below burst) will get delayed to conform to the rate.',
'component.pluginForm.limit-req.burst.tooltip': 'The number of excessive requests per second allowed to be delayed. Requests exceeding this hard limit will get rejected immediately.',
'component.pluginForm.limit-req.key.tooltip': 'The user specified key to limit the rate, 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).',
'component.pluginForm.limit-req.rejected_code.tooltip': 'The HTTP status code returned when the request exceeds the threshold is rejected.',

'component.plugin.form': 'Form',
'component.plugin.format-codes.disable': 'Format JSON or YAML data',
Expand Down
5 changes: 5 additions & 0 deletions web/src/components/Plugin/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default {
'component.pluginForm.limit-conn.default_conn_delay.tooltip': '默认的典型连接(或请求)的处理延迟时间。',
'component.pluginForm.limit-conn.key.tooltip': '用户指定的限制并发级别的关键字,可以是客户端 IP 或服务端 IP。例如,可以使用主机名(或服务器区域)作为关键字,以便限制每个主机名的并发性。 否则,我们也可以使用客户端地址作为关键字,这样我们就可以避免单个客户端用太多的并行连接或请求淹没我们的服务。当前接受的 key 有:"remote_addr"(客户端 IP 地址), "server_addr"(服务端 IP 地址), 请求头中的"X-Forwarded-For" 或 "X-Real-IP", "consumer_name"(consumer 的 username)。',
'component.pluginForm.limit-conn.rejected_code.tooltip': '当请求超过 conn + burst 这个阈值时,返回的 HTTP 状态码。',
// limit-req
'component.pluginForm.limit-req.rate.tooltip': '指定的请求速率(以秒为单位),请求速率超过 rate 但没有超过 (rate + brust)的请求会被加上延时。',
'component.pluginForm.limit-req.burst.tooltip': '请求速率超过(rate + brust)的请求会被直接拒绝。',
'component.pluginForm.limit-req.key.tooltip': '用来做请求计数的依据,当前接受的 key 有:"remote_addr"(客户端IP地址), "server_addr"(服务端 IP 地址), 请求头中的"X-Forwarded-For" 或 "X-Real-IP","consumer_name"(consumer 的 username).',
'component.pluginForm.limit-req.rejected_code.tooltip': '当请求超过阈值被拒绝时,返回的 HTTP 状态码。',

'component.plugin.form': '表单',
'component.plugin.format-codes.disable': '用于格式化 JSON 或 YAML 内容',
Expand Down

0 comments on commit b722526

Please sign in to comment.