apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.93k stars 10.19k forks source link

bugfix: fixed urls that missing the customized prefix such as '/apollo' #5138

Open xworks opened 1 month ago

xworks commented 1 month ago

What's the purpose of this PR

Fix bug while importing the configuration's file

Which issue(s) this PR fixes:

Fixes #5137

Brief changelog

Add the prefix path such as /apollo to those urls that were missed in apollo-portal

Follow this checklist to help us incorporate your contribution quickly and easily:

Summary by CodeRabbit

coderabbitai[bot] commented 1 month ago

Walkthrough

The changes entail updating URL constructions in various JavaScript files within the apollo-portal project to include a prefix path using AppUtil.prefixPath(). This enhancement ensures that all API requests are properly prefixed, aligning with the application's base path configuration, thereby resolving issues related to incorrect request URLs.

Changes

File Path Change Summary
.../ConfigExportController.js Updated URL constructions for config export and import using AppUtil.prefixPath().
.../import-namespace-modal-directive.js Updated URL in importNamespaceModalDirective to include prefix and additional path segments.
.../services/ClusterService.js, ExportService.js, NamespaceLockService.js Added AppUtil dependency and updated URL constructions to use AppUtil.prefixPath().

Assessment against linked issues

Objective Addressed Explanation
Add /apollo prefix to import configuration request URLs (#5137)

Poem

🐇 Oh hop and skip, the URLs fix,
With a prefix neat, no more tricks.
🌐 From paths that stray, we now refrain,
Apollo's links, they chain again.
🚀 To the stars, our code does leap,
In tidy bounds, the routes we keep.
🎉 Celebrate, for bugs we've chased,
With carrots sweet, this success we taste!


Recent Review Details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 3d14e6f974eb611e65dc9abe2d50ba5afbb2b6c9 and ae2ab02d26c1f41f0efe25e21380a8920e0e40e3.
Files selected for processing (6) * CHANGES.md (1 hunks) * apollo-portal/src/main/resources/static/scripts/controller/ConfigExportController.js (2 hunks) * apollo-portal/src/main/resources/static/scripts/directive/import-namespace-modal-directive.js (1 hunks) * apollo-portal/src/main/resources/static/scripts/services/ClusterService.js (1 hunks) * apollo-portal/src/main/resources/static/scripts/services/ExportService.js (1 hunks) * apollo-portal/src/main/resources/static/scripts/services/NamespaceLockService.js (1 hunks)
Files skipped from review as they are similar to previous changes (5) * apollo-portal/src/main/resources/static/scripts/controller/ConfigExportController.js * apollo-portal/src/main/resources/static/scripts/directive/import-namespace-modal-directive.js * apollo-portal/src/main/resources/static/scripts/services/ClusterService.js * apollo-portal/src/main/resources/static/scripts/services/ExportService.js * apollo-portal/src/main/resources/static/scripts/services/NamespaceLockService.js
Additional Context Used
LanguageTool (2)
CHANGES.md (2)
Near line 8: Possible spelling mistake found. Context: ...--------- * [Fix circular references on LdapAutoConfiguration](https://github.com/apolloconfig/apollo... --- Near line 10: Possible spelling mistake found. Context: ...at the length of private namespaces are mis-calculated](https://github.com/apolloconfig/apollo...
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
github-actions[bot] commented 1 month ago

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

shoothzj commented 1 month ago

How about use template strings to concatenate strings, and the same type of address prefixes can be put in a common method?

stale[bot] commented 3 weeks ago

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 14 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

nobodyiam commented 3 weeks ago

How about use template strings to concatenate strings, and the same type of address prefixes can be put in a common method?

This is a great suggestion. However, I think it would require a lot extra work. How about we merge this pr to fix the bug first?