Dev drive insights and pip cache move rebased to changes from main#2486
Dev drive insights and pip cache move rebased to changes from main#2486SohamDas2021 merged 6 commits intomainfrom
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.
These probably have to be localized. #WontFix
There was a problem hiding this comment.
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.
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.
Without this, I see light theme dialog pop up for a dark themed app.
There was a problem hiding this comment.
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.
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.
This page as it currently is will have this bug: #566 #Resolved
There was a problem hiding this comment.
I am guessing removing the BreadcrumbBar will take care of this.
There was a problem hiding this comment.
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.
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.
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.
As Branden mentioned elsewhere, these DPs should all just be ObservableProperties. #Resolved
| <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.
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.
That is what it says in the Figma.
There was a problem hiding this comment.
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.
So capitalize all Dev Drive in the text?
| private async Task BrowseButtonClick(object sender) | ||
| { | ||
| // Create a folder picker dialog | ||
| var folderPicker = new FolderPicker |
There was a problem hiding this comment.
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.
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.
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.
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.
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\common\DevHome.Common.csproj" /> | ||
| <ProjectReference Include="..\..\SetupFlow\DevHome.SetupFlow.Common\DevHome.SetupFlow.Common.csproj" /> |
There was a problem hiding this comment.
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
| public DevDriveInsightsViewModel(IDevDriveManager devDriveManager, OptimizeDevDriveDialogViewModelFactory optimizeDevDriveDialogViewModelFactory) | ||
| { | ||
| _optimizeDevDriveDialogViewModelFactory = optimizeDevDriveDialogViewModelFactory; | ||
| _dispatcher = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread(); |
There was a problem hiding this comment.
If this isn't running on the UI thread, this will return null. Use WindowEx instead.
There was a problem hiding this comment.
Running on UI thread.
There was a problem hiding this comment.
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.
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.
Suggest using MinWidth, so that it can scale up in size if text scale is turned up (preventing accessibility bug) #Resolved
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:views="using:DevHome.Customization.Views" | ||
| behaviors:NavigationViewHeaderBehavior.HeaderMode="Always" |
There was a problem hiding this comment.
There was a problem hiding this comment.
I will do it as a separate PR once I check this in.
bbonaby
left a comment
There was a problem hiding this comment.
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.
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.
Do we have an issue on GitHub for this? #Closed
There was a problem hiding this comment.
Yet to create the issues, will do.
|
Thanks for approving. In reply to: 1972049143 |
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