Skip to content

DYN-7343: Pm search compatibility filters update #15603

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

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@ Dynamo.Controls.TreeViewVLineMarginConverter
Dynamo.Controls.TreeViewVLineMarginConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.TreeViewVLineMarginConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.TreeViewVLineMarginConverter.TreeViewVLineMarginConverter() -> void
Dynamo.Controls.VersionStringAsteriskToXConverter
Dynamo.Controls.VersionStringAsteriskToXConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.VersionStringAsteriskToXConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.VersionStringAsteriskToXConverter.VersionStringAsteriskToXConverter() -> void
Dynamo.Controls.ViewButtonClipRectConverter
Dynamo.Controls.ViewButtonClipRectConverter.Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.ViewButtonClipRectConverter.ConvertBack(object value, System.Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) -> object[]
Expand Down
25 changes: 25 additions & 0 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4029,4 +4029,29 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
}
}

/// <summary>
/// Returns "2019.10.x" from "2019.10.*" input
/// </summary>
public class VersionStringAsteriskToXConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string version && !string.IsNullOrEmpty(version))
{
return version.Replace("*", "x");
}

return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string version && !string.IsNullOrEmpty(version))
{
return version.Replace("x", "*");
}

return value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
<Color x:Key="PMBorderColor">#5F5F5F</Color>
<Color x:Key="PMHeaderBackgroundColor">#3f3f3f</Color>
<Color x:Key="PMDataGridBackgroundColor">#474747</Color>
<Color x:Key="PMDataAltBackgroundColor">#535353</Color>
<Color x:Key="PMVersionCompatibleColor">#87B340</Color>
<Color x:Key="PMVersionUncompatibleColor">#EB5555</Color>
<Color x:Key="PMVersionUnknownColor">#73C5FF</Color>
Expand All @@ -211,6 +212,7 @@
<SolidColorBrush x:Key="PMBorderColorBrush" Color="{StaticResource PMBorderColor}" />
<SolidColorBrush x:Key="PMHeaderBackgroundColorBrush" Color="{StaticResource PMHeaderBackgroundColor}" />
<SolidColorBrush x:Key="PMDataGridBackgroundColorBrush" Color="{StaticResource PMDataGridBackgroundColor}" />
<SolidColorBrush x:Key="PMDataAltBackgroundColorBrush" Color="{StaticResource PMDataAltBackgroundColor}" />
<SolidColorBrush x:Key="PMVersionCompatibleColorBrush" Color="{StaticResource PMVersionCompatibleColor}" />
<SolidColorBrush x:Key="PMVersionUncompatibleColorBrush" Color="{StaticResource PMVersionUncompatibleColor}" />
<SolidColorBrush x:Key="PMVersionUnknownColorBrush" Color="{StaticResource PMVersionUnknownColor}" />
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6480,7 +6480,7 @@
<Setter Property="BorderBrush" Value="{StaticResource DarkMidGreyBrush}" />
<Setter Property="ColumnWidth" Value="Auto" />
<Setter Property="GridLinesVisibility" Value="Vertical" />
<Setter Property="VerticalGridLinesBrush" Value="{StaticResource DarkMidGreyBrush}" />
<Setter Property="VerticalGridLinesBrush" Value="#646464" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this looks like backward to me?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated this to match the design we have on Figma. It meant that I needed to add a new color to the swatch of colors we used so far. https://www.figma.com/design/MJh76m7bbafE3sjwLUTZhZ/Dynamo-package-manager-update?node-id=2397-31482&node-type=canvas&t=OCvkjGxUxDFeO1qW-0

I pushed a new commit making it a resource, which I should have done to begin with, apologies @QilongTang .

<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
</Style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,24 @@ internal void filter_PropertyChanged(object sender, PropertyChangedEventArgs e)
negateFilter.OnChecked = false;
break;

// Mutually exclusive case for Compatible and Incompatible
case var name when name.Equals(Resources.PackageCompatible):
if (!filter.OnChecked)
break;
var incompatibleFilter = CompatibilityFilter.First(x => x.FilterName.Equals(Resources.PackageIncompatible));
if (!incompatibleFilter.OnChecked)
break;
incompatibleFilter.OnChecked = false;
break;

case var name when name.Equals(Resources.PackageIncompatible):
if (!filter.OnChecked)
break;
var compatibleFilter = CompatibilityFilter.First(x => x.FilterName.Equals(Resources.PackageCompatible));
if (!compatibleFilter.OnChecked)
break;
compatibleFilter.OnChecked = false;
break;
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/PackageDetailsViewExtension/PackageDetailsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<controls:InverseEmptyListToVisibilityConverter x:Key="InverseEmptyListToVisibilityConverter" />
<controls:CopyrightInfoTooltipConverter x:Key="CopyrightInfoTooltipConverter" />
<controls:PackageDetailsLinkCollapseOnEmpty x:Key="PackageDetailsLinkCollapseOnEmpty" />
<controls:VersionStringAsteriskToXConverter x:Key="VersionStringAsteriskToXConverter" />
<SolidColorBrush x:Key="ForegroundGrayBrush" Color="#D8D8D8" />
<SolidColorBrush x:Key="HoverBorderGrayBrush" Color="#6d6d6d" />
<SolidColorBrush x:Key="PressedBorderGrayBrush" Color="#7e7e7e" />
Expand Down Expand Up @@ -693,7 +694,7 @@
<TextBlock Margin="0,5" Text="{x:Static p:Resources.PackageDetailsCompatibilityWithSetup}" />
<DataGrid x:Name="VersionCompatibilityDataGrid"
Margin="0,0,20,20"
AlternatingRowBackground="{StaticResource PMDataGridBackgroundColorBrush}"
AlternatingRowBackground="{StaticResource PMDataAltBackgroundColorBrush}"
AlternationCount="2"
AutoGenerateColumns="False"
Background="{StaticResource ExtensionBackgroundColor}"
Expand All @@ -709,6 +710,7 @@
IsReadOnly="True"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding VersionInformation}"
RowBackground="{StaticResource PMDataGridBackgroundColorBrush}"
RowDetailsVisibilityMode="Collapsed"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Expand All @@ -721,7 +723,7 @@
Binding="{Binding CompatibilityName}"
Header="" />
<DataGridTextColumn Width="3*"
Binding="{Binding Versions}"
Binding="{Binding Versions, Converter={StaticResource VersionStringAsteriskToXConverter}}"
Header="{x:Static p:Resources.PublishPackageViewPackageVersion}" />
</DataGrid.Columns>
</DataGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ public void PackageSearchDialogSearchTestCompatibilityFilters()
new FilterEntry(unknownCompatibilityFilterName, "Filter by compatibility", "Unknown Compatibility Packages", packageManagerSearchViewModel) { OnChecked = false },
};

packageManagerSearchViewModel.CompatibilityFilter.ForEach(f => f.PropertyChanged += packageManagerSearchViewModel.filter_PropertyChanged);

// Adding compatible packages
foreach (var package in compatiblePackagesName)
{
Expand Down Expand Up @@ -654,17 +656,19 @@ public void PackageSearchDialogSearchTestCompatibilityFilters()
Assert.IsNotNull(packageManagerSearchViewModel.SearchResults, "No results found");
Assert.That(packageManagerSearchViewModel.SearchResults.Count == compatiblePackagesName.Count, "Filtered results do not match the compatible packages");

// Reset (Filters are not mutually exclusive)
packageManagerSearchViewModel.CompatibilityFilter[0].OnChecked = false;

// Check the Incompatible filter
packageManagerSearchViewModel.CompatibilityFilter[1].OnChecked = true;
packageManagerSearchViewModel.CompatibilityFilter[1].FilterCommand.Execute(string.Empty);
Assert.IsNotNull(packageManagerSearchViewModel.SearchResults, "No results found");
Assert.That(packageManagerSearchViewModel.SearchResults.Count == incompatiblePackagesName.Count, "Filtered results do not match the incompatible packages");

// Reset (Filters are not mutually exclusive)
packageManagerSearchViewModel.CompatibilityFilter[1].OnChecked = false;
// Asserts that Compatible and Incompatible filters are mutually exclusive
Assert.IsFalse(packageManagerSearchViewModel.CompatibilityFilter[0].OnChecked, "Compatible and Incompatible filters should be mutually exclusive");
packageManagerSearchViewModel.CompatibilityFilter[0].OnChecked = true;
Assert.IsFalse(packageManagerSearchViewModel.CompatibilityFilter[1].OnChecked, "Compatible and Incompatible filters should be mutually exclusive");

// Reset (These filters are not mutually exclusive)
packageManagerSearchViewModel.CompatibilityFilter[0].OnChecked = false;

// Check the Unknown Compatibility filter
packageManagerSearchViewModel.CompatibilityFilter[2].OnChecked = true;
Expand Down
Loading