-
Notifications
You must be signed in to change notification settings - Fork 336
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
Customization: Add general system and virtualization feature settings #3268
Conversation
...s/Customization/DevHome.Customization/ViewModels/VirtualizationFeatureManagementViewModel.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need to finish looking at the viewmodel and view changes then I'll be done reviewing, Will continue later today. Looking good so far
/// This list should be kept consistent with the list of features in the WindowsOptionalFeatureNames class. | ||
/// | ||
/// </summary> | ||
private const string Script = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is separate from the code review:
But I didn't think about this before but in the future I'm thinking, maybe we should use the built in WindowsOptionalFeature DSC resource in the PSDscResources module for enabling the features in the future so Windows customization, can enable any feature. @AmelBawa-msft is actually moving out the DSC execution code from the setup flow and into a general service that anyone in Dev Home can use in this PR: #3134
I'll need to see if there is a DSC for adding users to a group as well like for the hyper-v admin group stuff or create one, but that would be something else we'd want to add to Windows customization. Thinking even further it'd be great if there was a Generate DSC file button for Windows Customization like there is for the setup flow. CC: @joadoumie / @shakersMSFT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there are a bunch of valid long term options here. Another is just calling the various native APIs directly in an elevated zone, or other mechanism that Jeff is looking into. I did look into DSC execution here briefly and it was quite a bit slower than just calling into powershell, so something to look at in the future.
tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Strings/en-us/Resources.resw
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/ViewModels/FileExplorerViewModel.cs
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/ViewModels/GeneralSystemViewModel.cs
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/ViewModels/GeneralSystemViewModel.cs
Outdated
Show resolved
Hide resolved
...s/Customization/DevHome.Customization/ViewModels/VirtualizationFeatureManagementViewModel.cs
Outdated
Show resolved
Hide resolved
…settings - Updates `ManagementInfrastructureHelper.cs` for enhanced Windows feature management, including a refactored method for checking feature availability with modifications to return more detailed feature information. - Introduced a `RestartHelper.cs` class with a method to restart the computer immediately, to avoid disruption I did not point existing callers from Environments to this method since they have additional telemetry for this space. I can file an issue to track consolidation here. - Updated `WindowsIdentityHelper.cs` with a new method to check for whether a user has the capability to acquire administrative privileges, not just whether the current process is running elevated. - Added `WindowsOptionalFeatures.cs` and `WindowsOptionalFeatureState.cs` to represent Windows optional features, including a new static class for feature names and descriptions and a class to represent the state of an optional feature, specifically for UI. - Introduced `ModifyLongPathsSetting.cs` and `ModifyWindowsOptionalFeatures.cs` for enabling/disabling Windows settings and optional features through PowerShell scripts which require elevation. This allows the full script content to be visible to the user when accepting or rejecting the UAC prompt providing extra transparency, this is done in the same way as environments feature management. There are limitations here in that if scripts are blocked on the machine we're unable to make this changes, but until we finish security review on the elevated server, this is the best we've got. - Expanded Windows Customization with new views and dialogs for managing general system settings and virtualization features, including `GeneralSystemView`, `ModifyFeaturesDialog`, and `VirtualizationFeatureManagementPage`, alongside updates to existing views to accommodate these new features.
0ae7f25
to
daf0515
Compare
tools/Customization/DevHome.Customization/Views/GeneralSystemPage.xaml
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Views/ModifyFeaturesDialog.xaml
Outdated
Show resolved
Hide resolved
- Updated ManagementInfrastructureHelper.cs to default `description` to an empty string if null. - Changed `IsUserAdministrator` in WindowsIdentityHelper.cs to virtual for better extensibility. - Enhanced WindowsOptionalFeatureState.cs with `[ObservableProperty]` for `_isEnabled` and added change notification. - Modified PowerShell scripts in ModifyLongPathsSetting.cs and ModifyWindowsOptionalFeatures.cs for robust error handling with `$ErrorActionPreference='stop'`. - Adjusted return value and simplified `ExitCode` in ModifyWindowsOptionalFeatures.cs for clarity and maintainability. - Updated resource comments in Resources.resw for better clarity and localization support. - Refactored exit code handling in ModifyWindowsOptionalFeaturesEvent.cs for consistency and removed no change for simplicity - Adapted GeneralSystemViewModel.cs & VirtualizationFeatureManagementViewModel.cs to the non-static `IsUserAdministrator`. - Improved XAML file readability and structure in various UI components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested out the UX, seems to be functioning well! I have found one issue that is broader than just Windows Cust regarding restart logic in Dev Home when using a Dev Box.
I'm going to file an issue separately as this is not feature specific.
Summary of the pull request
Adds virtualization feature management and general system settings initial implementation.
NOTE: Content is still in review, so string changes and some design elements may be needed in a subsequent craftsmanship pass.
References and relevant issues
#2920 #3249 #2871
Detailed description of the pull request / Additional comments
ManagementInfrastructureHelper.cs
for enhanced Windows feature management, including a refactored method for checking feature availability with modifications to return more detailed feature information.RestartHelper.cs
class with a method to restart the computer immediately, to avoid disruption I did not point existing callers from Environments to this method since they have additional telemetry for this space. I can file an issue to track consolidation here.WindowsIdentityHelper.cs
with a new method to check for whether a user has the capability to acquire administrative privileges, not just whether the current process is running elevated.WindowsOptionalFeatures.cs
andWindowsOptionalFeatureState.cs
to represent Windows optional features, including a new static class for feature names and descriptions and a class to represent the state of an optional feature, specifically for UI.ModifyLongPathsSetting.cs
andModifyWindowsOptionalFeatures.cs
for enabling/disabling Windows settings and optional features through PowerShell scripts which require elevation. This allows the full script content to be visible to the user when accepting or rejecting the UAC prompt providing extra transparency, this is done in the same way as environments feature management. There are limitations here in that if scripts are blocked on the machine we're unable to make this changes, but until we finish security review on the elevated server, this is the best we've got.GeneralSystemView
,ModifyFeaturesDialog
, andVirtualizationFeatureManagementPage
, alongside updates to existing views to accommodate these new features.Main page navigation entries
Virtualization feature management page
Here the apply button is disabled until a change is made
Applying shows a modal dialog with an option to cancel and a horizontal progress bar
Successfully applying the changes shows a modal restart prompt that can be ignored, an Info Bar is updated with notice to restart as well, persists across navigation
Failure to apply will prompt an error on the Info Bar
When the user is not an admin, options are disabled with an info bar warning
General system
Changes to max path require a restart for existing/long-running processes to change, but any new processes don't so a modal dialog was not chosen for this path, just the restart Info Bar warning.
Validation steps performed
PR checklist