Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor upstream form module #1726

Merged
merged 24 commits into from
Apr 12, 2021

Conversation

juzhiyuan
Copy link
Member

@juzhiyuan juzhiyuan commented Apr 9, 2021

Please answer these questions before submitting a pull request, or your PR will get closed.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

  • make components smaller & clearer
  • added default values (will be resolved in a new PR)

Checklist:

  • 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?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@juzhiyuan
Copy link
Member Author

juzhiyuan commented Apr 9, 2021

Hi, I noticed that there have too many changes!

This is due to I separate the UpstreamForm 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

@juzhiyuan juzhiyuan marked this pull request as ready for review April 9, 2021 15:42
@juzhiyuan juzhiyuan changed the title chore: improve upstream module chore: refactor upstream form module Apr 9, 2021
@juzhiyuan
Copy link
Member Author

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

@codecov-io
Copy link

codecov-io commented Apr 10, 2021

Codecov Report

Merging #1726 (55d0c0e) into master (8b6080d) will decrease coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@            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%) ⬇️
backend-e2e-test-ginkgo 49.36% <ø> (+0.25%) ⬆️
backend-unit-test 52.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
api/internal/core/store/storehub.go 71.02% <0.00%> (-3.74%) ⬇️
api/internal/core/storage/etcd.go 47.27% <0.00%> (-3.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b6080d...55d0c0e. Read the comment docs.

@membphis
Copy link
Member

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

@juzhiyuan
Copy link
Member Author

juzhiyuan commented Apr 10, 2021

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

@imjoey
Copy link
Member

imjoey commented Apr 10, 2021

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

@juzhiyuan
Copy link
Member Author

juzhiyuan commented Apr 10, 2021

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

@juzhiyuan
Copy link
Member Author

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

retries: 1
type: 'roundrobin',
checks: {},
scheme: "http",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should keep same style "" or ' '.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will be formatted globally in a new PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@imjoey imjoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Thanks, @juzhiyuan.

@juzhiyuan
Copy link
Member Author

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.

@juzhiyuan juzhiyuan requested a review from Jaycean April 12, 2021 07:19
@juzhiyuan juzhiyuan merged commit eede893 into apache:master Apr 12, 2021
@juzhiyuan juzhiyuan deleted the juzhiyuan/feat-upstream-default branch April 12, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants