-
Notifications
You must be signed in to change notification settings - Fork 693
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
Onboard NuGet to Unified Settings and create General page #6229
base: dev
Are you sure you want to change the base?
Conversation
This PR contains changes to XAML files. Verify that you've completed the following tasks:
|
src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/ClearNuGetLocalResourcesWindow.xaml.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/ViewModels/ClearNuGetLocalsViewModel.cs
Outdated
Show resolved
Hide resolved
...Get.Clients/NuGet.PackageManagement.VisualStudio/Services/ExternalSettingsProviderService.cs
Outdated
Show resolved
Hide resolved
...Get.Clients/NuGet.PackageManagement.VisualStudio/Services/ExternalSettingsProviderService.cs
Outdated
Show resolved
Hide resolved
default: break; | ||
} | ||
|
||
throw new ApplicationException("Unknown setting!"); |
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 a thought, when the moniker is known, the code silently ignores when the value has the wrong type, so it doesn't feel entirely consistent to me to throw when the moniker is unknown.
if (input is T value) | ||
{ | ||
return Task.FromResult(ExternalSettingOperationResult.SuccessResult(value)); | ||
} | ||
|
||
throw new ApplicationException("Error reading setting!"); |
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.
Would it perhaps be better to cast, so that the exception message tells us what the expected and actual types are, rather than a static string that we'll only be able to understand via debugging (perfview trace attached to "record your steps" VS feedback won't have details of the error)
{ | ||
if (typeof(T) != typeof(string)) | ||
{ | ||
throw new ApplicationException("Error reading setting!"); |
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.
Should the error say what the actual type is, so we have more information without needing to debug?
{ | ||
0 => (T)(object)MonikerPackagesConfig, | ||
1 => (T)(object)MonikerPackageReference, | ||
_ => throw new ApplicationException("Error reading setting!"), |
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.
Should we report the input value, so we have more information without needing to debug?
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.
Looks good overall, thanks for including all of the screenshots. I'll review again after Andy's comments are resolved
...Get.Clients/NuGet.PackageManagement.VisualStudio/Services/ExternalSettingsProviderService.cs
Show resolved
Hide resolved
src/NuGet.Clients/NuGet.PackageManagement.UI/ViewModels/ClearNuGetLocalsViewModel.cs
Outdated
Show resolved
Hide resolved
|
||
<!-- Content --> | ||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"> | ||
<TextBlock Margin="0,12,0,12" TextWrapping="Wrap" Text="{Binding CommandCompleteText}" Visibility="{Binding IsCommandComplete, Converter={StaticResource BooleanToVisibilityConverter}}"/> |
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.
For accessibility, consider making this a LiveTextBlock (which is from the VS SDK) so it will "announce" changes to its text or visibility.
src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/ClearNuGetLocalResourcesWindow.xaml.cs
Show resolved
Hide resolved
...Get.Clients/NuGet.PackageManagement.VisualStudio/Services/ExternalSettingsProviderService.cs
Outdated
Show resolved
Hide resolved
...Get.Clients/NuGet.PackageManagement.VisualStudio/Services/ExternalSettingsProviderService.cs
Show resolved
Hide resolved
781c5b5
to
79d5164
Compare
Bug
Fixes: NuGet/Home#14040
Description
General Options
The General Options are onboarded to the Unified Settings platform (USX) with the following major changes:
Our repo has a new
registration.json
which declares the property string values and types.Our repo implements the
IExternalSettingsProvider
to react to user input from the Unified Settings general page.The provider wraps our existing NuGet.Configuration types so that the monikers we list in our
registration.json
can be passed to NuGet's IExternalSettingsProvider implementation by USX.A GeneralStub page was added which points to the USX General page when the customer has enabled USX. The reason for this is so that if a customer opens a legacy options NuGet page (eg, Configuration Files), they can still see "General" listed there and be able to open the USX General page directly.
Settings stored in NuGet.config
The link will open the Configuration Files settings page (which is currently a legacy VS Options dialog).
Details
Clear NuGet local resources
Pressing "Clear NuGet Local resources" results in a modal dialog so that customers have an opportunity to cancel the operation, as shown below.
Details
As with legacy VS options, once started, the command cannot be cancelled (though I've proposed an enhancement to this if we see customers are using the feature).
Pressing "Yes" will open a modal dialog showing:
The modal window is a WPF window bound to a ViewModel setup to Execute NuGet's clear all
LocalsCommand
, and indicate state for whether the command is in-progress, and provide a status message upon completion.Once the window loads, it asks the VM to begin executing.
The command logs information to the Output Window in VS.
Once complete, the completion time is shown (legacy settings behavior) along with a completion status message (success or error text).
The close button is enabled.
If any error occurs, the exception will be shown in the dialog. Scrolling is supported for longer messages.
*Note that the aka.ms help URL shown is not directly clickable. This can be enhanced in a future iteration to be pulled out into its own Hyperlink.
Theming works properly in the modal dialog.
General Stub page
When a customer has opted-into Unified Settings then opens the legacy VS options for NuGet (eg, Package Sources), the General page will still appear.
Details
Instead of providing content, the stub page provides a link to directly open the General USX page. Before closing the legacy options dialog, it will prompt to save any pending changes:Psuedo-localization testing
Tested PLOC at minimum supported resolution of 1366x768 at 100% DPI scaling.
PLOC Screenshots
Note, I used a WPF runtime tool to add extra text that's shown here so I could be sure that a very long error message will scroll correctly.
Accessibility testing
The Clear Locals modal dialog shows all green in Accessibility Insights.
I will schedule a test pass for this change as well.
Accessibility Screenshots
PR Checklist