Remove redundant "Push to selected pods now" checkbox from Add Product
Deployment intent is now implied by the install package field: if a package is supplied the product is installed to the selected pods after being added; if not, it is only added to the catalog. Removes the checkbox (dlgAddProduct) and the push-decision branch (AddProduct_Click). The register-only-without-package path is retired with it, so the now-dead RegisterProductOnSelectedPods is removed too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1023,56 +1023,21 @@ public class SiteManagement : Form
|
||||
AppRegistry.AddProduct(dialog.Product);
|
||||
BuildInstallProductMenu();
|
||||
|
||||
if (!dialog.PushNow)
|
||||
// A package means "deploy now" — install it (file transfer + entry registration on
|
||||
// completion) to the selected pods. No package → the product is only added to the catalog.
|
||||
if (dialog.PackagePath == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (dialog.PackagePath != null)
|
||||
{
|
||||
// Package supplied → full install (file transfer + entry registration on completion).
|
||||
foreach (int podIndex in SelectedInstallablePodIndices())
|
||||
{
|
||||
mPods[podIndex].Install_CustomResolution = null;
|
||||
mPods[podIndex].Install_HostTypes = new List<PodInstallType>();
|
||||
InstallProduct(podIndex, dialog.Product.Id, dialog.PackagePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RegisterProductOnSelectedPods(dialog.Product);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Pushes a catalog product's launch entries to selected connected pods without installing files.</summary>
|
||||
private void RegisterProductOnSelectedPods(ProductDefinition product)
|
||||
{
|
||||
int pushed = 0;
|
||||
int skipped = 0;
|
||||
foreach (int podIndex in SelectedInstallablePodIndices())
|
||||
{
|
||||
PodData pod = mPods[podIndex];
|
||||
if (!pod.Conn.IsConnected)
|
||||
{
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
foreach (LaunchEntryDefinition entry in product.Entries)
|
||||
{
|
||||
pod.Conn.AddApp(entry.ToLaunchData(null));
|
||||
}
|
||||
pod.Status = "Registered " + product.Name;
|
||||
dgvPods.InvalidateCell(colOperationProgress.Index, podIndex);
|
||||
pushed++;
|
||||
}
|
||||
if (skipped > 0)
|
||||
{
|
||||
MessageBox.Show(this,
|
||||
$"Registered \"{product.Name}\" on {pushed} pod(s). {skipped} selected pod(s) were skipped because they are not connected.",
|
||||
"Register Product", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
mPods[podIndex].Install_CustomResolution = null;
|
||||
mPods[podIndex].Install_HostTypes = new List<PodInstallType>();
|
||||
InstallProduct(podIndex, dialog.Product.Id, dialog.PackagePath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Indices of selected rows that are local, idle pods eligible for install/registration.</summary>
|
||||
/// <summary>Indices of selected rows that are local, idle pods eligible for install.</summary>
|
||||
private IEnumerable<int> SelectedInstallablePodIndices()
|
||||
{
|
||||
foreach (DataGridViewRow selectedRow in dgvPods.SelectedRows)
|
||||
|
||||
@@ -24,8 +24,6 @@ internal class dlgAddProduct : Form
|
||||
|
||||
private CheckBox chkAutoRestart;
|
||||
|
||||
private CheckBox chkPushNow;
|
||||
|
||||
private Button cmdOK;
|
||||
|
||||
private Button cmdCancel;
|
||||
@@ -33,12 +31,10 @@ internal class dlgAddProduct : Form
|
||||
/// <summary>The product the operator defined. Valid only after the dialog returns <see cref="DialogResult.OK"/>.</summary>
|
||||
public ProductDefinition Product { get; private set; }
|
||||
|
||||
/// <summary>Optional install package (zip) to deploy with the entry; null/empty for entry-only.</summary>
|
||||
/// <summary>Optional install package (zip). If set, the product is deployed to the
|
||||
/// selected pods after it is added; if null/empty, it is only added to the catalog.</summary>
|
||||
public string PackagePath => string.IsNullOrWhiteSpace(txtPackage.Text) ? null : txtPackage.Text.Trim();
|
||||
|
||||
/// <summary>Whether to push the new product to the currently selected pods after adding it.</summary>
|
||||
public bool PushNow => chkPushNow.Checked;
|
||||
|
||||
public dlgAddProduct()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -52,7 +48,6 @@ internal class dlgAddProduct : Form
|
||||
this.txtArgs = new TextBox();
|
||||
this.txtPackage = new TextBox();
|
||||
this.chkAutoRestart = new CheckBox();
|
||||
this.chkPushNow = new CheckBox();
|
||||
this.cmdOK = new Button();
|
||||
this.cmdCancel = new Button();
|
||||
base.SuspendLayout();
|
||||
@@ -90,11 +85,6 @@ internal class dlgAddProduct : Form
|
||||
this.chkAutoRestart.SetBounds(fieldX, y, 200, 20);
|
||||
this.chkAutoRestart.Text = "Auto-restart if it exits";
|
||||
this.chkAutoRestart.Checked = true;
|
||||
y += 24;
|
||||
|
||||
this.chkPushNow.SetBounds(fieldX, y, 280, 20);
|
||||
this.chkPushNow.Text = "Push to selected pods now";
|
||||
this.chkPushNow.Checked = true;
|
||||
y += 36;
|
||||
|
||||
this.cmdOK.SetBounds(browseX - 169, y, 80, 24);
|
||||
@@ -118,7 +108,6 @@ internal class dlgAddProduct : Form
|
||||
base.Controls.Add(this.txtArgs);
|
||||
base.Controls.Add(this.txtPackage);
|
||||
base.Controls.Add(this.chkAutoRestart);
|
||||
base.Controls.Add(this.chkPushNow);
|
||||
base.Controls.Add(this.cmdOK);
|
||||
base.Controls.Add(this.cmdCancel);
|
||||
base.Name = "dlgAddProduct";
|
||||
|
||||
Reference in New Issue
Block a user