From 707705a08a5f0ef82ada48ed555c47a4c7070498 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 31 Jul 2023 08:12:32 +0100 Subject: [PATCH] CP-43000: Rename elements of `Status` enum Information -> Warning Warning -> Error Trial -> Passable Mixed -> Warning Signed-off-by: Danilo Del Busso --- .../LicenseCheckableDataGridView.cs | 6 +-- .../LicenseManager/LicenseDataGridViewRow.cs | 47 ++++++++++--------- .../Dialogs/LicenseManager/LicenseManager.cs | 8 ++-- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseCheckableDataGridView/LicenseCheckableDataGridView.cs b/XenAdmin/Dialogs/LicenseManager/LicenseCheckableDataGridView/LicenseCheckableDataGridView.cs index 75fcf3c0d..c0ec37d4e 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseCheckableDataGridView/LicenseCheckableDataGridView.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseCheckableDataGridView/LicenseCheckableDataGridView.cs @@ -92,13 +92,13 @@ namespace XenAdmin.Controls Value = new Bitmap(1, 1) }; - if (status == LicenseDataGridViewRow.Status.Information || status == LicenseDataGridViewRow.Status.Mixed) - cell.Value = Images.StaticImages._000_Alert2_h32bit_16; if (status == LicenseDataGridViewRow.Status.Warning) + cell.Value = Images.StaticImages._000_Alert2_h32bit_16; + if (status == LicenseDataGridViewRow.Status.Error) cell.Value = Images.StaticImages._000_error_h32bit_16; if (status == LicenseDataGridViewRow.Status.Ok) cell.Value = Images.StaticImages._000_Tick_h32bit_16; - if (status == LicenseDataGridViewRow.Status.Trial) + if (status == LicenseDataGridViewRow.Status.Passable) cell.Value = Images.StaticImages._000_Tick_yellow_h32bit_16; if (r.Cells[StatusImageColumn.Index] is DataGridViewImageCell) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs index 19ef3b5e8..76626711d 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseDataGridViewRow.cs @@ -42,15 +42,12 @@ namespace XenAdmin.Dialogs { public enum Status { + Error, Warning, - Information, Ok, Updating, // CP-43000: to be used for post Nile hosts using trial edition - Trial, - // CP-43000: to be used for hosts with mixed license and css - // status while they are NOT in preview post Nile - Mixed + Passable } private readonly ILicenseStatus licenseStatus; @@ -175,7 +172,7 @@ namespace XenAdmin.Dialogs if (XenObjectHost.CssLicenseHasExpired()) { - status = Status.Warning; + status = Status.Error; text = $"{Messages.LICENSE_MANAGER_EXPIRED_CSS_LONG}{Environment.NewLine}{Messages.EXPIRED_CSS_UPSELLING_MESSAGE_POOL}"; } else @@ -201,46 +198,50 @@ namespace XenAdmin.Dialogs case Dialogs.LicenseStatus.HostState.Free: { var pool = Helpers.GetPool(XenObjectHost.Connection); - if (Dialogs.LicenseStatus.PoolIsMixedFreeAndExpiring(pool)) - text = Messages.POOL_IS_PARTIALLY_LICENSED; - text = licenseStatus.LicenseEntitlements; - status = Helpers.CloudOrGreater(XenObjectHost) ? Status.Trial :Status.Warning; + text = Dialogs.LicenseStatus.PoolIsMixedFreeAndExpiring(pool) ? Messages.POOL_IS_PARTIALLY_LICENSED : licenseStatus.LicenseEntitlements; + status = Helpers.CloudOrGreater(XenObjectHost) ? Status.Passable :Status.Error; } break; case Dialogs.LicenseStatus.HostState.PartiallyLicensed: text = Messages.POOL_IS_PARTIALLY_LICENSED; - status = Status.Information; + status = Status.Warning; break; case Dialogs.LicenseStatus.HostState.Licensed: { var pool = Helpers.GetPool(XenObjectHost.Connection); if (Dialogs.LicenseStatus.PoolHasMixedLicenses(pool)) + { text = Messages.POOL_HAS_MIXED_LICENSES; - - if (Dialogs.LicenseStatus.PoolIsPartiallyLicensed(pool)) + } + else if (Dialogs.LicenseStatus.PoolIsPartiallyLicensed(pool)) + { text = Messages.POOL_IS_PARTIALLY_LICENSED; + } + else + { + text = licenseStatus.LicenseEntitlements; + } - text = licenseStatus.LicenseEntitlements; status = Status.Ok; } break; case Dialogs.LicenseStatus.HostState.Unavailable: text = Messages.LICENSE_EXPIRED_NO_LICENSES_AVAILABLE; - status = Status.Warning; + status = Status.Error; break; case Dialogs.LicenseStatus.HostState.Expired: text = Messages.LICENSE_YOUR_LICENCE_HAS_EXPIRED; - status = Status.Warning; + status = Status.Error; break; case Dialogs.LicenseStatus.HostState.RegularGrace: case Dialogs.LicenseStatus.HostState.UpgradeGrace: case Dialogs.LicenseStatus.HostState.ExpiresSoon: text = string.Format(Messages.LICENSE_YOUR_LICENCE_EXPIRES_IN, licenseStatus.LicenseExpiresIn.FuzzyTime()); - status = Status.Information; + status = Status.Warning; break; case Dialogs.LicenseStatus.HostState.Unknown: default: - status = licenseStatus.Updated ? Status.Information : Status.Updating; + status = licenseStatus.Updated ? Status.Warning : Status.Updating; text = Messages.UNKNOWN; return !licenseStatus.Updated; } @@ -249,10 +250,10 @@ namespace XenAdmin.Dialogs } public bool LicenseHelperUrlRequired => ShouldShowLicenseWarningText(out _, out var status) && - (status == Status.Warning || status == Status.Mixed || status == Status.Trial); + (status == Status.Error || status == Status.Warning || status == Status.Passable); - public bool SupportHelperUrlRequired => ShouldShowSupportWarningText(out _, out var status) && - (status == Status.Warning || status == Status.Mixed) && + public bool SupportHelperUrlRequired => ShouldShowSupportWarningText(out _, out var status) && + (status == Status.Error || status == Status.Warning) && !LicenseHelperUrlRequired; public Status RowStatus @@ -263,11 +264,11 @@ namespace XenAdmin.Dialogs ShouldShowSupportWarningText(out _, out var supportWarningStatus); if (!XenObjectHost.IsInPreviewRelease() && - (licenseWarningStatus != supportWarningStatus || licenseWarningStatus == Status.Trial && supportWarningStatus == Status.Warning) + (licenseWarningStatus != supportWarningStatus || licenseWarningStatus == Status.Passable && supportWarningStatus == Status.Error) ) { // will show a warning icon - return Status.Mixed; + return Status.Warning; } if (licenseWarningStatus != Status.Ok) diff --git a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs index e9f38efdf..d7f6fa8c3 100644 --- a/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs +++ b/XenAdmin/Dialogs/LicenseManager/LicenseManager.cs @@ -194,13 +194,13 @@ namespace XenAdmin.Dialogs summaryPanel.SummaryText = summaryComponent; switch (lRow.RowLicenseStatus) { - case LicenseDataGridViewRow.Status.Information: + case LicenseDataGridViewRow.Status.Warning: summaryPanel.LicenseWarningIcon = Images.StaticImages._000_Alert2_h32bit_16; break; - case LicenseDataGridViewRow.Status.Warning: + case LicenseDataGridViewRow.Status.Error: summaryPanel.LicenseWarningIcon = Images.StaticImages._000_error_h32bit_16; break; - case LicenseDataGridViewRow.Status.Trial: + case LicenseDataGridViewRow.Status.Passable: summaryPanel.LicenseWarningIcon = Images.StaticImages._000_Tick_yellow_h32bit_16; break; @@ -214,7 +214,7 @@ namespace XenAdmin.Dialogs case LicenseDataGridViewRow.Status.Ok: summaryPanel.SupportWarningIcon = Images.StaticImages._000_Tick_h32bit_16; break; - case LicenseDataGridViewRow.Status.Warning: + case LicenseDataGridViewRow.Status.Error: summaryPanel.SupportWarningIcon = Images.StaticImages._000_error_h32bit_16; break; default: