From afbfbaf8032dc475cad56b51e900383d8e40d3cf Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Tue, 15 Apr 2014 17:07:21 +0100 Subject: [PATCH 1/4] [CA-115256] Don't show the Buy Licenses link for pre-Clearwater servers --- XenAdmin/Dialogs/LicenseManager/LicenseManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs index 651125641..fb049daa6 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs @@ -37,6 +37,7 @@ using System.Windows.Forms; using XenAdmin.Controls; using XenAdmin.Controls.CheckableDataGridView; using XenAdmin.Controls.SummaryPanel; +using XenAdmin.Core; using XenAdmin.Properties; using XenAPI; @@ -205,7 +206,7 @@ namespace XenAdmin.Dialogs summaryPanel.Title = lRow.XenObject.Name; summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; - summaryPanel.HelperUrlVisible = true; + summaryPanel.HelperUrlVisible = Helpers.ClearwaterOrGreater(lRow.XenObject.Connection); // CA-115256 summaryPanel.WarningVisible = lRow.WarningRequired; summaryPanel.WarningText = lRow.WarningText; summaryPanel.SummaryText = summaryComponent; From 5d722be866d3873ca758c3e4c88dc16d2aad293a Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Tue, 15 Apr 2014 17:46:56 +0100 Subject: [PATCH 2/4] Improvement to check-in for [CA-115256]: move logic out of the display into the LicenseRow --- XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs | 5 +++++ XenAdmin/Dialogs/LicenseManager/LicenseManager.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs index 26851ddc3..73c7a2066 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs @@ -221,6 +221,11 @@ namespace XenAdmin.Dialogs } } + public bool HelperUrlRequired + { + get { return Helpers.ClearwaterOrGreater(XenObject.Connection); } // CA-115256 + } + public Status RowStatus { get diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs index fb049daa6..a5ef5bd63 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs @@ -206,7 +206,7 @@ namespace XenAdmin.Dialogs summaryPanel.Title = lRow.XenObject.Name; summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; - summaryPanel.HelperUrlVisible = Helpers.ClearwaterOrGreater(lRow.XenObject.Connection); // CA-115256 + summaryPanel.HelperUrlVisible = lRow.HelperUrlRequired; summaryPanel.WarningVisible = lRow.WarningRequired; summaryPanel.WarningText = lRow.WarningText; summaryPanel.SummaryText = summaryComponent; From 75464110de2a02bd8ca2dd9b7404083b7d7c5e87 Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Tue, 15 Apr 2014 17:49:03 +0100 Subject: [PATCH 3/4] Improvement to check-in for [CA-115256]: remove unused dependency --- XenAdmin/Dialogs/LicenseManager/LicenseManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs index a5ef5bd63..3a51cad4b 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs @@ -37,7 +37,6 @@ using System.Windows.Forms; using XenAdmin.Controls; using XenAdmin.Controls.CheckableDataGridView; using XenAdmin.Controls.SummaryPanel; -using XenAdmin.Core; using XenAdmin.Properties; using XenAPI; From 75bb8fa8f0f2304f01af97630bbfdec6cc8dc476 Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Wed, 16 Apr 2014 09:13:20 +0100 Subject: [PATCH 4/4] [CA-115256] Add null check as suggested by code review --- XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs | 2 +- XenAdmin/Dialogs/LicenseManager/LicenseManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs index 73c7a2066..8f6104a3f 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs @@ -223,7 +223,7 @@ namespace XenAdmin.Dialogs public bool HelperUrlRequired { - get { return Helpers.ClearwaterOrGreater(XenObject.Connection); } // CA-115256 + get { return XenObject == null ? false : Helpers.ClearwaterOrGreater(XenObject.Connection); } // CA-115256 } public Status RowStatus diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs index 3a51cad4b..7f76c476a 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs @@ -200,7 +200,7 @@ namespace XenAdmin.Dialogs Program.Invoke(this, delegate { LicenseDataGridViewRow lRow = row as LicenseDataGridViewRow; - if(lRow == null) + if(lRow == null || lRow.XenObject == null) return; summaryPanel.Title = lRow.XenObject.Name;