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

Pm reset selected known hosts #14722

Merged
Merged
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
Expand Down Expand Up @@ -92,7 +93,7 @@ public DynamoViewModel DynamoViewModel
/// <summary>
/// Package Publish entry, binded to the host multi-selection option
/// </summary>
public class HostComboboxEntry
public class HostComboboxEntry : NotificationObject
{
/// <summary>
/// Name of the host
Expand All @@ -102,7 +103,16 @@ public class HostComboboxEntry
/// <summary>
/// Boolean indicates if the host entry is selected
/// </summary>
public bool IsSelected { get; set; }
private bool _isSelected;
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
RaisePropertyChanged(nameof(IsSelected));
}
}

/// <summary>
/// Constructor
Expand All @@ -113,6 +123,14 @@ public HostComboboxEntry(string hostName)
HostName = hostName;
IsSelected = false;
}

/// <summary>
/// Reset the state of the `IsSelected` property without raising update
/// </summary>
internal void ResetState()
{
this._isSelected = false;
}
}

public Window Owner { get; set; }
Expand Down Expand Up @@ -190,6 +208,7 @@ public bool IsNewVersion
{
_isNewVersion = value;
RaisePropertyChanged("IsNewVersion");
RaisePropertyChanged("CanEditName");
}
}
}
Expand Down Expand Up @@ -1105,6 +1124,14 @@ public PublishPackageViewModel( DynamoViewModel dynamoViewModel ) : this()
private void ClearAllEntries()
{
if (DynamoModel.IsTestMode) return;

try
{
this.KnownHosts.ForEach(host => host.ResetState());
this.KnownHosts.ForEach(host => host.IsSelected = false);
}
catch { Exception ex; }

// this function clears all the entries of the publish package dialog
this.Name = string.Empty;
this.RepositoryUrl = string.Empty;
Expand Down Expand Up @@ -1134,8 +1161,8 @@ private void ClearAllEntries()
this.AdditionalFiles = new ObservableCollection<string>();
this.Dependencies = new ObservableCollection<PackageDependency>();
this.Assemblies = new List<PackageAssembly>();
this.SelectedHostsString = string.Empty;
this.SelectedHosts = new List<String>();
this.SelectedHostsString = string.Empty;
this.copyrightHolder = string.Empty;
this.copyrightYear = string.Empty;
this.RootFolder = string.Empty;
Expand Down Expand Up @@ -1470,12 +1497,13 @@ internal IEnumerable<string> GetAllFiles()
private void UpdateDependencies()
{
Dependencies.Clear();
GetAllDependencies().ToList().ForEach(Dependencies.Add);
GetAllDependencies()?.ToList().ForEach(Dependencies.Add);
}

private IEnumerable<PackageDependency> GetAllDependencies()
{
var pmExtension = dynamoViewModel.Model.GetPackageManagerExtension();
if (pmExtension == null) return null;
var pkgLoader = pmExtension.PackageLoader;

// all workspaces
Expand Down Expand Up @@ -2160,7 +2188,7 @@ private IEnumerable<string> BuildPackage()
AppendPackageContents();

Package.Dependencies.Clear();
GetAllDependencies().ToList().ForEach(Package.Dependencies.Add);
GetAllDependencies()?.ToList().ForEach(Package.Dependencies.Add);

Package.HostDependencies = Enumerable.Empty<string>();
Package.HostDependencies = SelectedHosts;
Expand Down
Loading