mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
CP-43000: Show both support and license statuses in License Manager
Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
parent
184bf9831a
commit
b7a9716bb8
@ -41,8 +41,8 @@
|
||||
this.informationLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.informationImage = new System.Windows.Forms.PictureBox();
|
||||
this.informationLabel = new System.Windows.Forms.Label();
|
||||
this.licenseHelperLinkLabel = new System.Windows.Forms.LinkLabel();
|
||||
this.helperLinksFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.licenseHelperLinkLabel = new System.Windows.Forms.LinkLabel();
|
||||
this.supportHelperLinkLabel = new System.Windows.Forms.LinkLabel();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.supportWarningTableLayoutPanel.SuspendLayout();
|
||||
@ -59,8 +59,8 @@
|
||||
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
|
||||
this.tableLayoutPanel1.Controls.Add(this.titleLabel, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.information, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.supportWarningTableLayoutPanel, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.licenseWarningTableLayoutPabel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.supportWarningTableLayoutPanel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.licenseWarningTableLayoutPabel, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.informationLayoutPanel, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.helperLinksFlowLayoutPanel, 0, 6);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
@ -133,12 +133,6 @@
|
||||
this.informationLabel.AutoEllipsis = true;
|
||||
this.informationLabel.Name = "informationLabel";
|
||||
//
|
||||
// licenseHelperLinkLabel
|
||||
//
|
||||
this.licenseHelperLinkLabel.AutoEllipsis = true;
|
||||
resources.ApplyResources(this.licenseHelperLinkLabel, "licenseHelperLinkLabel");
|
||||
this.licenseHelperLinkLabel.Name = "licenseHelperLinkLabel";
|
||||
//
|
||||
// helperLinksFlowLayoutPanel
|
||||
//
|
||||
this.helperLinksFlowLayoutPanel.Controls.Add(this.licenseHelperLinkLabel);
|
||||
@ -146,6 +140,12 @@
|
||||
resources.ApplyResources(this.helperLinksFlowLayoutPanel, "helperLinksFlowLayoutPanel");
|
||||
this.helperLinksFlowLayoutPanel.Name = "helperLinksFlowLayoutPanel";
|
||||
//
|
||||
// licenseHelperLinkLabel
|
||||
//
|
||||
this.licenseHelperLinkLabel.AutoEllipsis = true;
|
||||
resources.ApplyResources(this.licenseHelperLinkLabel, "licenseHelperLinkLabel");
|
||||
this.licenseHelperLinkLabel.Name = "licenseHelperLinkLabel";
|
||||
//
|
||||
// supportHelperLinkLabel
|
||||
//
|
||||
this.supportHelperLinkLabel.AutoEllipsis = true;
|
||||
|
@ -183,6 +183,9 @@
|
||||
<data name=">>information.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="supportWarningTableLayoutPanel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="supportWarningTableLayoutPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
@ -253,10 +256,7 @@
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="supportWarningTableLayoutPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 55</value>
|
||||
</data>
|
||||
<data name="supportWarningTableLayoutPanel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 3, 0</value>
|
||||
<value>3, 109</value>
|
||||
</data>
|
||||
<data name="supportWarningTableLayoutPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@ -355,10 +355,7 @@
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="licenseWarningTableLayoutPabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 100</value>
|
||||
</data>
|
||||
<data name="licenseWarningTableLayoutPabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 3, 0</value>
|
||||
<value>3, 58</value>
|
||||
</data>
|
||||
<data name="licenseWarningTableLayoutPabel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@ -384,6 +381,9 @@
|
||||
<data name="licenseWarningTableLayoutPabel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="licenseWarningImage" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="licenseWarningLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100,Absolute,45" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
@ -424,7 +424,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="informationLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>25, 13</value>
|
||||
<value>25, 44</value>
|
||||
</data>
|
||||
<data name="informationLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 13</value>
|
||||
@ -444,14 +444,17 @@
|
||||
<data name=">>informationLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 148</value>
|
||||
<value>3, 160</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>229, 40</value>
|
||||
<value>229, 102</value>
|
||||
</data>
|
||||
<data name="informationLayoutPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
@ -583,7 +586,7 @@
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="titleLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="information" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="supportWarningTableLayoutPanel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="licenseWarningTableLayoutPabel" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="informationLayoutPanel" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="helperLinksFlowLayoutPanel" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,Absolute,30" /></TableLayoutSettings></value>
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="titleLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="information" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="supportWarningTableLayoutPanel" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="licenseWarningTableLayoutPabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="informationLayoutPanel" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="helperLinksFlowLayoutPanel" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,Absolute,30" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
|
@ -31,6 +31,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using XenAdmin.Controls.CheckableDataGridView;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
@ -80,10 +81,10 @@ namespace XenAdmin.Dialogs
|
||||
Disabled = true;
|
||||
|
||||
Queue<object> cellDetails = new Queue<object>();
|
||||
cellDetails.Enqueue(XenObject.Name());
|
||||
cellDetails.Enqueue(XenObject?.Name());
|
||||
cellDetails.Enqueue(LicenseName);
|
||||
cellDetails.Enqueue(new Bitmap(1,1));
|
||||
cellDetails.Enqueue(LicenseStatus);
|
||||
cellDetails.Enqueue(OverallStatus);
|
||||
return cellDetails;
|
||||
}
|
||||
}
|
||||
@ -136,92 +137,151 @@ namespace XenAdmin.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
public override bool LicenseWarningRequired
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!licenseStatus.Updated)
|
||||
return false;
|
||||
|
||||
if (CurrentLicenseState == Dialogs.LicenseStatus.HostState.Unknown)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override bool LicenseWarningRequired => ShouldShowLicenseWarningText(out _, out _);
|
||||
|
||||
public override string LicenseWarningText
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (CurrentLicenseState)
|
||||
{
|
||||
case Dialogs.LicenseStatus.HostState.Free:
|
||||
{
|
||||
Pool pool = Helpers.GetPool(XenObjectHost.Connection);
|
||||
if (Dialogs.LicenseStatus.PoolIsMixedFreeAndExpiring(pool))
|
||||
return Messages.POOL_IS_PARTIALLY_LICENSED;
|
||||
return licenseStatus.LicenseEntitlements;
|
||||
}
|
||||
case Dialogs.LicenseStatus.HostState.PartiallyLicensed:
|
||||
return Messages.POOL_IS_PARTIALLY_LICENSED;
|
||||
case Dialogs.LicenseStatus.HostState.Licensed:
|
||||
{
|
||||
Pool pool = Helpers.GetPool(XenObjectHost.Connection);
|
||||
if (Dialogs.LicenseStatus.PoolHasMixedLicenses(pool))
|
||||
return Messages.POOL_HAS_MIXED_LICENSES;
|
||||
|
||||
if (Dialogs.LicenseStatus.PoolIsPartiallyLicensed(pool))
|
||||
return Messages.POOL_IS_PARTIALLY_LICENSED;
|
||||
|
||||
return licenseStatus.LicenseEntitlements;
|
||||
}
|
||||
case Dialogs.LicenseStatus.HostState.Unavailable:
|
||||
return Messages.LICENSE_EXPIRED_NO_LICENSES_AVAILABLE;
|
||||
case Dialogs.LicenseStatus.HostState.Expired:
|
||||
return Messages.LICENSE_YOUR_LICENCE_HAS_EXPIRED;
|
||||
case Dialogs.LicenseStatus.HostState.RegularGrace:
|
||||
case Dialogs.LicenseStatus.HostState.UpgradeGrace:
|
||||
case Dialogs.LicenseStatus.HostState.ExpiresSoon:
|
||||
return string.Format(Messages.LICENSE_YOUR_LICENCE_EXPIRES_IN, licenseStatus.LicenseExpiresIn.FuzzyTime());
|
||||
default:
|
||||
return Messages.UNKNOWN;
|
||||
}
|
||||
var _ = ShouldShowLicenseWarningText(out var text, out var _);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SupportWarningRequired => XenObjectHost?.CssLicenseHasExpired() ?? false;
|
||||
public override bool SupportWarningRequired => ShouldShowSupportWarningText(out _, out _);
|
||||
|
||||
public override string SupportWarningText => "css expired!";
|
||||
public override string SupportWarningText
|
||||
{
|
||||
get
|
||||
{
|
||||
var _ = ShouldShowSupportWarningText(out var text, out var _);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LicenseHelperUrlRequired => XenObject != null;
|
||||
private bool ShouldShowSupportWarningText(out string text, out Status status)
|
||||
{
|
||||
text = null;
|
||||
status = Status.Ok;
|
||||
if (XenObjectHost == null || XenObjectHost.IsInPreviewRelease() || !Helpers.Post82X(XenObjectHost))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SupportHelperUrlRequired => XenObject != null;
|
||||
if (XenObjectHost.CssLicenseHasExpired())
|
||||
{
|
||||
status = Status.Warning;
|
||||
text = $"{Messages.LICENSE_MANAGER_EXPIRED_CSS_LONG}{Environment.NewLine}{Messages.EXPIRED_CSS_UPSELLING_MESSAGE_POOL}";
|
||||
}
|
||||
else
|
||||
{
|
||||
status = Status.Ok;
|
||||
text = Messages.LICENSE_MANAGER_ACTIVE_CSS_LONG;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ShouldShowLicenseWarningText(out string text, out Status status)
|
||||
{
|
||||
text = null;
|
||||
status = Status.Ok;
|
||||
if (XenObjectHost == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (CurrentLicenseState)
|
||||
{
|
||||
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.Post82X(XenObjectHost) && XenObjectHost.IsInPreviewRelease() ? Status.Ok : Status.Warning;
|
||||
}
|
||||
break;
|
||||
case Dialogs.LicenseStatus.HostState.PartiallyLicensed:
|
||||
text = Messages.POOL_IS_PARTIALLY_LICENSED;
|
||||
status = Status.Information;
|
||||
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))
|
||||
text = Messages.POOL_IS_PARTIALLY_LICENSED;
|
||||
|
||||
text = licenseStatus.LicenseEntitlements;
|
||||
status = Status.Ok;
|
||||
}
|
||||
break;
|
||||
case Dialogs.LicenseStatus.HostState.Unavailable:
|
||||
text = Messages.LICENSE_EXPIRED_NO_LICENSES_AVAILABLE;
|
||||
status = Status.Warning;
|
||||
break;
|
||||
case Dialogs.LicenseStatus.HostState.Expired:
|
||||
text = Messages.LICENSE_YOUR_LICENCE_HAS_EXPIRED;
|
||||
status = Status.Warning;
|
||||
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;
|
||||
break;
|
||||
case Dialogs.LicenseStatus.HostState.Unknown:
|
||||
default:
|
||||
status = licenseStatus.Updated ? Status.Information : Status.Updating;
|
||||
text = Messages.UNKNOWN;
|
||||
return !licenseStatus.Updated;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool LicenseHelperUrlRequired => ShouldShowLicenseWarningText(out _, out var status) && status == Status.Warning;
|
||||
|
||||
public bool SupportHelperUrlRequired => ShouldShowSupportWarningText(out _, out var status) && status == Status.Warning;
|
||||
|
||||
public Status RowStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (CurrentLicenseState)
|
||||
ShouldShowLicenseWarningText(out _, out var licenseWarningStatus);
|
||||
if (licenseWarningStatus != Status.Ok)
|
||||
{
|
||||
case Dialogs.LicenseStatus.HostState.Unavailable:
|
||||
case Dialogs.LicenseStatus.HostState.Expired:
|
||||
case Dialogs.LicenseStatus.HostState.Free:
|
||||
return Status.Warning;
|
||||
case Dialogs.LicenseStatus.HostState.Licensed:
|
||||
return Status.Ok;
|
||||
case Dialogs.LicenseStatus.HostState.PartiallyLicensed:
|
||||
case Dialogs.LicenseStatus.HostState.RegularGrace:
|
||||
case Dialogs.LicenseStatus.HostState.UpgradeGrace:
|
||||
case Dialogs.LicenseStatus.HostState.ExpiresSoon:
|
||||
return Status.Information;
|
||||
case Dialogs.LicenseStatus.HostState.Unknown:
|
||||
if (!licenseStatus.Updated)
|
||||
return Status.Updating;
|
||||
return Status.Information;
|
||||
default:
|
||||
return Status.Information;
|
||||
return licenseWarningStatus;
|
||||
}
|
||||
|
||||
ShouldShowSupportWarningText(out _, out var supportWarningStatus);
|
||||
if (supportWarningStatus != Status.Ok)
|
||||
{
|
||||
return supportWarningStatus;
|
||||
}
|
||||
|
||||
return Status.Ok;
|
||||
}
|
||||
}
|
||||
|
||||
public Status RowLicenseStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
var _ = ShouldShowLicenseWarningText(out var _, out var status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
public Status RowSupportStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
var _ = ShouldShowSupportWarningText(out var _, out var status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,6 +390,20 @@ namespace XenAdmin.Dialogs
|
||||
get { return licenseStatus.LicenseEdition; }
|
||||
}
|
||||
|
||||
private string OverallStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
var statuses = new[]
|
||||
{
|
||||
LicenseStatus,
|
||||
SupportStatus
|
||||
};
|
||||
|
||||
return string.Join("; ", statuses.Where((s) => !string.IsNullOrEmpty(s)));
|
||||
}
|
||||
}
|
||||
|
||||
private string LicenseStatus
|
||||
{
|
||||
get
|
||||
@ -359,6 +433,19 @@ namespace XenAdmin.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
private string SupportStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ShouldShowSupportWarningText(out _, out var supportWarningStatus))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return supportWarningStatus == Status.Ok ? Messages.LICENSE_MANAGER_ACTIVE_CSS : Messages.LICENSE_MANAGER_EXPIRED_CSS;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Host> RepresentedHosts
|
||||
{
|
||||
get
|
||||
|
@ -183,7 +183,7 @@ namespace XenAdmin.Dialogs
|
||||
|
||||
summaryPanel.Title = lRow.XenObject.Name();
|
||||
summaryPanel.LicenseHelperUrlText = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT;
|
||||
summaryPanel.SupportHelperUrlText = "Purchase support...";
|
||||
summaryPanel.SupportHelperUrlText = Messages.LICENSE_MANAGER_PURCHASE_SUPPORT_LINK_TEXT;
|
||||
summaryPanel.LicenseHelperUrlVisible = lRow.LicenseHelperUrlRequired && !Controller.ReadOnlyView;
|
||||
summaryPanel.SupportHelperUrlVisible = lRow.SupportHelperUrlRequired &&
|
||||
!Controller.ReadOnlyView;
|
||||
@ -192,16 +192,29 @@ namespace XenAdmin.Dialogs
|
||||
summaryPanel.LicenseWarningText = lRow.LicenseWarningText;
|
||||
summaryPanel.SupportWarningText = lRow.SupportWarningText;
|
||||
summaryPanel.SummaryText = summaryComponent;
|
||||
switch (lRow.RowStatus)
|
||||
switch (lRow.RowLicenseStatus)
|
||||
{
|
||||
case LicenseDataGridViewRow.Status.Information:
|
||||
summaryPanel.LicenseWarningIcon = summaryPanel.SupportWarningIcon = Images.StaticImages._000_Alert2_h32bit_16;
|
||||
summaryPanel.LicenseWarningIcon = Images.StaticImages._000_Alert2_h32bit_16;
|
||||
break;
|
||||
case LicenseDataGridViewRow.Status.Warning:
|
||||
summaryPanel.LicenseWarningIcon = summaryPanel.SupportWarningIcon = Images.StaticImages._000_error_h32bit_16;
|
||||
summaryPanel.LicenseWarningIcon = Images.StaticImages._000_error_h32bit_16;
|
||||
break;
|
||||
default:
|
||||
summaryPanel.LicenseWarningIcon = summaryPanel.SupportWarningIcon = Images.StaticImages._000_Tick_h32bit_16;
|
||||
summaryPanel.LicenseWarningIcon = Images.StaticImages._000_Tick_h32bit_16;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (lRow.RowSupportStatus)
|
||||
{
|
||||
case LicenseDataGridViewRow.Status.Ok:
|
||||
summaryPanel.SupportWarningIcon = Images.StaticImages._000_Tick_h32bit_16;
|
||||
break;
|
||||
case LicenseDataGridViewRow.Status.Warning:
|
||||
summaryPanel.SupportWarningIcon = Images.StaticImages._000_error_h32bit_16;
|
||||
break;
|
||||
default:
|
||||
summaryPanel.SupportWarningIcon = Images.StaticImages._000_Tick_h32bit_16;
|
||||
break;
|
||||
}
|
||||
summaryPanel.InformationVisible = false;
|
||||
|
@ -334,9 +334,9 @@ namespace XenAdmin.Dialogs
|
||||
{
|
||||
var hosts = XenObject.Connection.Cache.Hosts;
|
||||
var entitlements = new List<string>();
|
||||
string supportLevel = null;
|
||||
if (CurrentState == HostState.Licensed)
|
||||
{
|
||||
string supportLevel = null;
|
||||
if (hosts.All(h => h.EnterpriseFeaturesEnabled()))
|
||||
supportLevel = Messages.LICENSE_ENTERPRISE_FEATURES_ENABLED;
|
||||
else if (hosts.All(h => h.DesktopPlusFeaturesEnabled()))
|
||||
@ -354,23 +354,26 @@ namespace XenAdmin.Dialogs
|
||||
|
||||
if (supportLevel != null)
|
||||
{
|
||||
entitlements.Add(Messages.LICENSE_ELIGIBLE_FOR_SUPPORT);
|
||||
entitlements.Add(hosts.Any(Helpers.Post82X) ? Messages.LICENSE_MANAGER_LICENSED : Messages.LICENSE_ELIGIBLE_FOR_SUPPORT);
|
||||
entitlements.Add(supportLevel);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentState == HostState.Free || string.IsNullOrEmpty(supportLevel))
|
||||
{
|
||||
if (hosts.Any(Helpers.Post82X))
|
||||
{
|
||||
// CP-43000: for hosts in preview we show "Licensed" even though they're not
|
||||
entitlements.Add(hosts.Any(a => a.IsInPreviewRelease()) ? $"{Messages.LICENSE_MANAGER_LICENSED}{Environment.NewLine}{Messages.LICENSE_MANAGER_TRIAL_EDITION}" : Messages.LICENSE_MANAGER_TRIAL_LICENSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
entitlements.Add(Messages.LICENSE_NOT_ELIGIBLE_FOR_SUPPORT);
|
||||
}
|
||||
}
|
||||
else if (CurrentState == HostState.Free)
|
||||
{
|
||||
entitlements.Add(Messages.LICENSE_NOT_ELIGIBLE_FOR_SUPPORT);
|
||||
}
|
||||
|
||||
if (hosts.Any(h => h.CanShowTrialEditionUpsell()))
|
||||
entitlements.Add(Messages.TRIAL_EDITION_UPSELLING_MESSAGE);
|
||||
else if (hosts.Any(h => h.CssLicenseHasExpired()))
|
||||
entitlements.Add(Messages.EXPIRED_CSS_UPSELLING_MESSAGE_POOL);
|
||||
|
||||
return entitlements.Count == 0 ? Messages.UNKNOWN : string.Join(Environment.NewLine, entitlements);
|
||||
}
|
||||
|
72
XenModel/Messages.Designer.cs
generated
72
XenModel/Messages.Designer.cs
generated
@ -22449,6 +22449,24 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Active CSS.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_ACTIVE_CSS {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_ACTIVE_CSS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Active support agreement.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_ACTIVE_CSS_LONG {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_ACTIVE_CSS_LONG", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Buy Licenses....
|
||||
/// </summary>
|
||||
@ -22458,6 +22476,42 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expired CSS.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_EXPIRED_CSS {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_EXPIRED_CSS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expired support agreement.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_EXPIRED_CSS_LONG {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_EXPIRED_CSS_LONG", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Licensed.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_LICENSED {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_LICENSED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Purchase Support....
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_PURCHASE_SUPPORT_LINK_TEXT {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_PURCHASE_SUPPORT_LINK_TEXT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to License Expires:.
|
||||
/// </summary>
|
||||
@ -22494,6 +22548,24 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Trial edition.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_TRIAL_EDITION {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_TRIAL_EDITION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Trial license.
|
||||
/// </summary>
|
||||
public static string LICENSE_MANAGER_TRIAL_LICENSE {
|
||||
get {
|
||||
return ResourceManager.GetString("LICENSE_MANAGER_TRIAL_LICENSE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Never.
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@ -7807,9 +7807,27 @@ SR UUID: {1}</value>
|
||||
<data name="LICENSE_LICENSED" xml:space="preserve">
|
||||
<value>Licensed</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_ACTIVE_CSS" xml:space="preserve">
|
||||
<value>Active CSS</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_ACTIVE_CSS_LONG" xml:space="preserve">
|
||||
<value>Active support agreement</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT" xml:space="preserve">
|
||||
<value>Buy Licenses...</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_EXPIRED_CSS" xml:space="preserve">
|
||||
<value>Expired CSS</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_EXPIRED_CSS_LONG" xml:space="preserve">
|
||||
<value>Expired support agreement</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_LICENSED" xml:space="preserve">
|
||||
<value>Licensed</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_PURCHASE_SUPPORT_LINK_TEXT" xml:space="preserve">
|
||||
<value>Purchase Support...</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_SUMMARY_LICENSE_EXPIRES" xml:space="preserve">
|
||||
<value>License Expires:</value>
|
||||
</data>
|
||||
@ -7822,6 +7840,12 @@ SR UUID: {1}</value>
|
||||
<data name="LICENSE_MANAGER_SUMMARY_LICENSE_TYPE" xml:space="preserve">
|
||||
<value>License Type:</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_TRIAL_EDITION" xml:space="preserve">
|
||||
<value>Trial edition</value>
|
||||
</data>
|
||||
<data name="LICENSE_MANAGER_TRIAL_LICENSE" xml:space="preserve">
|
||||
<value>Trial license</value>
|
||||
</data>
|
||||
<data name="LICENSE_NEVER" xml:space="preserve">
|
||||
<value>Never</value>
|
||||
</data>
|
||||
|
@ -333,14 +333,16 @@ namespace XenAPI
|
||||
/// </summary>
|
||||
public virtual bool CanShowTrialEditionUpsell()
|
||||
{
|
||||
if (IsFreeLicense() &&
|
||||
software_version.TryGetValue("is_preview_release", out var isPreviewReleaseString) &&
|
||||
bool.TryParse(isPreviewReleaseString, out var isPreviewRelease) && !isPreviewRelease)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return Helpers.Post82X(this) && IsFreeLicense() && !IsInPreviewRelease();
|
||||
}
|
||||
|
||||
return false;
|
||||
/// <summary>
|
||||
/// Return true if the is_preview_release value in host.software_version is present and set to true.
|
||||
/// </summary>
|
||||
public virtual bool IsInPreviewRelease()
|
||||
{
|
||||
return software_version.TryGetValue("is_preview_release", out var isPreviewReleaseString) &&
|
||||
bool.TryParse(isPreviewReleaseString, out var isPreviewRelease) && isPreviewRelease;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -356,7 +358,7 @@ namespace XenAPI
|
||||
if (cssExpiry.HasValue)
|
||||
{
|
||||
// User can circumvent this by changing system date
|
||||
return DateTime.UtcNow > cssExpiry.Value;
|
||||
return DateTime.UtcNow < cssExpiry;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1518,6 +1520,11 @@ namespace XenAPI
|
||||
return GetEdition(edition) == Edition.Standard;
|
||||
}
|
||||
|
||||
public bool FreeFeaturesEnabled()
|
||||
{
|
||||
return GetEdition(edition) == Edition.Free;
|
||||
}
|
||||
|
||||
public bool EligibleForSupport()
|
||||
{
|
||||
return GetEdition(edition) != Edition.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user