Skip to content
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

Cherrypicks DYN-7778, DYN-7821 #15646

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Binary file modified extern/TuneUp/bin/TuneUp.dll
Binary file not shown.
Binary file modified extern/TuneUp/bin/en-US/TuneUp.resources.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion extern/TuneUp/pkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"license": "MIT",
"file_hash": null,
"name": "TuneUp",
"version": "1.0.15",
"version": "1.0.16",
"description": "On Dynamo 2.5–2.19 (.NET 4.8), use TuneUp versions up to 1.0.7.\r\nOn Dynamo 3.0+ (.NET 8), use TuneUp versions 1.0.8 and later.\r\n\r\nTuneUp is a view extension for analyzing the performance of Dynamo graphs. TuneUp allows you to see overall graph execution time, per-node execution time, execution time of groups, and other helpful information. With TuneUp, you can rerun all nodes, including ones that are normally skipped for optimization/caching during repeated runs of a graph. This enables you to compare the actual execution times between multiple runs. Read more here: https://dynamobim.org/tuneup-extension-explore-your-node-and-graph-execution-times/. \r\n\r\nKnown issues:\r\n1. TuneUp does not work in a custom node workspace.\r\n2. TuneUp binaries are not semantically versioned and are not intended to be built on top of as an API. Do not treat these binaries like DynamoCore.",
"group": "",
"keywords": [
Expand Down
19 changes: 14 additions & 5 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4102,4 +4102,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageIncompatibleFilterTooltip" xml:space="preserve">
<value>Versions maybe incompatible with the current setup</value>
</data>
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4089,4 +4089,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageIncompatibleFilterTooltip" xml:space="preserve">
<value>Versions maybe incompatible with the current setup</value>
</data>
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5388,6 +5388,7 @@ static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageHostDependencyTo
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageKeywords.get -> string
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageKeywordsTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageName.get -> string
static Dynamo.Wpf.Properties.Resources.PackageVersionTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageNameTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageNameWatermark.get -> string
static Dynamo.Wpf.Properties.Resources.PublishPackageViewPackageVersion.get -> string
Expand Down
46 changes: 26 additions & 20 deletions src/DynamoPackages/PackageManagerSearchElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ private List<VersionInformation> TransformVersionsToVersionInformation(Greg.Resp
{
var versionInformation = new List<VersionInformation>();
if (header.versions == null) return versionInformation;
var name = header.name;

// Iterate through each version entry in the header
foreach (var versionEntry in header.versions)
Expand Down Expand Up @@ -299,7 +300,7 @@ private List<VersionInformation> TransformVersionsToVersionInformation(Greg.Resp
{
try
{
// Set the defaults if parameters are not provided (for testing)
// Set defaults if parameters are not provided
dynamoVersion ??= VersionUtilities.Parse(DynamoModel.Version);
hostVersion ??= DynamoModel.HostAnalyticsInfo.HostProductVersion;
host ??= DynamoModel.HostAnalyticsInfo.HostProductName;
Expand All @@ -308,47 +309,52 @@ private List<VersionInformation> TransformVersionsToVersionInformation(Greg.Resp
// If there is no compatibility matrix, we cannot determine anything
if (compatibilityMatrix == null || compatibilityMatrix.Count == 0)
{
return null;
return null;
}

Greg.Responses.Compatibility compatibility = null;

// Determine compatibility based on presence of host
// We only care about 2 conditions:
// Determine compatibility
// 1. If we are under host, we first look at that host compatibility. If that's missing, we still check for Dynamo-only compatibility
// 2. If we are not under host, we only care about Dynamo compatibility
// ! The opposite to 1. is not true - if there is Host compatibility information, then we NEED to be compatible with the host
// (this is to say, we cannot just flip the conditions around to declare 'if Dynamo is compatible, we are already compatible')
// 2. If we are not under host, we care about Dynamo compatibility first and foremost. However, we use fallback to Host compatibility if no Dynamo compatibility is found. In this case, we mark as Incompatible
// 3. Only if no compatibility information is found, then we mark as 'Unknown Compatibility'
if (!string.IsNullOrEmpty(host))
{
// Attempt to retrieve compatibility specific to the host
compatibility = compatibilityMatrix.FirstOrDefault(c => c.name.ToLowerInvariant() == host.ToLowerInvariant());
// Check for host-specific compatibility
compatibility = compatibilityMatrix.FirstOrDefault(c => c.name?.ToLowerInvariant() == host?.ToLowerInvariant())
?? compatibilityMatrix.FirstOrDefault(c => c.name?.ToLowerInvariant() == "dynamo");
}
else
{
// No host specified (DynamoCore only)
// Check Dynamo compatibility first; if missing, check for host compatibility
compatibility = compatibilityMatrix.FirstOrDefault(c => c.name?.ToLowerInvariant() == "dynamo");

// If host compatibility is missing, fallback to Dynamo compatibility
if (compatibility == null)
{
compatibility = compatibilityMatrix.FirstOrDefault(c => c.name.ToLowerInvariant() == "dynamo");
// No Dynamo compatibility, fallback to any host compatibility if present
var hostCompatibility = compatibilityMatrix.FirstOrDefault(c => c.name?.ToLowerInvariant() != "dynamo");
if (hostCompatibility != null)
{
// Mark as incompatible if host compatibility is present without Dynamo info
return false;
}
}
}
else
{
// No host specified, so we only check for Dynamo compatibility
compatibility = compatibilityMatrix.FirstOrDefault(c => c.name.ToLowerInvariant() == "dynamo");
}

// If no relevant compatibility info is found, return indeterminate
// If no compatibility information is found for both Dynamo and host, return unknown (null)
if (compatibility == null)
{
return null;
}

// Step 2: Check compatibility based on min/max ranges or specific versions
// Check compatibility based on min/max ranges or specific versions
var versionToCheck = (compatibility.name.ToLowerInvariant() == "dynamo") ? dynamoVersion : hostVersion;
return versionToCheck != null && IsVersionCompatible(compatibility, versionToCheck);
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
Console.WriteLine(ex.ToString());
return null;
}
}
Expand Down
29 changes: 23 additions & 6 deletions src/PackageDetailsViewExtension/PackageDetailsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
<Binding Path="CopyRightHolder" />
<Binding Path="CopyRightYear" />
</MultiBinding>
</ToolTip.Content>
</ToolTip.Content>
</ToolTip>
</Viewbox.ToolTip>
</Viewbox>
Expand Down Expand Up @@ -733,25 +733,42 @@
FontFamily="{StaticResource ArtifaktElementRegular}"
Foreground="#ffffff"
HeadersVisibility="Column"
IsHitTestVisible="False"
IsHitTestVisible="True"
IsReadOnly="True"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding VersionInformation}"
PreviewMouseDown="DataGrid_PreviewMouseDown"
RowBackground="{StaticResource PMDataGridBackgroundColorBrush}"
RowDetailsVisibilityMode="Collapsed"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Style="{StaticResource DataGridStyle1}"
ToolTipService.IsEnabled="True"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<DataGrid.Columns>
<DataGridTextColumn Width="*"
Binding="{Binding CompatibilityName}"
Header="" />
<DataGridTextColumn Width="3*"
Binding="{Binding Versions, Converter={StaticResource VersionStringAsteriskToXConverter}}"
Header="{x:Static p:Resources.PublishPackageViewPackageVersion}" />
Header="{x:Static p:Resources.PublishPackageViewPackageName}" />
<DataGridTextColumn Width="3*" Binding="{Binding Versions, Converter={StaticResource VersionStringAsteriskToXConverter}}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="{x:Static p:Resources.PublishPackageViewPackageVersion}" />
<Image Width="14"
Height="14"
Margin="10,0,0,0"
VerticalAlignment="Center"
Source="pack://application:,,,/DynamoCoreWpf;component/UI/Images/whiteinfotab.png">
<Image.ToolTip>
<ToolTip Content="{x:Static p:Resources.PackageVersionTooltip}" />
</Image.ToolTip>
</Image>
</StackPanel>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
Expand Down
6 changes: 6 additions & 0 deletions src/PackageDetailsViewExtension/PackageDetailsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
Closed?.Invoke(this, EventArgs.Empty);
}

// Disables DataGrid interactions on mousedown (selection)
private void DataGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,18 @@ public void TestComputeVersionNoDynamoCompatibility()
new List<Greg.Responses.Compatibility> { new Greg.Responses.Compatibility { name = "dynamo", min = "2.10", max = "2.13.1" } },
compatibleDynamoVersion, compatibilityMap, null, hostName);

// Case 6: No compatibility information is provided
var resultNoCompatibility = PackageManagerSearchElement.CalculateCompatibility(
new List<Greg.Responses.Compatibility> { new Greg.Responses.Compatibility() },
compatibleDynamoVersion, compatibilityMap, null, hostName);

// Assert
Assert.IsNull(resultNoDynamoCompatibility, "Expected compatibility to be null when no Dynamo-specific compatibility exists and no fallback is allowed.");
Assert.IsFalse(resultNoDynamoCompatibility, "Expected compatibility to be incompatible (false) when no Dynamo-specific compatibility exists and we fallback to host.");
Assert.IsTrue(resultWithHostCompatibility, "Expected compatibility to be true when no Dynamo-specific compatibility exists but host compatibility matches.");
Assert.IsTrue(resultMinOnlyCompatibility, "Expected compatibility to be true for min-only range within major version.");
Assert.IsNull(resultIncompleteCompatibilityInfo, "Expected compatibility to be indeterminate (null) when information is incomplete.");
Assert.IsFalse(resultIncompleteCompatibilityInfo, "Expected compatibility to be incompatible (false) when no dynamo information is provided, but any information for host is present.");
Assert.IsTrue(resultFallbackToDynamo, "Expected compatibility to be true when under host but only Dynamo compatibility is provided.");
Assert.IsNull(resultNoCompatibility, "Expected unknown compatibility (null) when no compatibility information is provided.");
}

[Test]
Expand Down
Loading