-
Notifications
You must be signed in to change notification settings - Fork 324
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
Dev drive insights and pip cache move rebased to changes from main #2486
Conversation
DevDriveSize = devDrive.DriveSizeInBytes / divider; | ||
DevDriveFreeSize = devDrive.DriveSizeRemainingInBytes / divider; | ||
DevDriveUsedSize = DevDriveSize - DevDriveFreeSize; | ||
DevDriveUnitOfMeasure = (devDrive.DriveUnitOfMeasure == ByteUnit.TB) ? "TB" : "GB"; |
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.
These probably have to be localized. #WontFix
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.
These are units of data. Do we localize these elsewhere?
tools/Customization/DevHome.Customization/ViewModels/Environment/DevDriveCardViewModel.cs
Outdated
Show resolved
Hide resolved
{ | ||
var optimizeDevDriveDialog = new OptimizeDevDriveDialog(CacheToBeMoved, ExistingCacheLocation, EnvironmentVariableToBeSet); | ||
optimizeDevDriveDialog.XamlRoot = settingsCard.XamlRoot; | ||
optimizeDevDriveDialog.RequestedTheme = settingsCard.ActualTheme; |
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.
I don't think you want to do this -- it will use the right theme without it, and if the RequestedTheme is Default, then this will cause a bug when the System theme is changed. For example, if RequestedTheme is Default and ActualTheme is Dark, but then you set the system theme to Light, the theme of the dialog will stay Dark #Pending
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.
Without this, I see light theme dialog pop up for a dark themed app.
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.
Does it make a difference if you include the Style on the dialog like I mentioned below? There should be a way we can remove this.
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.
I have the following:
Style="{StaticResource DefaultContentDialogStyle}" in the dialog.
That is not making any difference- still seeing light theme dialog with dark theme app without setting the RequestedTheme, if that is what you are referring to.
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never" | ||
mc:Ignorable="d"> | ||
|
||
<Grid MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}"> |
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 page as it currently is will have this bug: #566 #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.
I am guessing removing the BreadcrumbBar will take care of this.
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.
Not quite -- you'll have to have a ScrollViewer fill the width, then set the MaxWidth and Margin on whatever's inside the encompassing ScrollViewer.
ItemsSource="{x:Bind Breadcrumbs}" /> | ||
|
||
<ScrollView Grid.Row="1" VerticalAlignment="Top"> | ||
<views:DevDriveInsightsView /> |
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.
Will there be other views that this might contain in the future? Why separate the page and view? #ByDesign
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.
Yes there could be other views to be contained here in future.
tools/Customization/DevHome.Customization/Views/OptimizeDevDriveDialog.xaml
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Views/OptimizeDevDriveDialog.xaml
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Views/OptimizeDevDriveDialog.xaml
Outdated
Show resolved
Hide resolved
tools/Customization/DevHome.Customization/Views/OptimizeDevDriveDialog.xaml
Outdated
Show resolved
Hide resolved
OptimizeDevDriveDialogDescription = stringResource.GetLocalized("OptimizeDevDriveDialogDescription", ExistingCacheLocation, EnvironmentVariableToBeSet); | ||
} | ||
|
||
public string CacheToBeMoved |
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.
As Branden mentioned elsewhere, these DPs should all just be ObservableProperties. #Resolved
@@ -117,6 +117,10 @@ | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<data name="ChooseDirectoryPromptText" xml:space="preserve"> | |||
<value>Choose directory on dev drive...</value> |
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.
Dev Drive should be capitalized, I believe. (Applies to all instances on this page)
<value>Choose directory on dev drive...</value> | |
<value>Choose directory on Dev Drive...</value> | |
``` #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.
That is what it says in the Figma.
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.
actually @SohamDas2021 it should be like Kristen outlined, If I recall, it was from Marketing who said that.
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.
So capitalize all Dev Drive in the text?
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.
Fixed, thanks.
private async Task BrowseButtonClick(object sender) | ||
{ | ||
// Create a folder picker dialog | ||
var folderPicker = new FolderPicker |
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 this be using @AmelBawa-msft 's new Picker APIs? If this is ever launched from admin, it definitely should. #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.
I have noted this down as a suggestion and will do it as a bug fix later. Will be opening issue to track this. Trying to complete this today.
private string _exampleDevDriveLocation; | ||
|
||
[ObservableProperty] | ||
private string _chooseDirectoryPromptText; |
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.
Rather than saving all these strings in the ViewModel, you should reference them from the xaml markup directly. See https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/mrtcore/localize-strings#refer-to-a-string-resource-identifier-from-xaml #WontFix
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.
Many of these strings have dynamic bindings-
Contents of {0} will be copied to chosen directory. And {1} will be set to chosen directory.
Can't seem to find a way of doing this through the xaml. Won't fixing for now. Keeping a note and will be opening an issue to track.
@@ -24,6 +24,8 @@ | |||
|
|||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\common\DevHome.Common.csproj" /> | |||
<ProjectReference Include="..\..\SetupFlow\DevHome.SetupFlow.Common\DevHome.SetupFlow.Common.csproj" /> |
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 be great if you could add the DevHome.Customization project to the mermaid diagram of project relationships in https://github.com/microsoft/devhome/blob/main/docs/architecture.md #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.
public DevDriveInsightsViewModel(IDevDriveManager devDriveManager, OptimizeDevDriveDialogViewModelFactory optimizeDevDriveDialogViewModelFactory) | ||
{ | ||
_optimizeDevDriveDialogViewModelFactory = optimizeDevDriveDialogViewModelFactory; | ||
_dispatcher = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread(); |
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.
If this isn't running on the UI thread, this will return null. Use WindowEx instead.
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.
Running on UI thread.
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.
It isn't guaranteed that this will run on the UI thread every time. I can forward you the internal thread I started about this. This can return null and will result in a crash.
xmlns:converters="using:CommunityToolkit.WinUI.Converters" | ||
xmlns:ctControls="using:CommunityToolkit.WinUI.Controls" | ||
mc:Ignorable="d" | ||
Loaded="UserControl_Loaded"> |
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.
You should bind this to a RelayCommand directly on the ViewModel, so that you don't need the intermediate event handler on the View. It will also prevent any concurrency issues if a user were to switch between pages really quickly. #WontFix
<StackPanel> | ||
<TextBlock Text="{x:Bind ViewModel.OptimizeDevDriveDialogDescription}" TextWrapping="Wrap"/> | ||
<Grid Margin="0 10 0 0"> | ||
<TextBox HorizontalAlignment="Left" Width="300" Grid.Column="0" x:Name="DirectoryPathTextBox" PlaceholderText="Choose a directory" Text="{x:Bind ViewModel.DirectoryPathTextBox , Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
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.
Suggest using MinWidth, so that it can scale up in size if text scale is turned up (preventing accessibility bug) #Resolved
xmlns:d="https://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:views="using:DevHome.Customization.Views" | ||
behaviors:NavigationViewHeaderBehavior.HeaderMode="Always" |
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.
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.
I will do it as a separate PR once I check this in.
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.
Thanks for working on this and getting it into its current state. I don't think I've seen anything that would block the check in
<comment>Dev drive size free</comment> | ||
</data> | ||
<data name="DevDriveInsightsCard.Description" xml:space="preserve"> | ||
<value>All things, dev drives, optimizations, etc.</value> |
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.
Missed this one, but will let you update it in another PR #Resolved
if (directoryPath != null) | ||
{ | ||
// Handle the selected folder | ||
// TODO: If chosen folder not a dev drive location, currently we no-op. Instead we should display the error. |
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.
Do we have an issue on GitHub for this? #Closed
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.
Yet to create the issues, will do.
Thanks for approving. In reply to: 1972049143 |
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.
Summary of the pull request
Windows customization root page:
Dev Drive Insights: Listing the dev drives and the Pip cache optimizer card.
Folder picker content dialog to move the cache to dev drive location:
User inputs directory on dev drive:
Pip cache optimized card.
Currently the app needs to be relaunched for reflecting the change.
References and relevant issues
Detailed description of the pull request / Additional comments
Added Dev Drive Insights. User can move pip cache from non dev drive location to the dev drive for optimized performance.
Validation steps performed
pip install works after the change.
PR checklist