You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/09 06:42:07 UTC

[GitHub] [apisix-dashboard] juzhiyuan opened a new pull request #1726: chore: improve upstream module

juzhiyuan opened a new pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726


   Please answer these questions before submitting a pull request, **or your PR will get closed**.
   
   **Why submit this pull request?**
   
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   **What changes will this PR take into?**
   
   - [x] make components smaller & clearer
   - [ ] added default values
   
   **Checklist:**
   
   - [x] Did you explain what problem does this PR solve? Or what new features have been added?
   - [ ] Have you added corresponding test cases? (**TODO**)
   - [ ] Have you modified the corresponding document?
   - [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (7309e4a) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f3c2b3a04a34df7c4e7e7817168a01484d3a974?el=desc) (5f3c2b3) will **decrease** coverage by `15.64%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1726       +/-   ##
   ===========================================
   - Coverage   67.90%   52.25%   -15.65%     
   ===========================================
     Files          47       38        -9     
     Lines        3128     2660      -468     
   ===========================================
   - Hits         2124     1390      -734     
   - Misses        760     1082      +322     
   + Partials      244      188       -56     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `52.25% <ø> (-0.04%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-75.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-67.29%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/handler.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `42.59% <0.00%> (-35.19%)` | :arrow_down: |
   | [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `66.66% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | ... and [33 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [5f3c2b3...7309e4a](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (55d0c0e) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/8b6080d2fc87bb5936650a647b67e1480745721a?el=desc) (8b6080d) will **decrease** coverage by `0.25%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1726      +/-   ##
   ==========================================
   - Coverage   71.86%   71.61%   -0.26%     
   ==========================================
     Files          47       47              
     Lines        3128     3128              
   ==========================================
   - Hits         2248     2240       -8     
   - Misses        638      645       +7     
   - Partials      242      243       +1     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `62.37% <ø> (-0.36%)` | :arrow_down: |
   | backend-e2e-test-ginkgo | `49.36% <ø> (+0.25%)` | :arrow_up: |
   | backend-unit-test | `52.29% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `71.02% <0.00%> (-3.74%)` | :arrow_down: |
   | [api/internal/core/storage/etcd.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmFnZS9ldGNkLmdv) | `47.27% <0.00%> (-3.64%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [8b6080d...55d0c0e](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#discussion_r611152722



##########
File path: web/src/components/Upstream/constant.ts
##########
@@ -16,49 +16,76 @@
  */
 export const DEFAULT_UPSTREAM = {
   upstream_id: '',
+  // NOTE: the following fields are the default configurations
+  // https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L325
   nodes: [
     {
       host: '',
       port: 80,
       weight: 1
     }
   ],
-  type: 'roundrobin',
+  retries: 0,
   timeout: {
+    // TODO: > 0
     connect: 6,
     send: 6,
     read: 6,
   },
-  retries: 1
+  type: 'roundrobin',
+  checks: {},
+  scheme: "http",

Review comment:
       https://github.com/apache/apisix-dashboard/issues/1746




-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1726: chore: improve upstream module

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-816772167


   Hi, I noticed that there have **too many changes!**
   
   This is due to I separate the [UpstreamForm](https://github.com/apache/apisix-dashboard/blob/master/web/src/components/Upstream/UpstreamForm.tsx) file (more than 813 lines) into some sub-components, to make this module more clear for developers.
   
   According to the schema_def file: https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L114 , I structured the components according to fields style. e.g `active.host` -> `<ActiveCheck.Host />`.
   
   ![image](https://user-images.githubusercontent.com/2106987/114205553-fb913200-998c-11eb-9d55-fdfdbb949ee2.png)


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] imjoey commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
imjoey commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817145111


   @juzhiyuan the adjustment is OK on me side which makes the code structure much more intuitive and easier for maintenance.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#discussion_r611149470



##########
File path: web/src/components/Upstream/constant.ts
##########
@@ -16,49 +16,76 @@
  */
 export const DEFAULT_UPSTREAM = {
   upstream_id: '',
+  // NOTE: the following fields are the default configurations
+  // https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L325
   nodes: [
     {
       host: '',
       port: 80,
       weight: 1
     }
   ],
-  type: 'roundrobin',
+  retries: 0,
   timeout: {
+    // TODO: > 0

Review comment:
       Need more details.




-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#discussion_r611149939



##########
File path: web/src/components/Upstream/UpstreamForm.tsx
##########
@@ -130,487 +106,110 @@ const UpstreamForm: React.FC<Props> = forwardRef(
       setReadonly(Boolean(upstream_id) || disabled);
     }, [list]);
 
-    const CHash = () => (
-      <>
-        <Form.Item label="Hash On" name="hash_on" rules={[{ required: true }]}>
-          <Select disabled={readonly}>
-            {Object.entries(HashOn).map(([label, value]) => (
-              <Select.Option value={value} key={value}>
-                {label}
-              </Select.Option>
-            ))}
-          </Select>
-        </Form.Item>
-        <Form.Item label="Key" name="key" rules={[{ required: true }]}>
-          <Select disabled={readonly}>
-            {Object.entries(HashKey).map(([label, value]) => (
-              <Select.Option value={value} key={value}>
-                {label}
-              </Select.Option>
-            ))}
-          </Select>
-        </Form.Item>
-      </>
-    );
 
-    const TimeUnit = () => <span style={{ margin: '0 8px' }}>s</span>;
-    const NodeList = () => (
-      <Form.List name="nodes">
-        {(fields, { add, remove }) => (
-          <>
-            <Form.Item label={formatMessage({ id: 'page.upstream.form.item-label.node.domain.or.ip' })}>
-              {fields.map((field, index) => (
-                <Row style={{ marginBottom: 10 }} gutter={16} key={index}>
-                  <Col span={5}>
-                    <Form.Item
-                      style={{ marginBottom: 0 }}
-                      name={[field.name, 'host']}
-                      rules={[
-                        {
-                          required: true,
-                          message: formatMessage({
-                            id: 'page.upstream.step.input.domain.name.or.ip',
-                          }),
-                        },
-                        {
-                          pattern: new RegExp(
-                            /(^([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])(\.(25[0-5]|1\d{2}|2[0-4]\d|[1-9]?\d)){3}$|^(?![0-9.]+$)([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+){0,}$)/,
-                            'g',
-                          ),
-                        },
-                      ]}
-                    >
-                      <Input
-                        placeholder={formatMessage({ id: 'page.upstream.step.domain.name.or.ip' })}
-                        disabled={readonly}
-                      />
-                    </Form.Item>
-                  </Col>
-                  <Col span={4}>
-                    <Form.Item
-                      style={{ marginBottom: 0 }}
-                      name={[field.name, 'port']}
-                      label={formatMessage({ id: 'page.upstream.step.port' })}
-                      rules={[
-                        {
-                          required: true,
-                          message: formatMessage({ id: 'page.upstream.step.input.port' }),
-                        },
-                      ]}
-                    >
-                      <InputNumber
-                        placeholder={formatMessage({ id: 'page.upstream.step.port' })}
-                        disabled={readonly}
-                        min={0}
-                        max={65535}
-                      />
-                    </Form.Item>
-                  </Col>
-                  <Col span={5}>
-                    <Form.Item
-                      style={{ marginBottom: 0 }}
-                      name={[field.name, 'weight']}
-                      label={formatMessage({ id: 'page.upstream.step.weight' })}
-                      rules={[
-                        {
-                          required: true,
-                          message: formatMessage({ id: 'page.upstream.step.input.weight' }),
-                        },
-                      ]}
-                    >
-                      <InputNumber
-                        placeholder={formatMessage({ id: 'page.upstream.step.weight' })}
-                        disabled={readonly}
-                        min={0}
-                        max={1000}
-                      />
-                    </Form.Item>
-                  </Col>
-                  <Col style={{ ...removeBtnStyle, marginLeft: -25 }}>
-                    {!readonly && (
-                      <MinusCircleOutlined onClick={() => remove(field.name)} />
-                    )}
-                  </Col>
-                </Row>
-              ))}
-            </Form.Item>
-            {!readonly && (
-              <Form.Item wrapperCol={{ offset: 3 }}>
-                <Button type="dashed" onClick={add}>
-                  <PlusOutlined />
-                  {formatMessage({ id: 'page.upstream.step.create.node' })}
-                </Button>
-              </Form.Item>
-            )}
-          </>
-        )}
-      </Form.List>
-    );
 
     const ActiveHealthCheck = () => (
-      <>
-        <Form.Item label={formatMessage({ id: 'page.upstream.step.healthyCheck.active.timeout' })} tooltip={formatMessage({ id: 'page.upstream.checks.active.timeout.description' })}>
-          <Form.Item name={['checks', 'active', 'timeout']} noStyle>
-            <InputNumber disabled={readonly} min={0} />
-          </Form.Item>
-          <TimeUnit />
-        </Form.Item>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.activeHost' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.active.host.description' })}
-        >
-          <Form.Item
-            style={{ marginBottom: 0 }}
-            name={['checks', 'active', 'host']}
-            rules={[
-              {
-                required: true,
-                message: formatMessage({ id: 'page.upstream.step.input.healthyCheck.activeHost' }),
-              },
-              {
-                pattern: new RegExp(
-                  /(^([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])(\.(25[0-5]|1\d{2}|2[0-4]\d|[1-9]?\d)){3}$|^(?![0-9.]+$)([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+){0,}$)/,
-                  'g',
-                ),
-                message: formatMessage({ id: 'page.upstream.step.domain.name.or.ip.rule' }),
-              },
-            ]}
-          >
-            <Input
-              placeholder={formatMessage({
-                id: 'page.upstream.step.input.healthyCheck.activeHost',
-              })}
-              disabled={readonly}
-            />
-          </Form.Item>
-        </Form.Item>
-
-        <Form.Item label={formatMessage({ id: 'page.upstream.step.healthyCheck.activePort' })}>
-          <Form.Item name={['checks', 'active', 'port']} noStyle>
-            <InputNumber
-              placeholder={formatMessage({
-                id: 'page.upstream.step.input.healthyCheck.activePort',
-              })}
-              disabled={readonly}
-              min={0}
-              max={65535}
-            />
-          </Form.Item>
-        </Form.Item>
-
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.active.http_path' })}
-          required
-          tooltip={formatMessage({
-            id: 'page.upstream.step.input.healthyCheck.active.http_path',
-          })}
-        >
-          <Form.Item
-            name={['checks', 'active', 'http_path']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({ id: 'page.upstream.checks.active.http_path.placeholder' }),
-              },
-            ]}
-          >
-            <Input
-              disabled={readonly}
-              placeholder={formatMessage({ id: 'page.upstream.checks.active.http_path.placeholder' })}
-            />
-          </Form.Item>
-        </Form.Item>
+      <React.Fragment>
+        <ActiveCheck.Type readonly={readonly} />
+        <ActiveCheck.Timeout readonly={readonly} />
+        {/* TODO: concurrency */}
+        <ActiveCheck.Host readonly={readonly} />
+        <ActiveCheck.Port readonly={readonly} />
+        <ActiveCheck.HttpPath readonly={readonly} />
+        {/* TODO: https_verify_certificate */}
 
         <Divider orientation="left" plain>
           {formatMessage({ id: 'page.upstream.step.healthyCheck.healthy.status' })}
         </Divider>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.activeInterval' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.active.healthy.interval.description' })}
-        >
-          <Form.Item
-            noStyle
-            style={{ marginBottom: 0 }}
-            name={['checks', 'active', 'healthy', 'interval']}
-            rules={[
-              {
-                required: true,
-                message: formatMessage({
-                  id: 'page.upstream.step.input.healthyCheck.activeInterval',
-                }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} />
-          </Form.Item>
-          <TimeUnit />
-        </Form.Item>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.successes' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.active.healthy.successes.description' })}
-        >
-          <Form.Item
-            name={['checks', 'active', 'healthy', 'successes']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({ id: 'page.upstream.step.input.healthyCheck.successes' }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} max={254} />
-          </Form.Item>
-        </Form.Item>
+
+        <ActiveCheck.Healthy.Interval readonly={readonly} />
+        {/* TODO: HTTP Statuses */}
+        <ActiveCheck.Healthy.Successes readonly={readonly} />
 
         <Divider orientation="left" plain>
           {formatMessage({ id: 'page.upstream.step.healthyCheck.unhealthyStatus' })}
         </Divider>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.activeInterval' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.active.unhealthy.interval.description' })}
-        >
-          <Form.Item
-            name={['checks', 'active', 'unhealthy', 'interval']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({
-                  id: 'page.upstream.step.input.healthyCheck.activeInterval',
-                }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} />
-          </Form.Item>
-          <TimeUnit />
-        </Form.Item>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.http_failures' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.active.unhealthy.http_failures.description' })}
-        >
-          <Form.Item
-            name={['checks', 'active', 'unhealthy', 'http_failures']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({
-                  id: 'page.upstream.step.input.healthyCheck.http_failures',
-                }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} max={254} />
-          </Form.Item>
-        </Form.Item>
-        <Form.List name={['checks', 'active', 'req_headers']}>
-          {(fields, { add, remove }) => (
-            <>
-              {fields.map((field, index) => (
-                <Form.Item
-                  key={field.key}
-                  label={
-                    index === 0 &&
-                    formatMessage({ id: 'page.upstream.step.healthyCheck.active.req_headers' })
-                  }
-                  wrapperCol={{ offset: index === 0 ? 0 : 3 }}
-                >
-                  <Row style={{ marginBottom: 10 }} gutter={16}>
-                    <Col span={10}>
-                      <Form.Item style={{ marginBottom: 0 }} name={[field.name]}>
-                        <Input
-                          placeholder={formatMessage({
-                            id: 'page.upstream.step.input.healthyCheck.active.req_headers',
-                          })}
-                          disabled={readonly}
-                        />
-                      </Form.Item>
-                    </Col>
-                    <Col style={removeBtnStyle}>
-                      {!readonly && fields.length > 1 && (
-                        <MinusCircleOutlined
-                          style={{ margin: '0 8px' }}
-                          onClick={() => {
-                            remove(field.name);
-                          }}
-                        />
-                      )}
-                    </Col>
-                  </Row>
-                </Form.Item>
-              ))}
-              {!readonly && (
-                <Form.Item wrapperCol={{ offset: 3 }}>
-                  <Button type="dashed" onClick={() => add()}>
-                    <PlusOutlined />
-                    {formatMessage({
-                      id: 'page.upstream.step.healthyCheck.active.create.req_headers',
-                    })}
-                  </Button>
-                </Form.Item>
-              )}
-            </>
-          )}
-        </Form.List>
-      </>
+
+        <ActiveCheck.Unhealthy.Timeouts readonly={readonly} />
+        <ActiveCheck.Unhealthy.Interval readonly={readonly} />
+        <ActiveCheck.Unhealthy.HttpStatuses readonly={readonly} />
+        <ActiveCheck.Unhealthy.HttpFailures readonly={readonly} />
+        {/* TODO: TCP Failures */}
+
+        <Divider orientation="left" plain>Others</Divider>
+
+        <ActiveCheck.ReqHeaders readonly={readonly} />
+      </React.Fragment>
     );
+
     const InActiveHealthCheck = () => (
-      <>
+      <React.Fragment>
+        <PassiveCheck.Type readonly={readonly} />
+
         <Divider orientation="left" plain>
           {formatMessage({ id: 'page.upstream.step.healthyCheck.healthy.status' })}
         </Divider>
-        <Form.List name={['checks', 'passive', 'healthy', 'http_statuses']}>
-          {(fields, { add, remove }) => (
-            <>
-              <Form.Item
-                required
-                label={formatMessage({ id: 'page.upstream.step.healthyCheck.passive.http_statuses' })}
-                tooltip={formatMessage({ id: 'page.upstream.checks.passive.healthy.http_statuses.description' })}
-              >
-                {fields.map((field, index) => (
-                  <Row style={{ marginBottom: 10 }} key={index}>
-                    <Col span={2}>
-                      <Form.Item style={{ marginBottom: 0 }} name={[field.name]}>
-                        <InputNumber disabled={readonly} min={200} max={599} />
-                      </Form.Item>
-                    </Col>
-                    <Col style={removeBtnStyle}>
-                      {!readonly && (
-                        <MinusCircleOutlined
-                          onClick={() => {
-                            remove(field.name);
-                          }}
-                        />
-                      )}
-                    </Col>
-                  </Row>
-                ))}
-              </Form.Item>
-              {!readonly && (
-                <Form.Item wrapperCol={{ offset: 3 }}>
-                  <Button type="dashed" onClick={() => add()}>
-                    <PlusOutlined />
-                    {formatMessage({
-                      id: 'page.upstream.step.healthyCheck.passive.create.http_statuses',
-                    })}
-                  </Button>
-                </Form.Item>
-              )}
-            </>
-          )}
-        </Form.List>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.successes' })}
-          tooltip={formatMessage({ id: 'page.upstream.checks.passive.healthy.successes.description' })}
-          required
-        >
-          <Form.Item
-            name={['checks', 'passive', 'healthy', 'successes']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({ id: 'page.upstream.step.input.healthyCheck.successes' }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} max={254} />
-          </Form.Item>
-        </Form.Item>
+
+        <PassiveCheck.Healthy.HttpStatuses readonly={readonly} />
+        <PassiveCheck.Healthy.Successes readonly={readonly} />
 
         <Divider orientation="left" plain>
           {formatMessage({ id: 'page.upstream.step.healthyCheck.unhealthyStatus' })}
         </Divider>
-        <Form.List name={['checks', 'passive', 'unhealthy', 'http_statuses']}>
-          {(fields, { add, remove }) => (
+
+        <PassiveCheck.Unhealthy.Timeouts readonly={readonly} />
+        <PassiveCheck.Unhealthy.TcpFailures readonly={readonly} />
+        <PassiveCheck.Unhealthy.HttpFailures readonly={readonly} />
+        <PassiveCheck.Unhealthy.HttpStatuses readonly={readonly} />
+      </React.Fragment>
+    );
+
+    const HealthCheckComponent = () => {
+      const options = [
+        {
+          label: formatMessage({ id: 'page.upstream.step.healthyCheck.active' }),
+          name: ['checks', 'active'],
+          component: (
             <>
-              <Form.Item
-                required
-                label={formatMessage({ id: 'page.upstream.step.healthyCheck.passive.http_statuses' })}
-                tooltip={formatMessage({ id: 'page.upstream.checks.passive.unhealthy.http_statuses.description' })}
-              >
-                {fields.map((field, index) => (
-                  <Row style={{ marginBottom: 10 }} key={index}>
-                    <Col span={2}>
-                      <Form.Item style={{ marginBottom: 0 }} name={[field.name]}>
-                        <InputNumber disabled={readonly} min={200} max={599} />
-                      </Form.Item>
-                    </Col>
-                    <Col style={removeBtnStyle}>
-                      {!readonly && fields.length > 1 && (
-                        <MinusCircleOutlined
-                          onClick={() => {
-                            remove(field.name);
-                          }}
-                        />
-                      )}
-                    </Col>
-                  </Row>
-                ))}
-              </Form.Item>
-              {!readonly && (
-                <Form.Item wrapperCol={{ offset: 3 }}>
-                  <Button type="dashed" onClick={() => add()}>
-                    <PlusOutlined />
-                    {formatMessage({
-                      id: 'page.upstream.step.healthyCheck.passive.create.http_statuses',
-                    })}
-                  </Button>
-                </Form.Item>
-              )}
+              <ActiveHealthCheck />
+              <Divider orientation="left" plain />
             </>
-          )}
-        </Form.List>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.http_failures' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.passive.unhealthy.http_failures.description' })}
-        >
-          <Form.Item
-            name={['checks', 'passive', 'unhealthy', 'http_failures']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({
-                  id: 'page.upstream.step.input.healthyCheck.http_failures',
-                }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} max={254} />
-          </Form.Item>
-        </Form.Item>
-        <Form.Item
-          label={formatMessage({ id: 'page.upstream.step.healthyCheck.passive.tcp_failures' })}
-          required
-          tooltip={formatMessage({ id: 'page.upstream.checks.passive.unhealthy.tcp_failures.description' })}
+          ),
+        },
+        {
+          label: formatMessage({ id: 'page.upstream.step.healthyCheck.passive' }),
+          name: ['checks', 'passive'],
+          component: <InActiveHealthCheck />,
+        },
+      ]
+
+      return (
+        <PanelSection
+          title={formatMessage({ id: 'page.upstream.step.healthyCheck.healthy.check' })}
         >
-          <Form.Item
-            name={['checks', 'passive', 'unhealthy', 'tcp_failures']}
-            noStyle
-            rules={[
-              {
-                required: true,
-                message: formatMessage({
-                  id: 'page.upstream.step.input.healthyCheck.passive.tcp_failures',
-                }),
-              },
-            ]}
-          >
-            <InputNumber disabled={readonly} min={1} max={254} />
-          </Form.Item>
-        </Form.Item>
-      </>
-    );
+          {options.map(({ label, name, component }) => (
+            <div key={label}>
+              <Form.Item label={label} name={name} valuePropName="checked" key={label}>
+                <Switch disabled={readonly} />
+              </Form.Item>
+              <Form.Item shouldUpdate noStyle>
+                {() => {
+                  if (form.getFieldValue(name)) {
+                    if (name.includes("active")) {
+                      // TODO: 避免默认值被覆盖

Review comment:
       remove chinese please.




-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1726: chore: improve upstream module

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-816772167


   Hi, I noticed that there have **too many changes!**
   
   ![image](https://user-images.githubusercontent.com/2106987/114205553-fb913200-998c-11eb-9d55-fdfdbb949ee2.png)
   
   This PR only separates the [UpstreamForm](https://github.com/apache/apisix-dashboard/blob/master/web/src/components/Upstream/UpstreamForm.tsx) file (more than 813 lines) into some sub-components.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817143031


   yes, also needs @imjoey @bzp2010 's opinion.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan merged pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726


   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817146376


   yes! And if we want to use the field like `active.host`, we just need to create a TSX file `./components/active-check/Host.tsx`, and use it `<ActiveCheck.Host />`. That's easier to use & read!
   
   BTW, backend CI failed due to `luarocks.org` is unstable today 🤔 @imjoey 


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817146579


   I'm honored to have this Component got structure updated :)


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (7309e4a) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f3c2b3a04a34df7c4e7e7817168a01484d3a974?el=desc) (5f3c2b3) will **increase** coverage by `1.51%`.
   > The diff coverage is `52.07%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1726      +/-   ##
   ==========================================
   + Coverage   67.90%   69.41%   +1.51%     
   ==========================================
     Files          47      159     +112     
     Lines        3128     5813    +2685     
     Branches        0      651     +651     
   ==========================================
   + Hits         2124     4035    +1911     
   - Misses        760     1524     +764     
   - Partials      244      254      +10     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `46.77% <ø> (?)` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `52.25% <ø> (-0.04%)` | :arrow_down: |
   | frontend-e2e-test | `72.40% <52.07%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `44.44% <ø> (ø)` | |
   | [...ts/Upstream/components/active-check/ReqHeaders.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1JlcUhlYWRlcnMudHN4) | `8.33% <8.33%> (ø)` | |
   | [...components/active-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1VuaGVhbHRoeS9IdHRwU3RhdHVzZXMudHN4) | `8.33% <8.33%> (ø)` | |
   | [.../components/passive-check/Healthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9IZWFsdGh5L0h0dHBTdGF0dXNlcy50c3g=) | `8.33% <8.33%> (ø)` | |
   | [...omponents/passive-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9VbmhlYWx0aHkvSHR0cFN0YXR1c2VzLnRzeA==) | `8.33% <8.33%> (ø)` | |
   | [...ponents/Upstream/components/passive-check/Type.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9UeXBlLnRzeA==) | `20.00% <20.00%> (ø)` | |
   | [...tream/components/active-check/Healthy/Interval.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvSW50ZXJ2YWwudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ream/components/active-check/Healthy/Successes.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvU3VjY2Vzc2VzLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | [...mponents/Upstream/components/active-check/Host.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hvc3QudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ents/Upstream/components/active-check/HttpPath.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0h0dHBQYXRoLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | ... and [155 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [5f3c2b3...7309e4a](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817143031


   yes, also needs @imjoey's opinion.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1726: chore: improve upstream module

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-816772167


   Hi, I noticed that there have **too many changes!**
   
   This is due to I separate the [UpstreamForm](https://github.com/apache/apisix-dashboard/blob/master/web/src/components/Upstream/UpstreamForm.tsx) file (more than 813 lines) into some sub-components, to make this module more clear for developers.
   
   ![image](https://user-images.githubusercontent.com/2106987/114205553-fb913200-998c-11eb-9d55-fdfdbb949ee2.png)


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (2b26e4d) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/8b6080d2fc87bb5936650a647b67e1480745721a?el=desc) (8b6080d) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1726   +/-   ##
   =======================================
     Coverage   52.29%   52.29%           
   =======================================
     Files          38       38           
     Lines        2660     2660           
   =======================================
     Hits         1391     1391           
     Misses       1081     1081           
     Partials      188      188           
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-unit-test | `52.29% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [8b6080d...2b26e4d](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817443686


   Hi @liuxiran, this PR needs your review :) You could review this one first, after issues you find (maybe) are resolved, I will add features for Upstream.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] membphis commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817118487


   this is a big PR, need @LiteSun @liuxiran to confirm first


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (7309e4a) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f3c2b3a04a34df7c4e7e7817168a01484d3a974?el=desc) (5f3c2b3) will **increase** coverage by `1.47%`.
   > The diff coverage is `52.07%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1726      +/-   ##
   ==========================================
   + Coverage   67.90%   69.37%   +1.47%     
   ==========================================
     Files          47      159     +112     
     Lines        3128     5813    +2685     
     Branches        0      651     +651     
   ==========================================
   + Hits         2124     4033    +1909     
   - Misses        760     1526     +766     
   - Partials      244      254      +10     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `46.77% <ø> (?)` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `52.25% <ø> (-0.04%)` | :arrow_down: |
   | frontend-e2e-test | `72.32% <52.07%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `44.44% <ø> (ø)` | |
   | [...ts/Upstream/components/active-check/ReqHeaders.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1JlcUhlYWRlcnMudHN4) | `8.33% <8.33%> (ø)` | |
   | [...components/active-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1VuaGVhbHRoeS9IdHRwU3RhdHVzZXMudHN4) | `8.33% <8.33%> (ø)` | |
   | [.../components/passive-check/Healthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9IZWFsdGh5L0h0dHBTdGF0dXNlcy50c3g=) | `8.33% <8.33%> (ø)` | |
   | [...omponents/passive-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9VbmhlYWx0aHkvSHR0cFN0YXR1c2VzLnRzeA==) | `8.33% <8.33%> (ø)` | |
   | [...ponents/Upstream/components/passive-check/Type.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9UeXBlLnRzeA==) | `20.00% <20.00%> (ø)` | |
   | [...tream/components/active-check/Healthy/Interval.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvSW50ZXJ2YWwudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ream/components/active-check/Healthy/Successes.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvU3VjY2Vzc2VzLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | [...mponents/Upstream/components/active-check/Host.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hvc3QudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ents/Upstream/components/active-check/HttpPath.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0h0dHBQYXRoLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | ... and [155 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [5f3c2b3...7309e4a](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#discussion_r611149644



##########
File path: web/src/components/Upstream/constant.ts
##########
@@ -16,49 +16,76 @@
  */
 export const DEFAULT_UPSTREAM = {
   upstream_id: '',
+  // NOTE: the following fields are the default configurations
+  // https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L325
   nodes: [
     {
       host: '',
       port: 80,
       weight: 1
     }
   ],
-  type: 'roundrobin',
+  retries: 0,
   timeout: {
+    // TODO: > 0
     connect: 6,
     send: 6,
     read: 6,
   },
-  retries: 1
+  type: 'roundrobin',
+  checks: {},
+  scheme: "http",

Review comment:
       should keep same style `""` or  `' '`.




-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (d24152d) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f3c2b3a04a34df7c4e7e7817168a01484d3a974?el=desc) (5f3c2b3) will **decrease** coverage by `15.60%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1726       +/-   ##
   ===========================================
   - Coverage   67.90%   52.29%   -15.61%     
   ===========================================
     Files          47       38        -9     
     Lines        3128     2660      -468     
   ===========================================
   - Hits         2124     1391      -733     
   - Misses        760     1081      +321     
   + Partials      244      188       -56     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `52.29% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-75.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-67.29%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/handler.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `42.59% <0.00%> (-35.19%)` | :arrow_down: |
   | [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `66.66% <0.00%> (-33.34%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | ... and [33 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [5f3c2b3...d24152d](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: improve upstream module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-816772167


   Hi, I noticed that there have too many changes!
   
   ![image](https://user-images.githubusercontent.com/2106987/114205553-fb913200-998c-11eb-9d55-fdfdbb949ee2.png)
   
   This PR only separates the [UpstreamForm](https://github.com/apache/apisix-dashboard/blob/master/web/src/components/Upstream/UpstreamForm.tsx) file (more than 813 lines) into some sub-components.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (7309e4a) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/5f3c2b3a04a34df7c4e7e7817168a01484d3a974?el=desc) (5f3c2b3) will **decrease** coverage by `5.56%`.
   > The diff coverage is `52.07%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1726      +/-   ##
   ==========================================
   - Coverage   67.90%   62.33%   -5.57%     
   ==========================================
     Files          47      150     +103     
     Lines        3128     5345    +2217     
     Branches        0      651     +651     
   ==========================================
   + Hits         2124     3332    +1208     
   - Misses        760     1825    +1065     
   + Partials      244      188      -56     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `52.25% <ø> (-0.04%)` | :arrow_down: |
   | frontend-e2e-test | `72.32% <52.07%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `44.44% <ø> (ø)` | |
   | [...ts/Upstream/components/active-check/ReqHeaders.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1JlcUhlYWRlcnMudHN4) | `8.33% <8.33%> (ø)` | |
   | [...components/active-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL1VuaGVhbHRoeS9IdHRwU3RhdHVzZXMudHN4) | `8.33% <8.33%> (ø)` | |
   | [.../components/passive-check/Healthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9IZWFsdGh5L0h0dHBTdGF0dXNlcy50c3g=) | `8.33% <8.33%> (ø)` | |
   | [...omponents/passive-check/Unhealthy/HttpStatuses.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9VbmhlYWx0aHkvSHR0cFN0YXR1c2VzLnRzeA==) | `8.33% <8.33%> (ø)` | |
   | [...ponents/Upstream/components/passive-check/Type.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvcGFzc2l2ZS1jaGVjay9UeXBlLnRzeA==) | `20.00% <20.00%> (ø)` | |
   | [...tream/components/active-check/Healthy/Interval.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvSW50ZXJ2YWwudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ream/components/active-check/Healthy/Successes.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hlYWx0aHkvU3VjY2Vzc2VzLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | [...mponents/Upstream/components/active-check/Host.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0hvc3QudHN4) | `33.33% <33.33%> (ø)` | |
   | [...ents/Upstream/components/active-check/HttpPath.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvYWN0aXZlLWNoZWNrL0h0dHBQYXRoLnRzeA==) | `33.33% <33.33%> (ø)` | |
   | ... and [175 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [5f3c2b3...7309e4a](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#discussion_r611151150



##########
File path: web/src/components/Upstream/constant.ts
##########
@@ -16,49 +16,76 @@
  */
 export const DEFAULT_UPSTREAM = {
   upstream_id: '',
+  // NOTE: the following fields are the default configurations
+  // https://github.com/apache/apisix/blob/master/apisix/schema_def.lua#L325
   nodes: [
     {
       host: '',
       port: 80,
       weight: 1
     }
   ],
-  type: 'roundrobin',
+  retries: 0,
   timeout: {
+    // TODO: > 0
     connect: 6,
     send: 6,
     read: 6,
   },
-  retries: 1
+  type: 'roundrobin',
+  checks: {},
+  scheme: "http",

Review comment:
       yes, will be formatted globally in a new PR.




-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817093592


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=h1) Report
   > Merging [#1726](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=desc) (55d0c0e) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/8b6080d2fc87bb5936650a647b67e1480745721a?el=desc) (8b6080d) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1726/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1726   +/-   ##
   =======================================
     Coverage   52.29%   52.29%           
   =======================================
     Files          38       38           
     Lines        2660     2660           
   =======================================
     Hits         1391     1391           
     Misses       1081     1081           
     Partials      188      188           
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-unit-test | `52.29% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=footer). Last update [8b6080d...55d0c0e](https://codecov.io/gh/apache/apisix-dashboard/pull/1726?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817146376


   yes! And if we want to use a filed like `active.host`, we just need to create a TSX file `./components/active-check/Host.tsx`, and use it `<ActiveCheck.Host />`. That's more easy to use & read!


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817048534


   This PR doesn't change logics, only adjust the structure so we could know more clear about this component. Test is under debugging.


-- 
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] imjoey edited a comment on pull request #1726: chore: refactor upstream form module

Posted by GitBox <gi...@apache.org>.
imjoey edited a comment on pull request #1726:
URL: https://github.com/apache/apisix-dashboard/pull/1726#issuecomment-817145111


   @juzhiyuan the adjustment is OK on my side which makes the code structure much more intuitive and easier for maintenance.


-- 
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:
users@infra.apache.org