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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xworks
Copy link

@xworks xworks commented May 4, 2024

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:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

Summary by CodeRabbit

  • New Features

    • Enhanced URL construction across various services for configuration export, import, and namespace management to ensure consistency and reliability in different environments.
  • Refactor

    • Integrated AppUtil prefix path method across multiple services to standardize URL generation and improve maintainability.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 4, 2024
Copy link

coderabbitai bot commented May 4, 2024

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 3d14e6f and ae2ab02.
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
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented May 4, 2024

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

CHANGES.md Outdated Show resolved Hide resolved
shoothzj
shoothzj previously approved these changes May 4, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 4, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Out of diff range and nitpick comments (1)
CHANGES.md (1)

Line range hint 1-1: Add a blank line after "Release Notes." for proper Markdown formatting.

  Release Notes.
+
  Apollo 2.3.0

@@ -11,6 +11,6 @@ Apollo 2.3.0
* [apollo assembly optimization](https://github.com/apolloconfig/apollo/pull/5035)
* [update the config item table column width](https://github.com/apolloconfig/apollo/pull/5131)
* [sync apollo portal server config to apollo quick start server](https://github.com/apolloconfig/apollo/pull/5134)

* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
Copy link

Choose a reason for hiding this comment

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

Capitalize "URLs" for consistency.

- * [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
+ * [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)

Comment on lines 13 to 15
* [sync apollo portal server config to apollo quick start server](https://github.com/apolloconfig/apollo/pull/5134)

* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
------------------
Copy link

Choose a reason for hiding this comment

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

Add blank lines around the list of changes for proper Markdown formatting.

  * [sync apollo portal server config to apollo quick start server](https://github.com/apolloconfig/apollo/pull/5134)
+
  * [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
+
  ------------------

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
* [sync apollo portal server config to apollo quick start server](https://github.com/apolloconfig/apollo/pull/5134)
* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
------------------
* [sync apollo portal server config to apollo quick start server](https://github.com/apolloconfig/apollo/pull/5134)
* [Fix missing **prefix path** of some URLs in Apollo Portal](https://github.com/apolloconfig/apollo/pull/5138)
------------------

@shoothzj
Copy link
Member

shoothzj commented May 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
2 participants