mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-24213: Show CUs as updates
CUs are available as both updates and upgrades, but they should be presented as updates where possible. Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
86d2acee7f
commit
c59a3d14c4
@ -60,7 +60,7 @@ namespace XenAdmin.Alerts
|
||||
|
||||
private bool IsVersionOrVersionUpdateAlert(Alert alert)
|
||||
{
|
||||
return alert is XenServerPatchAlert && (alert as XenServerPatchAlert).NewServerVersion != null
|
||||
return alert is XenServerPatchAlert && (alert as XenServerPatchAlert).ShowAsNewVersion
|
||||
|| alert is XenServerVersionAlert
|
||||
|| alert is XenCenterUpdateAlert;
|
||||
}
|
||||
|
@ -125,9 +125,7 @@ namespace XenAdmin.Alerts
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(NewServerVersion != null
|
||||
? string.Format(Messages.DOWLOAD_LATEST_XS_TITLE, NewServerVersion.Name)
|
||||
: Patch.Description);
|
||||
sb.Append(Patch.Description);
|
||||
if (Patch.InstallationSize != 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
@ -146,7 +144,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NewServerVersion != null)
|
||||
if (ShowAsNewVersion)
|
||||
return NewServerVersion.Name;
|
||||
return Patch.Name;
|
||||
}
|
||||
@ -177,7 +175,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NewServerVersion != null)
|
||||
if (ShowAsNewVersion)
|
||||
return string.Format(Messages.DOWLOAD_LATEST_XS_TITLE, NewServerVersion.Name);
|
||||
return string.Format(Messages.NEW_UPDATE_AVAILABLE, Patch.Name);
|
||||
}
|
||||
@ -217,5 +215,13 @@ namespace XenAdmin.Alerts
|
||||
}
|
||||
return base.Equals(other);
|
||||
}
|
||||
|
||||
public bool ShowAsNewVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return NewServerVersion != null && !NewServerVersion.PresentAsUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
[Test]
|
||||
public void TestAlertWithConnectionAndHosts()
|
||||
{
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "");
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "", false);
|
||||
var alert = new XenServerVersionAlert(ver);
|
||||
alert.IncludeConnection(connA.Object);
|
||||
alert.IncludeConnection(connB.Object);
|
||||
@ -83,7 +83,7 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
[Test]
|
||||
public void TestAlertWithHostsAndNoConnection()
|
||||
{
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "");
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "", false);
|
||||
var alert = new XenServerVersionAlert(ver);
|
||||
alert.IncludeHosts(new List<Host> { hostA.Object, hostB.Object });
|
||||
|
||||
@ -109,7 +109,7 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
[Test]
|
||||
public void TestAlertWithConnectionAndNoHosts()
|
||||
{
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "");
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "", false);
|
||||
var alert = new XenServerVersionAlert(ver);
|
||||
alert.IncludeConnection(connA.Object);
|
||||
alert.IncludeConnection(connB.Object);
|
||||
@ -136,7 +136,7 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
[Test]
|
||||
public void TestAlertWithNoConnectionAndNoHosts()
|
||||
{
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "");
|
||||
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, false, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123", "", false);
|
||||
var alert = new XenServerVersionAlert(ver);
|
||||
|
||||
IUnitTestVerifier validator = new VerifyGetters(alert);
|
||||
|
@ -76,7 +76,7 @@ namespace XenAdminTests.UnitTests
|
||||
{
|
||||
var serverVersions = new List<XenServerVersion>();
|
||||
|
||||
var version = new XenServerVersion("7.0.0", "XenServer Test 7", true, false, "", new List<XenServerPatch>(), new List<XenServerPatch>(), DateTime.MinValue.ToString(), "buildNo", "");
|
||||
var version = new XenServerVersion("7.0.0", "XenServer Test 7", true, false, "", new List<XenServerPatch>(), new List<XenServerPatch>(), DateTime.MinValue.ToString(), "buildNo", "", false);
|
||||
for (int ii = 0; ii < numberOfPatches; ii++)
|
||||
{
|
||||
var patch = new XenServerPatch("patch_uuid_" + ii, "patch name " + ii, "patch description" + ii, "", "", "1.0", "", "", "1970-01-01T00:00:00Z", "", "1000");
|
||||
|
@ -244,6 +244,7 @@ namespace XenAdmin.Actions
|
||||
string timestamp = "";
|
||||
string buildNumber = "";
|
||||
string patchUuid = "";
|
||||
bool presentAsUpdate = false;
|
||||
|
||||
foreach (XmlAttribute attrib in version.Attributes)
|
||||
{
|
||||
@ -263,6 +264,8 @@ namespace XenAdmin.Actions
|
||||
buildNumber = attrib.Value;
|
||||
else if (attrib.Name == "patch-uuid")
|
||||
patchUuid = attrib.Value;
|
||||
else if (attrib.Name == "present-as-update")
|
||||
presentAsUpdate = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant();
|
||||
}
|
||||
|
||||
List<XenServerPatch> patches = new List<XenServerPatch>();
|
||||
@ -298,7 +301,7 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
|
||||
XenServerVersions.Add(new XenServerVersion(version_oem, name, is_latest, is_latest_cr, url, patches, minimalPatches, timestamp,
|
||||
buildNumber, patchUuid));
|
||||
buildNumber, patchUuid, presentAsUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ namespace XenAdmin.Core
|
||||
public string Oem;
|
||||
public List<XenServerPatch> Patches;
|
||||
public string PatchUuid;
|
||||
public bool PresentAsUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// A host of this version is considered up-to-date when it has all the patches in this list installed on it
|
||||
@ -69,8 +70,9 @@ namespace XenAdmin.Core
|
||||
/// <param name="timestamp"></param>
|
||||
/// <param name="buildNumber"></param>
|
||||
/// <param name="patchUuid"></param>
|
||||
/// <param name="presentAsUpdate">Indicates that the new version (usually a CU) should be presented as an update where possible</param>
|
||||
public XenServerVersion(string version_oem, string name, bool latest, bool latestCr, string url, List<XenServerPatch> patches, List<XenServerPatch> minimumPatches,
|
||||
string timestamp, string buildNumber, string patchUuid)
|
||||
string timestamp, string buildNumber, string patchUuid, bool presentAsUpdate)
|
||||
{
|
||||
ParseVersion(version_oem);
|
||||
Name = name;
|
||||
@ -82,6 +84,7 @@ namespace XenAdmin.Core
|
||||
DateTime.TryParse(timestamp, out TimeStamp);
|
||||
BuildNumber = buildNumber;
|
||||
PatchUuid = patchUuid;
|
||||
PresentAsUpdate = presentAsUpdate;
|
||||
}
|
||||
|
||||
private void ParseVersion(string version_oem)
|
||||
|
Loading…
Reference in New Issue
Block a user