You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2021/04/18 00:27:29 UTC

[apisix-dashboard] 01/01: chore: remove Chinese * & update plugin type

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

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

commit 0af84c586ba8f7c6e95c707e05701f450a69e044
Author: juzhiyuan <ju...@apache.org>
AuthorDate: Sun Apr 18 08:27:01 2021 +0800

    chore: remove Chinese * & update plugin type
---
 web/src/components/Plugin/data.tsx                      | 17 ++++++++---------
 web/src/components/Plugin/locales/en-US.ts              |  1 -
 web/src/components/Plugin/locales/zh-CN.ts              |  1 -
 web/src/components/RightContent/AvatarDropdown.tsx      |  3 ---
 web/src/components/Upstream/UpstreamForm.tsx            |  2 --
 web/src/components/Upstream/components/TLS.tsx          |  4 ++--
 .../Upstream/components/passive-check/Type.tsx          |  4 ++--
 web/src/components/Upstream/locales/en-US.ts            |  2 ++
 web/src/components/Upstream/locales/zh-CN.ts            |  2 ++
 web/src/global.less                                     |  1 -
 web/src/helpers.tsx                                     |  3 ---
 web/src/pages/Route/components/Step1/MetaView.tsx       |  6 +++---
 web/src/pages/Route/locales/en-US.ts                    |  3 +++
 web/src/pages/Route/locales/zh-CN.ts                    |  3 +++
 web/src/pages/Upstream/Create.tsx                       |  3 +--
 web/src/pages/Upstream/locales/en-US.ts                 |  4 +++-
 web/src/pages/Upstream/locales/zh-CN.ts                 |  4 +++-
 web/src/typings.d.ts                                    |  1 -
 18 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/web/src/components/Plugin/data.tsx b/web/src/components/Plugin/data.tsx
index df119c1..2c2ea81 100644
--- a/web/src/components/Plugin/data.tsx
+++ b/web/src/components/Plugin/data.tsx
@@ -39,7 +39,6 @@ export enum PluginType {
   traffic = "traffic",
   serverless = "serverless",
   observability = "observability",
-  logging = "logging",
   other = "other"
 }
 
@@ -64,7 +63,7 @@ export const PLUGIN_LIST = {
     type: PluginType.authentication
   },
   "error-log-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "fault-injection": {
     type: PluginType.security
@@ -79,7 +78,7 @@ export const PLUGIN_LIST = {
     type: PluginType.other
   },
   "syslog": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "traffic-split": {
     type: PluginType.traffic
@@ -88,13 +87,13 @@ export const PLUGIN_LIST = {
     type: PluginType.authentication
   },
   "kafka-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "limit-conn": {
     type: PluginType.traffic
   },
   "udp-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "zipkin": {
     type: PluginType.observability
@@ -104,7 +103,7 @@ export const PLUGIN_LIST = {
     hidden: true
   },
   "log-rotate": {
-    type: PluginType.logging,
+    type: PluginType.observability,
     hidden: true
   },
   "serverless-pre-function": {
@@ -166,16 +165,16 @@ export const PLUGIN_LIST = {
     type: PluginType.other
   },
   "http-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "openid-connect": {
     type: PluginType.authentication
   },
   "sls-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "tcp-logger": {
-    type: PluginType.logging
+    type: PluginType.observability
   },
   "uri-blocker": {
     type: PluginType.security
diff --git a/web/src/components/Plugin/locales/en-US.ts b/web/src/components/Plugin/locales/en-US.ts
index 26fa357..216bb98 100644
--- a/web/src/components/Plugin/locales/en-US.ts
+++ b/web/src/components/Plugin/locales/en-US.ts
@@ -26,7 +26,6 @@ export default {
   'component.plugin.traffic': 'Traffic Control',
   'component.plugin.serverless': 'Serverless',
   'component.plugin.observability': 'Tracing & Metrics & Logging',
-  'component.plugin.logging': 'Logging',
   'component.plugin.other': 'Other',
 
   // cors
diff --git a/web/src/components/Plugin/locales/zh-CN.ts b/web/src/components/Plugin/locales/zh-CN.ts
index b88f6e8..957121b 100644
--- a/web/src/components/Plugin/locales/zh-CN.ts
+++ b/web/src/components/Plugin/locales/zh-CN.ts
@@ -26,7 +26,6 @@ export default {
   'component.plugin.traffic': '流量控制',
   'component.plugin.serverless': '无服务器架构',
   'component.plugin.observability': '可观测性',
-  'component.plugin.logging': '日志记录',
   'component.plugin.other': '其它',
 
   // cors
diff --git a/web/src/components/RightContent/AvatarDropdown.tsx b/web/src/components/RightContent/AvatarDropdown.tsx
index 2304f1c..9221a05 100644
--- a/web/src/components/RightContent/AvatarDropdown.tsx
+++ b/web/src/components/RightContent/AvatarDropdown.tsx
@@ -34,9 +34,6 @@ export type GlobalHeaderRightProps = {
   menu?: boolean;
 };
 
-/**
- * 退出登录,并且将当前的 url 保存
- */
 const settings = async () => {
   history.replace({
     pathname: '/settings',
diff --git a/web/src/components/Upstream/UpstreamForm.tsx b/web/src/components/Upstream/UpstreamForm.tsx
index 42d7144..87e16ad 100644
--- a/web/src/components/Upstream/UpstreamForm.tsx
+++ b/web/src/components/Upstream/UpstreamForm.tsx
@@ -96,8 +96,6 @@ const UpstreamForm: React.FC<Props> = forwardRef(
             const targetData = list.find((item) => item.id === upstream_id) as UpstreamComponent.ResponseData
             if (targetData) {
               form.setFieldsValue(transformUpstreamDataFromRequest(targetData));
-            } else {
-              // TODO: 提示 upstream_id 找不到想要的数据
             }
           });
         }
diff --git a/web/src/components/Upstream/components/TLS.tsx b/web/src/components/Upstream/components/TLS.tsx
index 2d4feee..bdc0103 100644
--- a/web/src/components/Upstream/components/TLS.tsx
+++ b/web/src/components/Upstream/components/TLS.tsx
@@ -69,7 +69,7 @@ const TLSComponent: React.FC<Props> = ({ form, readonly }) => {
                     required
                     rules={[{ required: true, message: "" }, { max: 64 * 1024 }, { min: 128 }]}
                   >
-                    <Input.TextArea disabled={readonly} minLength={128} maxLength={64 * 1024} rows={5} placeholder="请输入客户端证书" />
+                    <Input.TextArea disabled={readonly} minLength={128} maxLength={64 * 1024} rows={5} placeholder={formatMessage({id: 'component.upstream.fields.tls.client_cert.required'})} />
                   </Form.Item>
                   <Form.Item
                     label={formatMessage({ id: 'component.upstream.fields.tls.client_key' })}
@@ -77,7 +77,7 @@ const TLSComponent: React.FC<Props> = ({ form, readonly }) => {
                     required
                     rules={[{ required: true, message: "" }, { max: 64 * 1024 }, { min: 128 }]}
                   >
-                    <Input.TextArea disabled={readonly} minLength={128} maxLength={64 * 1024} rows={5} placeholder="请输入客户端私钥" />
+                    <Input.TextArea disabled={readonly} minLength={128} maxLength={64 * 1024} rows={5} placeholder={formatMessage({id: 'component.upstream.fields.tls.client_key.required'})} />
                   </Form.Item>
                 </React.Fragment>
               )
diff --git a/web/src/components/Upstream/components/passive-check/Type.tsx b/web/src/components/Upstream/components/passive-check/Type.tsx
index f43f445..eeab150 100644
--- a/web/src/components/Upstream/components/passive-check/Type.tsx
+++ b/web/src/components/Upstream/components/passive-check/Type.tsx
@@ -35,7 +35,7 @@ const options = [
   }
 ]
 
-const ActiveCheckTypeComponent: React.FC<Props> = ({ readonly }) => {
+const PassiveCheckTypeComponent: React.FC<Props> = ({ readonly }) => {
   const { formatMessage } = useIntl()
 
   return (
@@ -66,4 +66,4 @@ const ActiveCheckTypeComponent: React.FC<Props> = ({ readonly }) => {
   )
 }
 
-export default ActiveCheckTypeComponent
+export default PassiveCheckTypeComponent
diff --git a/web/src/components/Upstream/locales/en-US.ts b/web/src/components/Upstream/locales/en-US.ts
index 585fb66..5387087 100644
--- a/web/src/components/Upstream/locales/en-US.ts
+++ b/web/src/components/Upstream/locales/en-US.ts
@@ -16,7 +16,9 @@
  */
 export default {
   'component.upstream.fields.tls.client_key': 'Client Key',
+  'component.upstream.fields.tls.client_key.required': 'Please enter the client key',
   'component.upstream.fields.tls.client_cert': 'Client Cert',
+  'component.upstream.fields.tls.client_cert.required': 'Please enter the client cert',
 
   'component.upstream.fields.discovery_type': 'Discovery Type',
   'component.upstream.fields.discovery_type.tooltip': 'Discovery Type',
diff --git a/web/src/components/Upstream/locales/zh-CN.ts b/web/src/components/Upstream/locales/zh-CN.ts
index 62925e6..5f93dcd 100644
--- a/web/src/components/Upstream/locales/zh-CN.ts
+++ b/web/src/components/Upstream/locales/zh-CN.ts
@@ -16,7 +16,9 @@
  */
 export default {
   'component.upstream.fields.tls.client_key': '客户端私钥',
+  'component.upstream.fields.tls.client_key.required': '请输入客户端私钥',
   'component.upstream.fields.tls.client_cert': '客户端证书',
+  'component.upstream.fields.tls.client_cert.required': '请输入客户端证书',
 
   'component.upstream.fields.discovery_type': '服务发现类型',
   'component.upstream.fields.discovery_type.tooltip': '服务发现类型',
diff --git a/web/src/global.less b/web/src/global.less
index 3cf4ade..c8c8668 100644
--- a/web/src/global.less
+++ b/web/src/global.less
@@ -66,7 +66,6 @@ ol {
   }
 }
 
-// 兼容IE11
 @media screen and(-ms-high-contrast: active), (-ms-high-contrast: none) {
   body .ant-design-pro > .ant-layout {
     min-height: 100vh;
diff --git a/web/src/helpers.tsx b/web/src/helpers.tsx
index d1d7d4e..9d290b3 100644
--- a/web/src/helpers.tsx
+++ b/web/src/helpers.tsx
@@ -73,9 +73,6 @@ export const getMenuData = (): MenuDataItem[] => {
 
 export const isLoginPage = () => window.location.pathname.indexOf('/user/login') !== -1;
 
-/**
- * 异常处理程序
- */
 export const errorHandler = (error: { response: Response; data: any }): Promise<Response> => {
   const { response } = error;
   if (error && response && response.status) {
diff --git a/web/src/pages/Route/components/Step1/MetaView.tsx b/web/src/pages/Route/components/Step1/MetaView.tsx
index d691d8f..3326c0b 100644
--- a/web/src/pages/Route/components/Step1/MetaView.tsx
+++ b/web/src/pages/Route/components/Step1/MetaView.tsx
@@ -137,7 +137,7 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({ disabled, form, isEdit
   )
 
   const Description: React.FC = () => (
-    <Form.Item label={formatMessage({ id: 'component.global.description' })} tooltip="路由描述信息">
+    <Form.Item label={formatMessage({ id: 'component.global.description' })}>
       <Row>
         <Col span={10}>
           <Form.Item noStyle name="desc">
@@ -196,7 +196,7 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({ disabled, form, isEdit
     ]
 
     return (
-      <Form.Item label={formatMessage({ id: 'page.route.form.itemLabel.redirect' })} tooltip="redirect 插件">
+      <Form.Item label={formatMessage({ id: 'page.route.form.itemLabel.redirect' })} tooltip={formatMessage({ id: 'page.route.fields.custom.redirectOption.tooltip' })}>
         <Row>
           <Col span={5}>
             <Form.Item
@@ -285,7 +285,7 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({ disabled, form, isEdit
   )
 
   const ServiceSelector: React.FC = () => (
-    <Form.Item label={formatMessage({ id: 'page.route.service' })} tooltip="绑定服务(Service)对象,以便复用其中的配置。">
+    <Form.Item label={formatMessage({ id: 'page.route.service' })} tooltip={formatMessage({id: 'page.route.fields.service_id.tooltip'})}>
       <Row>
         <Col span={5}>
           <Form.Item noStyle name="service_id">
diff --git a/web/src/pages/Route/locales/en-US.ts b/web/src/pages/Route/locales/en-US.ts
index f42d348..a064e55 100644
--- a/web/src/pages/Route/locales/en-US.ts
+++ b/web/src/pages/Route/locales/en-US.ts
@@ -171,4 +171,7 @@ export default {
 
   'page.route.advanced-match.operator.sample.IN': 'Please enter an array, e.g ["1", "2"]',
   'page.route.advanced-match.operator.sample.~~': 'Please enter a regular expression, e.g [a-z]+',
+
+  'page.route.fields.custom.redirectOption.tooltip': 'This is related to redirect plugin',
+  'page.route.fields.service_id.tooltip': 'Bind Service object to reuse their configuration.'
 };
diff --git a/web/src/pages/Route/locales/zh-CN.ts b/web/src/pages/Route/locales/zh-CN.ts
index 04dac2d..7c672f9 100644
--- a/web/src/pages/Route/locales/zh-CN.ts
+++ b/web/src/pages/Route/locales/zh-CN.ts
@@ -170,4 +170,7 @@ export default {
 
   'page.route.advanced-match.operator.sample.IN': '请输入数组,示例:["1", "2"]',
   'page.route.advanced-match.operator.sample.~~': '请输入正则表达式,示例:[a-z]+',
+
+  'page.route.fields.custom.redirectOption.tooltip': '在此配置 redirect 插件',
+  'page.route.fields.service_id.tooltip': '绑定服务(Service)对象,以便复用其中的配置。'
 };
diff --git a/web/src/pages/Upstream/Create.tsx b/web/src/pages/Upstream/Create.tsx
index 993e20a..9ab672e 100644
--- a/web/src/pages/Upstream/Create.tsx
+++ b/web/src/pages/Upstream/Create.tsx
@@ -46,8 +46,7 @@ const Page: React.FC = (props) => {
     form1.validateFields().then(() => {
       const data = upstreamRef.current?.getData();
       if (!data) {
-        // TODO: i18n
-        notification.error({ message: '请检查配置' });
+        notification.error({ message: formatMessage({id: 'page.upstream.other.configuration.invalid'}) });
         return;
       }
 
diff --git a/web/src/pages/Upstream/locales/en-US.ts b/web/src/pages/Upstream/locales/en-US.ts
index 6786f17..7771c11 100644
--- a/web/src/pages/Upstream/locales/en-US.ts
+++ b/web/src/pages/Upstream/locales/en-US.ts
@@ -98,5 +98,7 @@ export default {
   'page.upstream.checks.passive.unhealthy.http_statuses.description': 'Which HTTP statuses to consider a success',
   'page.upstream.checks.passive.unhealthy.http_failures.description': 'Number of HTTP failures to consider a target unhealthy',
   'page.upstream.checks.passive.unhealthy.tcp_failures.description': 'Number of TCP failures to consider a target unhealthy',
-  'page.upstream.scheme': 'Scheme'
+  'page.upstream.scheme': 'Scheme',
+
+  'page.upstream.other.configuration.invalid': 'Please check the Upstream configuration'
 };
diff --git a/web/src/pages/Upstream/locales/zh-CN.ts b/web/src/pages/Upstream/locales/zh-CN.ts
index 7a0d648..d74b54b 100644
--- a/web/src/pages/Upstream/locales/zh-CN.ts
+++ b/web/src/pages/Upstream/locales/zh-CN.ts
@@ -98,5 +98,7 @@ export default {
   'page.upstream.checks.passive.unhealthy.http_statuses.description': '当被动健康检查的探针返回值是 HTTP 状态码列表的某一个值时,代表不健康状态是由代理流量产生的。',
   'page.upstream.checks.passive.unhealthy.http_failures.description': '由被动健康检查所观察,代理流量中 HTTP 失败的次数。如果达到此值,则认为上游服务目标节点是不健康的。',
   'page.upstream.checks.passive.unhealthy.tcp_failures.description': '被动健康检查所观察到的代理流量中 TCP 失败的次数。如果达到此值,则认为上游服务目标节点是不健康的。',
-  'page.upstream.scheme': '协议'
+  'page.upstream.scheme': '协议',
+
+  'page.upstream.other.configuration.invalid': '请检查上游配置'
 };
diff --git a/web/src/typings.d.ts b/web/src/typings.d.ts
index f48879e..48d483e 100644
--- a/web/src/typings.d.ts
+++ b/web/src/typings.d.ts
@@ -49,7 +49,6 @@ type Window = {
 declare let ga: Function;
 
 // preview.pro.ant.design only do not use in your production ;
-// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
 declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefined;
 
 declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;