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

fix(import routes): merge route when route have the same name #2330

Merged
merged 11 commits into from
Mar 22, 2022

Conversation

kevinw66
Copy link
Contributor

@kevinw66 kevinw66 commented Feb 19, 2022

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?

Please update this section with detailed description.

Related issues

fixes #2329

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2022

Codecov Report

Merging #2330 (694da8f) into master (03a6cc1) will decrease coverage by 3.02%.
The diff coverage is 59.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2330      +/-   ##
==========================================
- Coverage   68.10%   65.08%   -3.03%     
==========================================
  Files         127      188      +61     
  Lines        3374     7358    +3984     
  Branches      830      828       -2     
==========================================
+ Hits         2298     4789    +2491     
- Misses       1076     2279    +1203     
- Partials        0      290     +290     
Flag Coverage Δ
backend-e2e-test 37.38% <60.60%> (?)
backend-unit-test 48.73% <0.00%> (?)
frontend-e2e-test 68.57% <50.00%> (+0.46%) ⬆️

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

Impacted Files Coverage Δ
web/src/components/Plugin/UI/limit-req.tsx 100.00% <ø> (ø)
web/src/pages/Route/List.tsx 83.03% <50.00%> (+0.19%) ⬆️
api/internal/handler/data_loader/route_import.go 66.55% <56.52%> (ø)
api/internal/utils/utils.go 68.51% <62.50%> (ø)
api/internal/handler/data_loader/route_export.go 75.17% <100.00%> (ø)
...omponents/Upstream/components/UpstreamSelector.tsx 85.71% <0.00%> (-14.29%) ⬇️
web/src/components/Upstream/UpstreamForm.tsx 90.12% <0.00%> (-2.29%) ⬇️
web/src/pages/PluginTemplate/List.tsx 71.42% <0.00%> (-1.08%) ⬇️
web/src/pages/Service/List.tsx 94.11% <0.00%> (-0.76%) ⬇️
web/src/pages/Consumer/Create.tsx 82.69% <0.00%> (ø)
... and 70 more

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 fc62ca3...694da8f. Read the comment docs.

@bzp2010
Copy link
Contributor

bzp2010 commented Feb 20, 2022

Hi, I'm not sure if it's appropriate to merge based on name, as far as I understand it, ID should be the basis for merging, and sometimes even when there is overlapping content, no data should be merged.

@kevinw66
Copy link
Contributor Author

kevinw66 commented Feb 20, 2022

Hi, I'm not sure if it's appropriate to merge based on name, as far as I understand it, ID should be the basis for merging, and sometimes even when there is overlapping content, no data should be merged.

@bzp2010 When creating a new route, the name cannot be the same, or else it will throw an error.
So I merge routes based on name, Because duplicated name was treated as dirty data.

@zaunist
Copy link
Contributor

zaunist commented Feb 21, 2022

Hi, I'm not sure if it's appropriate to merge based on name, as far as I understand it, ID should be the basis for merging, and sometimes even when there is overlapping content, no data should be merged.

@bzp2010 When creating a new route, the name cannot be the same, or else it will throw an error. So I merge routes based on name, Because duplicated name was treated as dirty data.

Could we use based on ID ? I think ID is better.

@Baoyuantop
Copy link
Contributor

Agree with ID

@kevinw66
Copy link
Contributor Author

kevinw66 commented Feb 21, 2022

If we merge based on id, the bug described in issue cannot be fixed, the route with same name and different path value already assigned different id
unless we cache id with route name, and if we meet same route name, we use the same id.
but what's the different between this and merge directly with name ?

@jwrookie
Copy link
Contributor

If we merge based on id, the bug described in issue cannot be fixed, the route with same name and different path value already assigned different id unless we cache id with route name, and if we meet same route name, we use the same id. but what's the different between this and merge directly with name ?

I think both import and export should be done through ID

@kevinw66
Copy link
Contributor Author

@bzp2010 @zaunist @Baoyuantop What do you think?

@Baoyuantop
Copy link
Contributor

Hi @kevinw66, maybe we can discuss this with more people in the community mail list, here is the subscription method: https://apisix.apache.org/docs/general/community#get-help-from-mailing-list-recommended

@zaunist
Copy link
Contributor

zaunist commented Feb 28, 2022

Hi @kevinw66, maybe we can discuss this with more people in the community mail list, here is the subscription method: https://apisix.apache.org/docs/general/community#get-help-from-mailing-list-recommended

Agree. We need to discuss with others.

Copy link
Member

@nic-chen nic-chen left a comment

Choose a reason for hiding this comment

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

@kevinw66 hi
need some test cases for the change

@bzp2010 bzp2010 requested a review from nic-chen March 6, 2022 17:01
@nic-chen
Copy link
Member

nic-chen commented Mar 9, 2022

FE test failed. @Baoyuantop @guoqqqi @bzp2010 please help when you have time, thanks.

@guoqqqi
Copy link
Member

guoqqqi commented Mar 10, 2022

image
Hi, @kevinw66 looks like a new id field has been remove? We need to update the web/cypress/fixtures/export-route-dataset.json file

@kevinw66
Copy link
Contributor Author

image Hi, @kevinw66 looks like a new id field has been remove? We need to update the web/cypress/fixtures/export-route-dataset.json file

Is this id a fixed value?

@guoqqqi
Copy link
Member

guoqqqi commented Mar 10, 2022

As the ID is not a fixed value, we need to do some processing. We need to remove the id field from the fileContent.
https://github.com/apache/apisix-dashboard/blob/master/web/cypress/integration/route/import_export_route.spec.js#L134
If you need help please leave me a message 😄

@kevinw66
Copy link
Contributor Author

As the ID is not a fixed value, we need to do some processing. We need to remove the id field from the fileContent. https://github.com/apache/apisix-dashboard/blob/master/web/cypress/integration/route/import_export_route.spec.js#L134 If you need help please leave me a message 😄

Of course, It's hard for me to change frontend code 😢

@guoqqqi
Copy link
Member

guoqqqi commented Mar 11, 2022

cc @oil-oil can you help to fix the E2E error?

@nic-chen nic-chen requested review from bzp2010 and starsz March 14, 2022 03:05
@nic-chen nic-chen mentioned this pull request Mar 17, 2022
8 tasks
@bzp2010 bzp2010 merged commit a7e700a into apache:master Mar 22, 2022
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.

导入OpenAPI会切分多个URI路径
9 participants