From 55ff3794cf084f725027865a18159d76a5720832 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Fri, 1 Jul 2016 17:41:49 +0100 Subject: [PATCH 1/3] CA-214063: Batch Updates: Name of the master is shown instead of the pool's name on Select Servers Page Fixed display issue, now showing pools (and standalone hosts at the same level), not masters. Signed-off-by: Gabor Apati-Nagy --- .../Wizards/PatchingWizard/PatchingWizard.cs | 2 +- .../PatchingWizard_AutoUpdatingPage.cs | 15 +++++++---- .../PatchingWizard_SelectServers.cs | 27 ++++++++++++++++--- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs index 8e40f2dd0..bcabca699 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs @@ -167,7 +167,7 @@ namespace XenAdmin.Wizards.PatchingWizard PatchingWizard_UploadPage.SelectedMasters = PatchingWizard_SelectServers.SelectedMasters; PatchingWizard_UploadPage.SelectedServers = selectedServers; - PatchingWizard_AutoUpdatingPage.SelectedMasters = PatchingWizard_SelectServers.SelectedMasters; + PatchingWizard_AutoUpdatingPage.SelectedPools = PatchingWizard_SelectServers.SelectedPools; } else if (prevPageType == typeof(PatchingWizard_UploadPage)) { diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutoUpdatingPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutoUpdatingPage.cs index c6e17f1ef..136041747 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutoUpdatingPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_AutoUpdatingPage.cs @@ -59,7 +59,7 @@ namespace XenAdmin.Wizards.PatchingWizard public List ProblemsResolvedPreCheck { private get; set; } - public List SelectedMasters { private get; set; } + public List SelectedPools { private get; set; } private List patchMappings = new List(); public Dictionary AllDownloadedPatches = new Dictionary(); @@ -136,21 +136,23 @@ namespace XenAdmin.Wizards.PatchingWizard Dictionary> planActionsPerPool = new Dictionary>(); - foreach (var master in SelectedMasters) + foreach (var pool in SelectedPools) { + var master = Helpers.GetMaster(pool.Connection); + Dictionary> planActionsByHost = new Dictionary>(); Dictionary> delayedActionsByHost = new Dictionary>(); planActionsPerPool.Add(master, new List()); - foreach (var host in master.Connection.Cache.Hosts) + foreach (var host in pool.Connection.Cache.Hosts) { planActionsByHost.Add(host, new List()); delayedActionsByHost.Add(host, new List()); } - var hosts = master.Connection.Cache.Hosts; + var hosts = pool.Connection.Cache.Hosts; - var us = Updates.GetUpgradeSequence(master.Connection); + var us = Updates.GetUpgradeSequence(pool.Connection); foreach (var patch in us.UniquePatches) { @@ -288,6 +290,9 @@ namespace XenAdmin.Wizards.PatchingWizard } textBoxLog.Text = sb.ToString(); + + textBoxLog.SelectionStart = textBoxLog.Text.Length; + textBoxLog.ScrollToCaret(); } private void WorkerDoWork(object sender, DoWorkEventArgs doWorkEventArgs) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs index 6a7d406e1..c32b8f1af 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs @@ -96,6 +96,17 @@ namespace XenAdmin.Wizards.PatchingWizard List selectedServers = SelectedServers; dataGridViewHosts.Rows.Clear(); + + if (IsInAutomaticMode) + { + //hides expand column + dataGridViewHosts.Columns[0].Visible = false; + } + else + { + dataGridViewHosts.Columns[0].Visible = true; + } + List xenConnections = ConnectionsManager.XenConnectionsCopy; xenConnections.Sort(); foreach (IXenConnection xenConnection in xenConnections) @@ -105,9 +116,10 @@ namespace XenAdmin.Wizards.PatchingWizard if (!xenConnection.IsConnected) continue; - var host = Helpers.GetMaster(xenConnection); - int index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(host, false)); - EnabledRow(host, SelectedUpdateType, index); + var pool = Helpers.GetPoolOfOne(xenConnection); + Host master = pool.Connection.Resolve(pool.master); + int index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool, true)); + EnabledRow(master, SelectedUpdateType, index); } else { @@ -467,6 +479,10 @@ namespace XenAdmin.Wizards.PatchingWizard else if ((int)row.Cells[POOL_CHECKBOX_COL].Value != value) dataGridViewHosts.CheckBoxChange(row.Index, POOL_CHECKBOX_COL); } + if (IsInAutomaticMode && row.Tag is Pool) + { + dataGridViewHosts.CheckBoxChange(row.Index, POOL_CHECKBOX_COL); + } } } @@ -618,6 +634,8 @@ namespace XenAdmin.Wizards.PatchingWizard private class PatchingHostsDataGridViewRow : CollapsingPoolHostDataGridViewRow { + public bool AutomaticMode = false; + private class DataGridViewNameCell : DataGridViewExNameCell { protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) @@ -709,9 +727,10 @@ namespace XenAdmin.Wizards.PatchingWizard private DataGridViewCell _poolIconHostCheckCell; private DataGridViewTextBoxCell _versionCell; - public PatchingHostsDataGridViewRow(Pool pool) + public PatchingHostsDataGridViewRow(Pool pool, bool automaticMode = false) : base(pool) { + AutomaticMode = automaticMode; SetupCells(); } From 504f73778f9010b4784d8726539663da947c7db2 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Tue, 5 Jul 2016 10:42:49 +0100 Subject: [PATCH 2/3] CA-214063: Batch Updates: Name of the master is shown instead of the pool's name on Select Servers Page Code review changes: Showing server icon for standalone hosts instead the pool icon Signed-off-by: Gabor Apati-Nagy --- .../PatchingWizard/PatchingWizard_SelectServers.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs index c32b8f1af..1cc2a7cf1 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs @@ -118,7 +118,17 @@ namespace XenAdmin.Wizards.PatchingWizard var pool = Helpers.GetPoolOfOne(xenConnection); Host master = pool.Connection.Resolve(pool.master); - int index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool, true)); + + int index = -1; + if (Helpers.GetPool(xenConnection) != null) //pools + { + index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool, true)); + } + else //standalone hosts + { + index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(master, false)); + } + EnabledRow(master, SelectedUpdateType, index); } else From 1fe300c16d1502fb1a67eb5743bb178da67c0ec4 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Tue, 5 Jul 2016 11:00:40 +0100 Subject: [PATCH 3/3] CA-214063: Batch Updates: Name of the master is shown Removed unused field Signed-off-by: Gabor Apati-Nagy --- .../Wizards/PatchingWizard/PatchingWizard_SelectServers.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs index 1cc2a7cf1..4e4ccc3c3 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs @@ -122,7 +122,7 @@ namespace XenAdmin.Wizards.PatchingWizard int index = -1; if (Helpers.GetPool(xenConnection) != null) //pools { - index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool, true)); + index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool)); } else //standalone hosts { @@ -644,8 +644,6 @@ namespace XenAdmin.Wizards.PatchingWizard private class PatchingHostsDataGridViewRow : CollapsingPoolHostDataGridViewRow { - public bool AutomaticMode = false; - private class DataGridViewNameCell : DataGridViewExNameCell { protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) @@ -737,10 +735,9 @@ namespace XenAdmin.Wizards.PatchingWizard private DataGridViewCell _poolIconHostCheckCell; private DataGridViewTextBoxCell _versionCell; - public PatchingHostsDataGridViewRow(Pool pool, bool automaticMode = false) + public PatchingHostsDataGridViewRow(Pool pool) : base(pool) { - AutomaticMode = automaticMode; SetupCells(); }