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 2020/12/20 06:45:52 UTC

[apisix-dashboard] branch master updated: feat: active check support custom port (#1078)

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 9ef4cd4  feat: active check support custom port (#1078)
9ef4cd4 is described below

commit 9ef4cd47c606974475e1a5690d51f4ce6c86216f
Author: guoqqqi <72...@users.noreply.github.com>
AuthorDate: Sun Dec 20 14:45:42 2020 +0800

    feat: active check support custom port (#1078)
    
    * feat: active check support custom port
    
    * fix: omit null value
    
    * Update web/src/pages/Upstream/locales/en-US.ts
    
    Co-authored-by: litesun <su...@apache.org>
    
    Co-authored-by: 琚致远 <ju...@apache.org>
    Co-authored-by: litesun <su...@apache.org>
---
 web/src/components/Upstream/UpstreamForm.tsx | 12 ++++++++++++
 web/src/pages/Upstream/locales/en-US.ts      |  2 ++
 web/src/pages/Upstream/locales/zh-CN.ts      |  2 ++
 web/src/pages/Upstream/transform.ts          |  8 +++++++-
 web/src/pages/Upstream/typing.d.ts           |  1 +
 5 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/web/src/components/Upstream/UpstreamForm.tsx b/web/src/components/Upstream/UpstreamForm.tsx
index 09241a5..1e4c196 100644
--- a/web/src/components/Upstream/UpstreamForm.tsx
+++ b/web/src/components/Upstream/UpstreamForm.tsx
@@ -246,6 +246,18 @@ const UpstreamForm: React.FC<Props> = forwardRef(
           </Form.Item>
         </Form.Item>
 
+        <Form.Item label={formatMessage({ id: 'upstream.step.healthy.checks.active.port' })}>
+          <Form.Item
+            name={['checks', 'active', 'port']}
+            noStyle
+          >
+            <InputNumber
+              placeholder={formatMessage({ id: 'upstream.step.input.healthy.checks.active.port' })}
+              disabled={readonly}
+            />
+          </Form.Item>
+        </Form.Item>
+
         <Form.Item
           label={formatMessage({ id: 'upstream.step.healthy.checks.active.http_path' })}
           required
diff --git a/web/src/pages/Upstream/locales/en-US.ts b/web/src/pages/Upstream/locales/en-US.ts
index 697ee11..d8e54b3 100644
--- a/web/src/pages/Upstream/locales/en-US.ts
+++ b/web/src/pages/Upstream/locales/en-US.ts
@@ -46,6 +46,8 @@ export default {
   'upstream.step.input.healthy.checks.active.timeout': 'Please input timeout',
   'upstream.step.healthy.checks.active.http_path': 'HttpPath',
   'upstream.step.input.healthy.checks.active.http_path': 'HttpPath',
+  'upstream.step.healthy.checks.active.port': "Port",
+  'upstream.step.input.healthy.checks.active.port': 'Please input port',
   'upstream.step.healthy.checks.active.host': 'Host',
   'upstream.step.input.healthy.checks.active.host': 'Please input Host',
   'upstream.step.healthy.checks.active.interval': 'Interval',
diff --git a/web/src/pages/Upstream/locales/zh-CN.ts b/web/src/pages/Upstream/locales/zh-CN.ts
index 36525b7..878036e 100644
--- a/web/src/pages/Upstream/locales/zh-CN.ts
+++ b/web/src/pages/Upstream/locales/zh-CN.ts
@@ -46,6 +46,8 @@ export default {
   'upstream.step.input.healthy.checks.active.timeout': '请输入超时时间',
   'upstream.step.healthy.checks.active.http_path': '路径',
   'upstream.step.input.healthy.checks.active.http_path': '请输入路径',
+  'upstream.step.healthy.checks.active.port': "端口",
+  'upstream.step.input.healthy.checks.active.port': '请输入端口',
   'upstream.step.healthy.checks.active.host': '域名',
   'upstream.step.input.healthy.checks.active.host': '请输入域名',
   'upstream.step.healthy.checks.active.interval': '间隔',
diff --git a/web/src/pages/Upstream/transform.ts b/web/src/pages/Upstream/transform.ts
index 172a96f..efe0f17 100644
--- a/web/src/pages/Upstream/transform.ts
+++ b/web/src/pages/Upstream/transform.ts
@@ -30,7 +30,13 @@ export const transformRequest = (
     upstream_host,
     upstream_id,
   } = data;
-  data.checks = pickBy(data.checks, identity);
+  data.checks = pickBy(data.checks || {}, identity);
+  if (data.checks.active) {
+    data.checks.active = pickBy(
+      data.checks.active,
+      identity,
+    ) as UpstreamModule.HealthCheck['active'];
+  }
 
   if (upstream_id) {
     return { upstream_id };
diff --git a/web/src/pages/Upstream/typing.d.ts b/web/src/pages/Upstream/typing.d.ts
index 120f1aa..3529ed8 100644
--- a/web/src/pages/Upstream/typing.d.ts
+++ b/web/src/pages/Upstream/typing.d.ts
@@ -34,6 +34,7 @@ declare namespace UpstreamModule {
         http_failures: number;
       };
       req_headers?: string[];
+      port?: number;
     };
     passive?: {
       healthy: {