CP-38582: Show Last updated field in General TabPage

Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
Danilo Del Busso 2022-05-23 09:59:11 +01:00
parent 1b259814bf
commit 6d6b0ce5fc
No known key found for this signature in database
GPG Key ID: 0C48542619080FD4
6 changed files with 66 additions and 5 deletions

View File

@ -993,7 +993,17 @@ namespace XenAdmin.TabPages
return;
if (host.software_version.ContainsKey("date"))
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_DATE, host.software_version["date"]);
{
if (Helpers.Post82X(host) && Helpers.XapiEqualOrGreater_22_19_0(host) && DateTime.TryParse(host.software_version["date"], out var softwareVersionDate) && softwareVersionDate != DateTime.MinValue)
{
var dateTime = softwareVersionDate.ToLocalTime().ToShortDateString();
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_DATE, dateTime, new PropertiesToolStripMenuItem(new DescriptionPropertiesCommand(Program.MainWindow, xenObject)));
}
else
{
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_DATE, host.software_version["date"]);
}
}
if (!Helpers.ElyOrGreater(host) && host.software_version.ContainsKey("build_number"))
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_BUILD_NUMBER, host.software_version["build_number"]);
if (host.software_version.ContainsKey("product_version"))
@ -1008,6 +1018,12 @@ namespace XenAdmin.TabPages
}
if (host.software_version.ContainsKey("dbv"))
pdSectionVersion.AddEntry("DBV", host.software_version["dbv"]);
if (Helpers.Post82X(host) && Helpers.XapiEqualOrGreater_22_19_0(host) && host.last_software_update != DateTime.MinValue)
{
var dateTime = host.last_software_update.ToLocalTime().ToShortDateString();
pdSectionVersion.AddEntry(Messages.SOFTWARE_VERSION_LAST_UPDATED, dateTime, new PropertiesToolStripMenuItem(new DescriptionPropertiesCommand(Program.MainWindow, xenObject)));
}
}
private void GenerateCPUBox()

View File

@ -19,7 +19,7 @@ namespace XenAdmin {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Messages {
@ -35022,6 +35022,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Last updated.
/// </summary>
public static string SOFTWARE_VERSION_LAST_UPDATED {
get {
return ResourceManager.GetString("SOFTWARE_VERSION_LAST_UPDATED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Version.
/// </summary>

View File

@ -12132,6 +12132,9 @@ Reverting to this snapshot will revert the VM back to the point in time that the
<data name="SOFTWARE_VERSION_DATE" xml:space="preserve">
<value>Build date</value>
</data>
<data name="SOFTWARE_VERSION_LAST_UPDATED" xml:space="preserve">
<value>Last updated</value>
</data>
<data name="SOFTWARE_VERSION_PRODUCT_VERSION" xml:space="preserve">
<value>Version</value>
</data>
@ -14834,4 +14837,4 @@ Any disk in your VM's DVD drive will be ejected when installing {1}.</value>
<data name="YOU_ARE_HERE" xml:space="preserve">
<value>You are here</value>
</data>
</root>
</root>

View File

@ -434,6 +434,11 @@ namespace XenAdmin.Core
return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "22.19.0") >= 0;
}
public static bool XapiEqualOrGreater_22_19_0(Host host)
{
return host == null || ProductVersionCompare(host.GetXapiVersion(), "22.19.0") >= 0;
}
#endregion
}
}

View File

@ -114,7 +114,9 @@ namespace XenAPI
List<XenRef<Certificate>> certificates,
string[] editions,
List<update_guidances> pending_guidances,
bool tls_verification_enabled)
bool tls_verification_enabled,
DateTime last_software_update
)
{
this.uuid = uuid;
this.name_label = name_label;
@ -179,6 +181,7 @@ namespace XenAPI
this.editions = editions;
this.pending_guidances = pending_guidances;
this.tls_verification_enabled = tls_verification_enabled;
this.last_software_update = last_software_update;
}
/// <summary>
@ -273,6 +276,7 @@ namespace XenAPI
editions = record.editions;
pending_guidances = record.pending_guidances;
tls_verification_enabled = record.tls_verification_enabled;
last_software_update = record.last_software_update;
}
internal void UpdateFrom(Proxy_Host proxy)
@ -340,6 +344,7 @@ namespace XenAPI
editions = proxy.editions == null ? new string[] {} : (string [])proxy.editions;
pending_guidances = proxy.pending_guidances == null ? null : Helper.StringArrayToEnumList<update_guidances>(proxy.pending_guidances);
tls_verification_enabled = (bool)proxy.tls_verification_enabled;
last_software_update = proxy.last_software_update;
}
/// <summary>
@ -476,6 +481,8 @@ namespace XenAPI
pending_guidances = Helper.StringArrayToEnumList<update_guidances>(Marshalling.ParseStringArray(table, "pending_guidances"));
if (table.ContainsKey("tls_verification_enabled"))
tls_verification_enabled = Marshalling.ParseBool(table, "tls_verification_enabled");
if (table.ContainsKey("last_software_update"))
last_software_update = Marshalling.ParseDateTime(table, "last_software_update");
}
public Proxy_Host ToProxy()
@ -544,6 +551,7 @@ namespace XenAPI
result_.editions = editions;
result_.pending_guidances = pending_guidances == null ? new string[] {} : Helper.ObjectListToStringArray(pending_guidances);
result_.tls_verification_enabled = tls_verification_enabled;
result_.last_software_update = last_software_update;
return result_;
}
@ -618,7 +626,8 @@ namespace XenAPI
Helper.AreEqual2(this._certificates, other._certificates) &&
Helper.AreEqual2(this._editions, other._editions) &&
Helper.AreEqual2(this._pending_guidances, other._pending_guidances) &&
Helper.AreEqual2(this._tls_verification_enabled, other._tls_verification_enabled);
Helper.AreEqual2(this._tls_verification_enabled, other._tls_verification_enabled) &&
Helper.AreEqual2(this._last_software_update, other.last_software_update);
}
public override string SaveChanges(Session session, string opaqueRef, Host server)
@ -4890,5 +4899,23 @@ namespace XenAPI
}
}
private bool _tls_verification_enabled = false;
/// <summary>
/// Date and time when the last software update was applied
/// </summary>
[JsonConverter(typeof(XenDateTimeConverter))]
public virtual DateTime last_software_update
{
get { return _last_software_update; }
set
{
if (!Helper.AreEqual(value, _last_software_update))
{
_last_software_update = value;
NotifyPropertyChanged("last_software_update");
}
}
}
private DateTime _last_software_update;
}
}

View File

@ -9101,6 +9101,7 @@ namespace XenAPI
public string [] editions;
public string [] pending_guidances;
public bool tls_verification_enabled;
public DateTime last_software_update;
}
[XmlRpcMissingMapping(MappingAction.Ignore)]