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

DYN-7779 Single dialog for download consent across different compatibility cases #15754

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ You can always redownload the package.</value>
<data name="MessageFailedToFindNodeById" xml:space="preserve">
<value>No node could be found with that Id.</value>
</data>
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<value>No group could be found with that Id.</value>
</data>
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
Expand Down Expand Up @@ -4057,15 +4057,12 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageDetailsCompatibilityWithSetup" xml:space="preserve">
<value>Compatible with your current setup</value>
</data>
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<value>Incompatible with your current setup</value>
</data>
<data name="PackageDetailsXCompatibilityWithSetup" xml:space="preserve">
<value>Unknown compatibility with your current setup</value>
</data>
<data name="PackageDetailsSize" xml:space="preserve">
<value>Size</value>
</data>
<data name="PackageDetailsCompatibleVersionTooltip" xml:space="preserve">
<value>This version should be compatible with your current setup</value>
</data>
Expand Down Expand Up @@ -4105,4 +4102,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
<data name="PackageUnknownCompatibilityVersionDownloadMsg" xml:space="preserve">
<value>The compatibility of this version with your setup has not been verified. It may or may not work as expected.</value>
</data>
</root>
12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ Do you want to install the latest Dynamo update?</value>
<data name="MessageFailedToFindNodeById" xml:space="preserve">
<value>No node could be found with that Id.</value>
</data>
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<value>No group could be found with that Id.</value>
</data>
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
Expand Down Expand Up @@ -4044,15 +4044,12 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageDetailsCompatibilityWithSetup" xml:space="preserve">
<value>Compatible with your current setup</value>
</data>
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<value>Incompatible with your current setup</value>
</data>
<data name="PackageDetailsXCompatibilityWithSetup" xml:space="preserve">
<value>Unknown compatibility with your current setup</value>
</data>
<data name="PackageDetailsSize" xml:space="preserve">
<value>Size</value>
</data>
<data name="PackageDetailsCompatibleVersionTooltip" xml:space="preserve">
<value>This version should be compatible with your current setup</value>
</data>
Expand Down Expand Up @@ -4092,4 +4089,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
<data name="PackageUnknownCompatibilityVersionDownloadMsg" xml:space="preserve">
<value>The compatibility of this version with your setup has not been verified. It may or may not work as expected. </value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,31 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
string msg;
MessageBoxResult result;

var compatible = PackageManagerSearchElement.CalculateCompatibility(package.compatibility_matrix);
if (compatible == false && !DynamoModel.IsTestMode)
// initialize default download consent message
msg = String.IsNullOrEmpty(installPath) ?
String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

// Calculate compatibility and display a single download consent across cases
var compatible = PackageManagerSearchElement.CalculateCompatibility(package.compatibility_matrix);

// Unknown package compatibility with current Dynamo env, this is expected to be the most popular case for now
if (compatible == null && !DynamoModel.IsTestMode)
{
msg = Resources.PackageManagerIncompatibleVersionDownloadMsg;
msg = msg + "\n\n" + Resources.PackageUnknownCompatibilityVersionDownloadMsg;
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);

if (result != MessageBoxResult.OK)
{
return;
}
}
// Package incompatible with current Dynamo env
else if (compatible == false && !DynamoModel.IsTestMode)
{
msg = msg + "\n\n" + Resources.PackageManagerIncompatibleVersionDownloadMsg;
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageManagerIncompatibleVersionDownloadTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Warning);
Expand All @@ -764,14 +785,13 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
return;
}
}

msg = String.IsNullOrEmpty(installPath) ?
String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);
// Package compatible with current Dynamo env
else
{
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);
}

var pmExt = DynamoViewModel.Model.GetPackageManagerExtension();
if (result == MessageBoxResult.OK)
Expand Down Expand Up @@ -898,8 +918,8 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,

var containsPackagesThatTargetOtherHosts = PackageManagerExtension.CheckIfPackagesTargetOtherHosts(newPackageHeaders);

// if any do, notify user and allow cancellation
if (containsPackagesThatTargetOtherHosts)
// if unknown compatibility, and package target other hosts, notify user and allow cancellation
if (compatible == null && containsPackagesThatTargetOtherHosts)
{
var res = MessageBoxService.Show(ViewModelOwner,
Resources.MessagePackageTargetOtherHosts,
Expand Down Expand Up @@ -957,11 +977,11 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
}
}
}
catch(ArgumentException ex)
catch (ArgumentException ex)
{
DynamoConsoleLogger.OnLogMessageToDynamoConsole($"exception while trying to compare version info between package and dynamo {ex}");
}
catch(FormatException ex)
catch (FormatException ex)
{
DynamoConsoleLogger.OnLogMessageToDynamoConsole($"exception while trying to compare version info between package and dynamo {ex}");
}
Expand Down
Loading