juzhiyuan commented on a change in pull request #489:
URL: https://github.com/apache/apisix-dashboard/pull/489#discussion_r491769342



##########
File path: src/pages/Upstream/components/Step1.tsx
##########
@@ -43,9 +47,38 @@ const initialValues = {
     send: 6000,
     read: 6000,
   },
+  active: false,
+  passive: false,
+  checks: {
+    active: {
+      timeout: 5,
+      http_path: '',
+      host: '',
+      healthy: {
+        interval: 2,
+        successes: 1,
+      },
+      unhealthy: {
+        interval: 1,
+        http_failures: 2,
+      },
+      req_headers: [''],
+    },
+    passive: {
+      healthy: {
+        http_statuses: [undefined],

Review comment:
       could we use an empty array here?

##########
File path: src/pages/Upstream/components/Step1.tsx
##########
@@ -171,6 +204,390 @@ const Step1: React.FC<Props> = ({ form, disabled }) => {
 
   const renderTimeUnit = () => <span style={{ margin: '0 8px' }}>ms</span>;
 
+  function activeChange() {

Review comment:
       Also, for onChange handler, I would prefer using some name like 
`handleXXX`

##########
File path: src/pages/Upstream/components/Step1.tsx
##########
@@ -171,6 +204,390 @@ const Step1: React.FC<Props> = ({ form, disabled }) => {
 
   const renderTimeUnit = () => <span style={{ margin: '0 8px' }}>ms</span>;
 
+  function activeChange() {

Review comment:
       We'd better use `const fn = () => {}` to have a unified style :D

##########
File path: src/pages/Upstream/components/Step1.tsx
##########
@@ -171,6 +204,390 @@ const Step1: React.FC<Props> = ({ form, disabled }) => {
 
   const renderTimeUnit = () => <span style={{ margin: '0 8px' }}>ms</span>;
 
+  function activeChange() {
+    if (isActive) {
+      onChange(!isActive, false);
+      form.setFieldsValue({ ...form.getFieldsValue(), passive: false });
+      return;
+    }
+    onChange(!isActive, isPassive);
+    form.setFieldsValue({ ...form.getFieldsValue(), active: !isActive });
+  }
+  function passiveChange() {

Review comment:
       same here

##########
File path: src/pages/Upstream/components/Step1.tsx
##########
@@ -43,9 +47,38 @@ const initialValues = {
     send: 6000,
     read: 6000,
   },
+  active: false,
+  passive: false,
+  checks: {
+    active: {
+      timeout: 5,
+      http_path: '',
+      host: '',
+      healthy: {
+        interval: 2,
+        successes: 1,
+      },
+      unhealthy: {
+        interval: 1,
+        http_failures: 2,
+      },
+      req_headers: [''],
+    },
+    passive: {
+      healthy: {
+        http_statuses: [undefined],

Review comment:
       got it, thanks!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to