Skip to content

Commit

Permalink
CP-45097: Show product brand alongside the version on the General and…
Browse files Browse the repository at this point in the history
… Search tabPage.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Sep 4, 2023
1 parent 30e9924 commit 89fd16b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
15 changes: 10 additions & 5 deletions XenAdmin/TabPages/GeneralTabPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,13 @@ private void GenerateVersionBox()
if (host.software_version.ContainsKey("product_version"))
{
var hotfixEligibilityString = AdditionalVersionString(host);
var versionString = $"{host.ProductBrand()} {host.ProductVersionText()}";

if (string.IsNullOrEmpty(hotfixEligibilityString))
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, host.ProductVersionText());
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, versionString);
else
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION,
string.Format(Messages.MAINWINDOW_CONTEXT_REASON, host.ProductVersionText(), hotfixEligibilityString),
string.Format(Messages.MAINWINDOW_CONTEXT_REASON, versionString, hotfixEligibilityString),
Color.Red);
}

Expand Down Expand Up @@ -1538,14 +1540,17 @@ void LaunchProperties()
var coordinator = p.Connection.Resolve(p.master);
if (coordinator != null)
{
var versionString = $"{coordinator.ProductBrand()} {coordinator.ProductVersionText()}";

if (p.IsPoolFullyUpgraded())
{
var hotfixEligibilityString = AdditionalVersionString(coordinator);

if (string.IsNullOrEmpty(hotfixEligibilityString))
s.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, coordinator.ProductVersionText());
s.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION, versionString);
else
s.AddEntry(Messages.SOFTWARE_VERSION_PRODUCT_VERSION,
string.Format(Messages.MAINWINDOW_CONTEXT_REASON, coordinator.ProductVersionText(), hotfixEligibilityString),
string.Format(Messages.MAINWINDOW_CONTEXT_REASON, versionString, hotfixEligibilityString),
Color.Red);
}
else
Expand All @@ -1556,7 +1561,7 @@ void LaunchProperties()
(sender, args) => cmd.Run());

s.AddEntryLink(Messages.SOFTWARE_VERSION_PRODUCT_VERSION,
string.Format(Messages.POOL_VERSIONS_LINK_TEXT, BrandManager.ProductBrand, coordinator.ProductVersionText()),
string.Format(Messages.POOL_VERSIONS_LINK_TEXT, versionString),
cmd, runRpuWizard);
}
}
Expand Down
6 changes: 3 additions & 3 deletions XenAdmin/XenSearch/Columns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ protected bool CheckVMTools(IXenObject o, out GridItemBase item)
return true;
}

Pool pool = o as Pool;
if (pool != null && !pool.IsPoolFullyUpgraded())
if (o is Pool pool && !pool.IsPoolFullyUpgraded())
{
if (property == PropertyNames.memoryValue)
{
var coordinator = pool.Connection.Resolve(pool.master);
var versionString = $"{coordinator.ProductBrand()} {coordinator.ProductVersionText()}";

item = new GridStringItem(string.Format(Messages.POOL_VERSIONS_LINK_TEXT, BrandManager.ProductBrand, coordinator.ProductVersionText()),
item = new GridStringItem(string.Format(Messages.POOL_VERSIONS_LINK_TEXT, versionString),
HorizontalAlignment.Center, VerticalAlignment.Middle, false, false,
QueryPanel.LinkBrush, Program.DefaultFontUnderline, QueryPanel.LinkBrush,
Program.DefaultFontUnderline, 3,
Expand Down
2 changes: 1 addition & 1 deletion XenModel/Messages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion XenModel/Messages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -10915,7 +10915,7 @@ If this value does not correspond to a server within the selected resource pool
<value>Could not find the pool update in {0}'s cache.</value>
</data>
<data name="POOL_VERSIONS_LINK_TEXT" xml:space="preserve">
<value>Pool partially upgraded to {0} {1}</value>
<value>Pool partially upgraded to {0}</value>
</data>
<data name="POOL_VERSIONS_LINK_TEXT_SHORT" xml:space="preserve">
<value>Partially upgraded</value>
Expand Down
12 changes: 4 additions & 8 deletions XenModel/XenAPI-Extensions/Host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,19 +651,14 @@ public virtual string ProductVersion()
return Get(software_version, "product_version");
}

private string MarketingVersion(string field)
{
string s = Get(software_version, field);
return string.IsNullOrEmpty(s) ? ProductVersion() : s;
}

/// <summary>
/// Return this host's marketing version number (e.g. 5.6 Feature Pack 1),
/// or ProductVersion (which can still be null) if it can't be found, including pre-Cowley hosts.
/// </summary>
public string ProductVersionText()
{
return MarketingVersion("product_version_text");
string s = Get(software_version, "product_version_text");
return string.IsNullOrEmpty(s) ? ProductVersion() : s;
}

/// <summary>
Expand All @@ -672,7 +667,8 @@ public string ProductVersionText()
/// </summary>
public string ProductVersionTextShort()
{
return MarketingVersion("product_version_text_short");
string s = Get(software_version, "product_version_text_short");
return string.IsNullOrEmpty(s) ? ProductVersion() : s;
}

/// <summary>
Expand Down

0 comments on commit 89fd16b

Please sign in to comment.