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

IEP-1293: Add editable dropdowns for mirrors in Preferences #1053

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

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Sep 18, 2024

Description

Added editable dropdowns for mirrors in Preferences

Fixes # (IEP-1293)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Edit and Select the different mirrors in the preferences and see that they are respected when installing tools

Test Configuration:

  • ESP-IDF Version: any
  • OS (Windows,Linux and macOS): all

Checklist

  • PR Self Reviewed
  • Code Formatting
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Introduced region-specific URLs for Git assets and Python wheels, enhancing accessibility for users in different geographic locations.
    • Updated user interface for preferences, replacing text fields with dropdowns for easier selection of asset URLs.
  • Bug Fixes

    • Improved logic for retrieving and setting configuration values, ensuring valid selections and reducing input errors.
  • Chores

    • Updated environment variable settings to reference new constants for default values, improving configuration management.

Copy link

coderabbitai bot commented Sep 18, 2024

Walkthrough

The changes introduce new constants in the IDFCorePreferenceConstants.java file to provide region-specific URLs for Git assets and Python wheels, specifically for users in China. The user interface in EspresssifPreferencesPage.java has been updated to replace text fields with dropdowns for selecting these URLs. Additionally, the ToolsJob and AbstractToolsHandler classes have been modified to reference the new constants for environment variable defaults, ensuring a consistent configuration approach across the application.

Changes

File Change Summary
bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java Renamed existing constants for global URLs and added new constants for China-specific URLs for Git assets and Python wheels.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java Replaced Text fields with Combo dropdowns for configuring Git assets and Python wheel URLs, reflecting the new region-specific constants.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java Updated environment variable defaults in runCommand method to use new global constants for Git assets and Python wheels.
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java Modified retrieval of configuration values in runCommand method to reference new global constants for Git assets and Python wheels.

Possibly related PRs

  • IEP-1043: Allow the user to configure IDF_TOOLS_PATH #988: The changes in EspresssifPreferencesPage.java involve updates to the user interface for configuring Git assets and Python wheel URLs, which are directly related to the new constants added in IDFCorePreferenceConstants.java for region-specific URLs.

Suggested reviewers

  • alirana01
  • AndriiFilippov
  • kolipakakondal

Poem

🐇 In the land of code where changes bloom,
New paths for assets, dispelling the gloom.
Dropdowns now dance where text fields once lay,
For Git and Python, a brighter way!
Constants renewed, for regions they sing,
Hop along, friends, let the updates take wing! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ac7f36b and cec4f4c.

Files selected for processing (4)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (7 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (1 hunks)
Additional comments not posted (13)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java (4)

35-35: LGTM!

The addition of the new constant IDF_GITHUB_ASSETS_DEFAULT_CHINA is consistent with the PR objective to support different default asset URLs based on geographic regions. It provides a configuration option for users in China to access resources from a region-specific URL, potentially improving accessibility and performance.


38-38: LGTM!

The addition of the new constant PIP_EXTRA_INDEX_URL_DEFAULT_CHINA is consistent with the PR objective to support different default asset URLs based on geographic regions. It provides a configuration option for users in China to access resources from a region-specific URL, potentially improving accessibility and performance.


34-34: Verify the usage of the renamed constant IDF_GITHUB_ASSETS_DEFAULT_GLOBAL in the codebase.

The renaming of the constant from IDF_GITHUB_ASSETS_DEFAULT to IDF_GITHUB_ASSETS_DEFAULT_GLOBAL is consistent with the PR objective to support different default asset URLs based on geographic regions.

Please run the following script to verify that all usages of the constant have been updated:

Verification successful

Constant renaming verified and consistently implemented

The constant IDF_GITHUB_ASSETS_DEFAULT has been successfully renamed to IDF_GITHUB_ASSETS_DEFAULT_GLOBAL throughout the codebase. All references to the old constant have been updated, and the new constant is being used appropriately in relevant parts of the code, including preferences, tools, and update handlers.

The change is consistent with the PR objective to support different default asset URLs based on geographic regions, as evidenced by the presence of both GLOBAL and CHINA constants in the IDFCorePreferenceConstants class.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of the constant `IDF_GITHUB_ASSETS_DEFAULT` have been updated to `IDF_GITHUB_ASSETS_DEFAULT_GLOBAL`.

# Test: Search for the old constant name. Expect: No occurrences.
rg --type java $'IDF_GITHUB_ASSETS_DEFAULT\b'

Length of output: 47


Script:

#!/bin/bash
# Description: Verify the renaming of IDF_GITHUB_ASSETS_DEFAULT to IDF_GITHUB_ASSETS_DEFAULT_GLOBAL

# Test 1: Verify rg is working by searching for a known string
echo "Test 1: Verifying rg functionality"
rg --type java "public class"

# Test 2: Search for the new constant name
echo "Test 2: Searching for new constant name"
rg --type java "IDF_GITHUB_ASSETS_DEFAULT_GLOBAL"

# Test 3: Search for partial matches of the constant name
echo "Test 3: Searching for partial matches"
rg --type java "IDF_GITHUB_ASSETS_DEFAULT"

Length of output: 55277


37-37: Verify the usage of the renamed constant PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL in the codebase.

The renaming of the constant from PIP_EXTRA_INDEX_URL_DEFAULT to PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL is consistent with the PR objective to support different default asset URLs based on geographic regions.

Please run the following script to verify that all usages of the constant have been updated:

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (2)

153-153: Verify the impact of changing the default value for IDF_GITHUB_ASSETS.

The default value for IDF_GITHUB_ASSETS has been changed from IDF_GITHUB_ASSETS_DEFAULT to IDF_GITHUB_ASSETS_DEFAULT_GLOBAL. Please ensure that this change aligns with the intended behavior and doesn't introduce any unexpected side effects, especially in environments where the preference value is not explicitly set.


158-158: Verify the impact of changing the default value for PIP_EXTRA_INDEX_URL.

The default value for PIP_EXTRA_INDEX_URL has been changed from PIP_EXTRA_INDEX_URL_DEFAULT to PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL. Please ensure that this change aligns with the intended behavior and doesn't introduce any unexpected side effects, especially in environments where the preference value is not explicitly set.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java (5)

11-11: LGTM!

The import statement for the Combo class is necessary and correctly added.


43-44: LGTM!

The private instance variables gitAssetsCombo and pythonWheelCombo are declared correctly with appropriate naming conventions.


95-103: LGTM!

The initialization of the gitAssetsCombo and pythonWheelCombo combo boxes is implemented correctly. Using constants from IDFCorePreferenceConstants for the default values is a good practice, and selecting the first item by default provides a sensible initial value for the user.


109-110: LGTM!

The layout data for the gitAssetsCombo and pythonWheelCombo combo boxes is set correctly using GridData. The widthHint property ensures a minimum width for the combo boxes, improving the user interface.


134-150: LGTM!

The retrieval of values from the preference store for idfToolsPath, gitUrl, and pyWheelUrl is implemented correctly. Using default values when the stored values are empty ensures that the UI components always have a valid value. Setting the retrieved values as the text of the UI components allows the user to see the previously saved or default values.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsJob.java (2)

470-470: LGTM!

The change to use IDFCorePreferenceConstants.IDF_GITHUB_ASSETS_DEFAULT_GLOBAL as the default value for IDF_GITHUB_ASSETS environment variable looks good. It suggests a shift towards using a more globally scoped default value.


475-475: LGTM!

The change to use IDFCorePreferenceConstants.PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL as the default value for PIP_EXTRA_INDEX_URL environment variable looks good. It suggests a shift towards using a more globally scoped default value.


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>, please review it.
    -- 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 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.
    -- @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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
Collaborator Author

@alirana01 alirana01 left a comment

Choose a reason for hiding this comment

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

Self Review

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.

1 participant