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

feat(plugin): allowing referer-restriction to dynamically adapt to the BE rules #2001

Merged
merged 5 commits into from
Sep 22, 2021

Conversation

wmdmomo
Copy link
Contributor

@wmdmomo wmdmomo commented Jul 25, 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?

The PR will change the plugin under plugin/UI (referer-restriction), allowing referer-restriction to dynamically adapt to the back-end json rules.

Related issues

fix/resolve #1588

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

@netlify
Copy link

netlify bot commented Jul 25, 2021

✔️ Deploy Preview for apisix-dashboard ready!

🔨 Explore the source changes: d6e64f8

🔍 Inspect the deploy log: https://app.netlify.com/sites/apisix-dashboard/deploys/610fdaa37f45c00008fe6b1a

😎 Browse the preview: https://deploy-preview-2001--apisix-dashboard.netlify.app/

@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2021

Codecov Report

Merging #2001 (d6e64f8) into master (5a581d3) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2001      +/-   ##
==========================================
+ Coverage   65.69%   65.79%   +0.09%     
==========================================
  Files         121      121              
  Lines        3204     3207       +3     
  Branches      778      778              
==========================================
+ Hits         2105     2110       +5     
+ Misses       1099     1097       -2     
Flag Coverage Δ
frontend-e2e-test 65.79% <100.00%> (+0.09%) ⬆️

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

Impacted Files Coverage Δ
web/src/components/Plugin/UI/plugin.tsx 83.33% <100.00%> (ø)
...b/src/components/Plugin/UI/referer-restriction.tsx 72.22% <100.00%> (+5.55%) ⬆️
web/src/helpers.tsx 72.13% <0.00%> (+3.27%) ⬆️

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 5a581d3...d6e64f8. Read the comment docs.

Copy link
Member

@LiteSun LiteSun left a comment

Choose a reason for hiding this comment

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

LGTM

@LiteSun LiteSun changed the title feat(plugin): fix UI referer-restriction feat(plugin): allowing referer-restriction to dynamically adapt to the BE rules Jul 26, 2021
@liuxiran
Copy link
Contributor

Test cases are needed to ensure the feature worked properly

@LiteSun
Copy link
Member

LiteSun commented Aug 20, 2021

Test cases are needed to ensure the feature worked properly

When you have time, could you please help her with the steps of the test? @liuxiran

@liuxiran
Copy link
Contributor

Test cases are needed to ensure the feature worked properly

When you have time, could you please help her with the steps of the test? @liuxiran

Ok, after check the current test case about referer-restriction form, @wmdmomo can try to add test cases to https://github.com/apache/apisix-dashboard/blob/master/web/cypress/integration/route/create-route-with-referer-restriction-form.spec.js,

  1. enable referer-restriction plugin, check default white list item should be one, and there is no delete button behind it
  2. test the white list input validate rule: input apisix-dashboard_1.com should be passed, and input qq@ should be invalid,
  3. default bypass_missing is disabled
  4. add a white list item field, each of them should have delete button behind them.

thanks a lot

@liuxiran
Copy link
Contributor

liuxiran commented Sep 8, 2021

Hi @wmdmomo if you have any problem please let us know, thanks a lot

@wmdmomo
Copy link
Contributor Author

wmdmomo commented Sep 21, 2021

@liuxiran Sorry to reply now. The referer-restriction test case has been completed.

@bzp2010
Copy link
Contributor

bzp2010 commented Sep 21, 2021

@wmdmomo The code looks good to me. But please pay attention to the errors in CI.

@wmdmomo
Copy link
Contributor Author

wmdmomo commented Sep 22, 2021

@wmdmomo The code looks good to me. But please pay attention to the errors in CI.

@bzp2010 OK, thanks for your suggestion. The error in CI has been dealt with.

Copy link
Contributor

@bzp2010 bzp2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@bzp2010 bzp2010 merged commit e1130f4 into apache:master Sep 22, 2021
@bzp2010
Copy link
Contributor

bzp2010 commented Sep 22, 2021

@wmdmomo Thank you very much for your contribution. XD

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.

Optimize front-end validation of fields
6 participants