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

Update installer to organize packages by categories #672

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sara-rn
Copy link
Contributor

@sara-rn sara-rn commented Mar 14, 2025

Update installer so that after the initial form to set up the environmental variables a new window displays all the packages grouped by category.

  • The packages from config.xml need to be selected by default.
  • The option to select all the packages from a specific category, for example if the category is a checkbox, doesn't work well as the checkboxes need to be generated dynamically. Currently each category is displayed in a label.

Closes #578

@sara-rn sara-rn self-assigned this Mar 14, 2025
@sara-rn sara-rn marked this pull request as draft March 14, 2025 17:51
@sara-rn sara-rn force-pushed the update-installer-categories branch 2 times, most recently from 65d91a5 to f316eb6 Compare March 14, 2025 18:03
@Ana06 Ana06 added the 💎 enhancement It is working, but it could be better label Mar 17, 2025
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

@sara-rn the installer here is broken because #671 broke the installer. Please rebase after #675 is merged so that the code works.

The fist UI window (install customization) is missing a next button, so I couldn't test the categories page:
image
Please address this issue so that I can review the new window as well.

Remember adding labels to PRs (in this case enhacement is appropriate) and to add the issue the PR closes to the PR description (this PR should address #578).

install.ps1 Outdated
try {
(New-Object System.Net.WebClient).DownloadFile($categoriesUrl, $categoriesFile)
$categories = Get-Content -Path $categoriesFile
} catch {
Copy link
Member

Choose a reason for hiding this comment

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

If you catch the error, how can you continue to execute the rest of the code without categories?

install.ps1 Outdated
$form.StartPosition = 'CenterScreen'

#needed to use Find-Package
install-packageprovider nuget -force
Copy link
Member

Choose a reason for hiding this comment

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

Make the installation of nuget consistency (same code structure) with the installation of other dependencies like boxstarter and chocolatey. Concretely: check if it is installed if possible, and print a message that is being installed and installed successfully instead of the output:

Name                           Version          Source           Summary
----                           -------          ------           -------
nuget                          2.8.5.208        https://onege... NuGet provider for the OneGet meta-package manager

@sara-rn sara-rn force-pushed the update-installer-categories branch from f7c4e94 to 3100f2b Compare March 17, 2025 10:57
After the initial form to set up the environmental variables a new
window will display all the packages grouped by category.
The packages from `config.xml` will be selected by default.
@sara-rn sara-rn force-pushed the update-installer-categories branch 5 times, most recently from 6caf0ca to 8aa429c Compare March 17, 2025 23:47
@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 17, 2025

@Ana06 there is no need to use Find-Package, therefore the installation of nuget or download categories.txt is not necessary. At the end of the feed from https://www.myget.org/F/vm-packages/Packages there is a <link rel="next" with the URL for the next packages.
The packages are selected and the Continue button adds the selected items to the config.xml

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

@sara-rn I was not able to review the installer UI as the installer does not run correctly:

Get-Packages-Categories : The term 'Get-Packages-Categories' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\flare\Desktop\install.ps1:491 char:27
+     $packagesByCategory = Get-Packages-Categories
+                           ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Packages-Categories:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

I think is because you have placed the code of Get-Packages-Categories after the use of the function (it needs to be defined before). Please ensure the code works as it otherwise make it the review difficult.

I also recommend you to add some screenshots when making UI changes.

install.ps1 Outdated
## PACKAGE SELECTION BY CATEGORY
################################################################################

function Get-Packages-Categories {
Copy link
Member

Choose a reason for hiding this comment

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

@sara-rn

@Ana06 there is no need to use Find-Package, therefore the installation of nuget or download categories.txt is not necessary. At the end of the feed from https://www.myget.org/F/vm-packages/Packages there is a <link rel="next" with the URL for the next packages.
The packages are selected and the Continue button adds the selected items to the config.xml

Seeing how complicated the code to use https://www.myget.org/F/vm-packages/api/v2/Packages?$filter=IsLatestVersion%20eq%20true is, I think the solution with Find-Package was better: much simpler code and easier to maintain.

@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 18, 2025

@sara-rn I was not able to review the installer UI as the installer does not run correctly:

Get-Packages-Categories : The term 'Get-Packages-Categories' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\flare\Desktop\install.ps1:491 char:27
+     $packagesByCategory = Get-Packages-Categories
+                           ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Packages-Categories:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

I think is because you have placed the code of Get-Packages-Categories after the use of the function (it needs to be defined before). Please ensure the code works as it otherwise make it the review difficult.

I also recommend you to add some screenshots when making UI changes.

I executed it without any issues, but when I switched to a different snapshot with Powershell version 5.1 I had the same error

@sara-rn sara-rn force-pushed the update-installer-categories branch 2 times, most recently from 84595c3 to 8d8d15e Compare March 18, 2025 16:00
@sara-rn
Copy link
Contributor Author

sara-rn commented Mar 18, 2025

Screenshot From 2025-03-18 16-59-44

@sara-rn sara-rn force-pushed the update-installer-categories branch 8 times, most recently from c9902a5 to 2ad68c8 Compare March 19, 2025 23:49
Retrieve packages from the APIurl `https://www.myget.org/F/vm-packages`
instead of using `Find-Package` that required the installation of nuget
@sara-rn sara-rn force-pushed the update-installer-categories branch from 2ad68c8 to 94db0a1 Compare March 20, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 enhancement It is working, but it could be better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display packages by category in installer
2 participants