From dc0a301f81bc19ac6e4b58b0fa067d2a830cd4f8 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 3 Aug 2022 14:58:39 +0100 Subject: [PATCH 01/14] CP-39929: Remove ellipsing from `VMProblem` descriptions Signed-off-by: Danilo Del Busso --- XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs | 2 +- XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs | 2 +- XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs b/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs index 99ccafcf9d..34e4ce8e3f 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs @@ -43,7 +43,7 @@ public LocalCD(Check check, VM vm) public override string Description { - get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, ServerName, VM.Name().Ellipsise(25)); } + get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, ServerName, VM.Name()); } } protected override AsyncAction CreateAction(out bool cancelled) diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs b/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs index 42bfe5f1f1..c8d1e9d5cf 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs @@ -42,7 +42,7 @@ public LocalStorage(Check check, VM vm) public override string Description { - get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_STORAGE, ServerName, VM.Name().Ellipsise(15)); } + get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_STORAGE, ServerName, VM.Name()); } } } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs b/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs index 01d675b75f..73a4d174c2 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs @@ -44,7 +44,7 @@ public NoHosts(Check check, VM vm) public override string Description { - get { return string.Format(Messages.UPDATES_WIZARD_NO_HOSTS, ServerName, VM.Name().Ellipsise(15)); } + get { return string.Format(Messages.UPDATES_WIZARD_NO_HOSTS, ServerName, VM.Name()); } } } } From 43997a8ba0604b5b862012f499512b63716866b1 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 3 Aug 2022 15:05:49 +0100 Subject: [PATCH 02/14] CP-39929: Enable use of maximize box for RPU Wizard Signed-off-by: Danilo Del Busso --- .../RollingUpgradeWizard/RollingUpgradeWizard.Designer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.Designer.cs b/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.Designer.cs index 7a8cf37000..4cc78afb68 100644 --- a/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.Designer.cs +++ b/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizard.Designer.cs @@ -46,11 +46,11 @@ private void InitializeComponent() // resources.ApplyResources(this, "$this"); this.Name = "RollingUpgradeWizard"; + this.MaximizeBox = true; ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWizard)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.XSHelpButton)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); - } #endregion From fb5839e145a788538a6db1e8099ec3d94c5d9a08 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 10 Aug 2022 15:26:19 +0100 Subject: [PATCH 03/14] CP-39929: Tidy up settings files sort settings by name Signed-off-by: Danilo Del Busso --- XenAdmin/Properties/Settings.Designer.cs | 86 ++++++++++++------------ XenAdmin/Properties/Settings.settings | 24 +++---- XenAdmin/app.config | 33 +++++---- 3 files changed, 70 insertions(+), 73 deletions(-) diff --git a/XenAdmin/Properties/Settings.Designer.cs b/XenAdmin/Properties/Settings.Designer.cs index 6f02e19f8c..520eac13dd 100644 --- a/XenAdmin/Properties/Settings.Designer.cs +++ b/XenAdmin/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace XenAdmin.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -61,20 +61,6 @@ public bool SaveSession { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] - [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] - public string[] ServerList { - get { - return ((string[])(this["ServerList"])); - } - set { - this["ServerList"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -515,20 +501,6 @@ public bool LoadPlugins { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] - [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] - public string[] DisabledPlugins { - get { - return ((string[])(this["DisabledPlugins"])); - } - set { - this["DisabledPlugins"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] @@ -541,20 +513,6 @@ public string[] CslgCredentials { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] - [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] - public string[] IgnoreFirstRunWizards { - get { - return ((string[])(this["IgnoreFirstRunWizards"])); - } - set { - this["IgnoreFirstRunWizards"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] @@ -891,5 +849,47 @@ public string FileServiceClientId { this["FileServiceClientId"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] + [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] + public string[] ServerList { + get { + return ((string[])(this["ServerList"])); + } + set { + this["ServerList"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] + [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] + public string[] DisabledPlugins { + get { + return ((string[])(this["DisabledPlugins"])); + } + set { + this["DisabledPlugins"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n")] + [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] + public string[] IgnoreFirstRunWizards { + get { + return ((string[])(this["IgnoreFirstRunWizards"])); + } + set { + this["IgnoreFirstRunWizards"] = value; + } + } } } diff --git a/XenAdmin/Properties/Settings.settings b/XenAdmin/Properties/Settings.settings index 2b225399f6..763ec74700 100644 --- a/XenAdmin/Properties/Settings.settings +++ b/XenAdmin/Properties/Settings.settings @@ -11,10 +11,6 @@ True - - <?xml version="1.0" encoding="utf-16"?> -<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> - True @@ -117,17 +113,9 @@ True - - <?xml version="1.0" encoding="utf-16"?> -<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> - - - <?xml version="1.0" encoding="utf-16"?> -<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> - @@ -206,5 +194,17 @@ + + <?xml version="1.0" encoding="utf-16"?> +<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> + + + <?xml version="1.0" encoding="utf-16"?> +<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> + + + <?xml version="1.0" encoding="utf-16"?> +<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> + \ No newline at end of file diff --git a/XenAdmin/app.config b/XenAdmin/app.config index a868c3eae2..2daf2a94fe 100644 --- a/XenAdmin/app.config +++ b/XenAdmin/app.config @@ -15,12 +15,6 @@ True - - - - - True @@ -117,18 +111,6 @@ True - - - - - - - - - - @@ -204,6 +186,21 @@ + + + + + + + + + + + + + + + From a0a93df3e9d8ffc7f77e7278f48829cfe22b2d26 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 22 Aug 2022 13:24:12 +0100 Subject: [PATCH 04/14] CP-39929: Add timestamps to update logs - Add option to the display options page - Add related setting - Refactor `ExtensionMethods` to be more compact and flexible - Add docs to `ExtensionMethods` - Whitespace fixes Signed-off-by: Danilo Del Busso --- XenAdmin/Core/ExtensionMethods.cs | 180 ++++++++++++------ .../DisplayOptionsPage.Designer.cs | 34 ++++ .../OptionsPages/DisplayOptionsPage.cs | 6 +- .../OptionsPages/DisplayOptionsPage.resx | 125 +++++++++++- XenAdmin/Properties/Settings.Designer.cs | 13 ++ XenAdmin/Properties/Settings.settings | 3 + .../AutomatedUpdatesBasePage.cs | 59 +++--- .../PatchingWizard/PatchingWizard_ModePage.cs | 2 +- XenAdmin/app.config | 3 + 9 files changed, 326 insertions(+), 99 deletions(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index 8b78ffa3e9..6e59b658a2 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -1,58 +1,61 @@ /* Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, - * with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ -using System.Drawing; +using System; +using System.Drawing; +using System.Linq; using System.Text; using System.Windows.Forms; namespace XenAdmin.Core { - internal static class ExtensionMethods - { - /// - /// Internationalization of True/False - /// - public static string ToStringI18n(this bool value) - { - return value ? Messages.TRUE : Messages.FALSE; - } + internal static class ExtensionMethods + { + private const int DEFAULT_STRING_INDENTATION = 2; + /// + /// Internationalization of True/False + /// + public static string ToStringI18n(this bool value) + { + return value ? Messages.TRUE : Messages.FALSE; + } - /// - /// Turns a bool to internationalized Yes/No (on occasion it's user friendlier than True/False) - /// - public static string ToYesNoStringI18n(this bool value) - { - return value ? Messages.YES : Messages.NO; - } + /// + /// Turns a bool to internationalized Yes/No (on occasion it's user friendlier than True/False) + /// + public static string ToYesNoStringI18n(this bool value) + { + return value ? Messages.YES : Messages.NO; + } /// /// This has the same bahvoiur as the standard ellipsise extension but this uses graphics @@ -88,24 +91,79 @@ public static string Ellipsise(this string text, Rectangle rectangle, Font font) return text.Ellipsise(c); } - public static StringBuilder AppendIndented(this StringBuilder builder, string value, int indent = 2) + /// + /// Append the input value after it's been prepended with the specified amount of spaces. + /// If the value spans multiple lines, each line will be indented. + /// + /// The to which the modified value will be appended. + /// The value to prepend with spaces and then append. + /// The amount of spaces to prepend to each line in the input value. + /// The input after the operation has been completed. + public static StringBuilder AppendIndented(this StringBuilder builder, string value, int indent = DEFAULT_STRING_INDENTATION) { - var indentString = ""; - var i = 0; - while (i++ < indent) - indentString += " "; - var newvalue = value.Replace(System.Environment.NewLine, string.Format("{0}{1}", System.Environment.NewLine, indentString)); - return builder.Append(string.Format("{0}{1}", indentString, newvalue)); + return builder.Append(PrependIndentation(value, indent)); } - public static StringBuilder AppendIndented(this StringBuilder builder, StringBuilder value, int indent = 2) + /// + /// Add a new line to the input , with options to format the input value before it's appended. + /// + /// The to which the modified value will be appended. + /// The value to format before appending. + /// true if each line should be prepended with a timestamp + /// true if each line should be prepended with indentation. Uses the default indentation defined in : + /// true to append an extra line. + /// The input after the operation has been completed. + public static StringBuilder AppendFormattedLine(this StringBuilder builder, string value, bool addTimestamp = false, bool indent = false, bool addExtraLine = false) + { + var formattedValue = value; + if (!string.IsNullOrEmpty(value)) + { + if (indent) + { + formattedValue = PrependIndentation(formattedValue); + } + if (addTimestamp) + { + formattedValue = PrependTimestamps(formattedValue); + } + } + + builder.AppendLine(formattedValue); + + if (addExtraLine) + { + builder.AppendLine(); + } + + return builder; + } + + /// + /// Prepend every line in the input value with the specified indentation level. + /// + /// The value to which indentation will be applied + /// The level of indentation, i.e. the number of spaces to prepend to every line in the value. + /// The input value with prepended indentation./ + private static string PrependIndentation(string value, int indent = DEFAULT_STRING_INDENTATION) + { + var indentString = new string(' ', indent); + var newValue = value.Replace(Environment.NewLine, $"{Environment.NewLine}{indentString}"); + return $"{indentString}{newValue}"; + } + + /// + /// Prepend every line in the input value with a formatted string of . + /// + /// The input value + /// true to format the string with the user's locale + /// The input value with prepended timestamps/ + public static string PrependTimestamps(string value, bool localize = true) { - var indentString = ""; - var i = 0; - while (i++ < indent) - indentString += " "; - var newvalue = value.Replace(System.Environment.NewLine, string.Format("{0}{1}", System.Environment.NewLine, indentString)); - return builder.Append(string.Format("{0}{1}", indentString, newvalue)); + var timestamp = DateTime.Now; + var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_HMS, localize); + // normalise all line endings before splitting + var lines = value.Replace(Environment.NewLine, "\n").Split('\n'); + return string.Join(Environment.NewLine, lines.Select(line => $"{timestampString}> {line}")); } - } + } } diff --git a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.Designer.cs b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.Designer.cs index 71ee5c90eb..a548e15fae 100644 --- a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.Designer.cs +++ b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.Designer.cs @@ -30,6 +30,9 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayOptionsPage)); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.updateLogOptionsDecentGroupBox = new XenAdmin.Controls.DecentGroupBox(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.showTimestampsCheckBox = new System.Windows.Forms.CheckBox(); this.GraphTypeGroupBox = new XenAdmin.Controls.DecentGroupBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label5 = new XenAdmin.Controls.Common.AutoHeightLabel(); @@ -41,6 +44,8 @@ private void InitializeComponent() this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.checkBoxStoreTab = new System.Windows.Forms.CheckBox(); this.tableLayoutPanel3.SuspendLayout(); + this.updateLogOptionsDecentGroupBox.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); this.GraphTypeGroupBox.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); @@ -52,10 +57,32 @@ private void InitializeComponent() // tableLayoutPanel3 // resources.ApplyResources(this.tableLayoutPanel3, "tableLayoutPanel3"); + this.tableLayoutPanel3.Controls.Add(this.updateLogOptionsDecentGroupBox, 0, 2); this.tableLayoutPanel3.Controls.Add(this.GraphTypeGroupBox, 0, 0); this.tableLayoutPanel3.Controls.Add(this.TabGroupBox, 0, 1); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; // + // updateLogOptionsDecentGroupBox + // + resources.ApplyResources(this.updateLogOptionsDecentGroupBox, "updateLogOptionsDecentGroupBox"); + this.updateLogOptionsDecentGroupBox.Controls.Add(this.tableLayoutPanel4); + this.updateLogOptionsDecentGroupBox.Name = "updateLogOptionsDecentGroupBox"; + this.updateLogOptionsDecentGroupBox.TabStop = false; + // + // tableLayoutPanel4 + // + resources.ApplyResources(this.tableLayoutPanel4, "tableLayoutPanel4"); + this.tableLayoutPanel4.Controls.Add(this.showTimestampsCheckBox, 0, 0); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + // + // showTimestampsCheckBox + // + resources.ApplyResources(this.showTimestampsCheckBox, "showTimestampsCheckBox"); + this.showTimestampsCheckBox.Checked = true; + this.showTimestampsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.showTimestampsCheckBox.Name = "showTimestampsCheckBox"; + this.showTimestampsCheckBox.UseVisualStyleBackColor = true; + // // GraphTypeGroupBox // resources.ApplyResources(this.GraphTypeGroupBox, "GraphTypeGroupBox"); @@ -135,6 +162,10 @@ private void InitializeComponent() this.Name = "DisplayOptionsPage"; this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.PerformLayout(); + this.updateLogOptionsDecentGroupBox.ResumeLayout(false); + this.updateLogOptionsDecentGroupBox.PerformLayout(); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); this.GraphTypeGroupBox.ResumeLayout(false); this.GraphTypeGroupBox.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); @@ -163,5 +194,8 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.CheckBox checkBoxStoreTab; + private Controls.DecentGroupBox updateLogOptionsDecentGroupBox; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.CheckBox showTimestampsCheckBox; } } diff --git a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.cs b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.cs index 4145a44d86..cc7b95cc75 100644 --- a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.cs +++ b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.cs @@ -48,6 +48,7 @@ public void Build() GraphAreasRadioButton.Checked = Properties.Settings.Default.FillAreaUnderGraphs; GraphLinesRadioButton.Checked = !Properties.Settings.Default.FillAreaUnderGraphs; checkBoxStoreTab.Checked = Properties.Settings.Default.RememberLastSelectedTab; + showTimestampsCheckBox.Checked = Properties.Settings.Default.ShowTimestampsInUpdatesLog; } #region IOptionsPage Members @@ -61,6 +62,7 @@ public bool IsValidToSave(out Control control, out string invalidReason) public void ShowValidationMessages(Control control, string message) { + // no message } public void Save() @@ -70,7 +72,9 @@ public void Save() if (checkBoxStoreTab.Checked != Properties.Settings.Default.RememberLastSelectedTab) Properties.Settings.Default.RememberLastSelectedTab = checkBoxStoreTab.Checked; - + + if (showTimestampsCheckBox.Checked != Properties.Settings.Default.ShowTimestampsInUpdatesLog) + Properties.Settings.Default.ShowTimestampsInUpdatesLog = showTimestampsCheckBox.Checked; } #endregion diff --git a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx index 2664f13220..039e96f164 100644 --- a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx +++ b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx @@ -128,6 +128,115 @@ 1 + + True + + + GrowAndShrink + + + True + + + 1 + + + True + + + NoControl + + + + 3, 3 + + + 3, 0, 0, 0 + + + 201, 17 + + + 0 + + + Show timestamps in the update logs + + + showTimestampsCheckBox + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel4 + + + 0 + + + Fill + + + 3, 16 + + + 1 + + + 617, 49 + + + 0 + + + tableLayoutPanel4 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + updateLogOptionsDecentGroupBox + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="showTimestampsCheckBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,Absolute,49,Absolute,49,Absolute,49" /></TableLayoutSettings> + + + Fill + + + Tahoma, 8pt + + + 3, 337 + + + 3, 3, 3, 6 + + + 623, 71 + + + 2 + + + Update logs options + + + updateLogOptionsDecentGroupBox + + + XenAdmin.Controls.DecentGroupBox, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanel3 + + + 0 + True @@ -146,7 +255,7 @@ Fill - + Tahoma, 8pt @@ -172,7 +281,7 @@ label5 - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -373,13 +482,13 @@ GraphTypeGroupBox - XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.DecentGroupBox, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel3 - 0 + 1 True @@ -481,13 +590,13 @@ TabGroupBox - XenAdmin.Controls.DecentGroupBox, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.DecentGroupBox, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel3 - 1 + 2 Fill @@ -520,7 +629,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="GraphTypeGroupBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="TabGroupBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,100,Absolute,20,Absolute,20,Absolute,20" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="updateLogOptionsDecentGroupBox" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="GraphTypeGroupBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="TabGroupBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,100,Absolute,20,Absolute,20,Absolute,20" /></TableLayoutSettings> True @@ -537,4 +646,4 @@ System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - \ No newline at end of file + diff --git a/XenAdmin/Properties/Settings.Designer.cs b/XenAdmin/Properties/Settings.Designer.cs index 520eac13dd..8af53353e9 100644 --- a/XenAdmin/Properties/Settings.Designer.cs +++ b/XenAdmin/Properties/Settings.Designer.cs @@ -891,5 +891,18 @@ public string[] IgnoreFirstRunWizards { this["IgnoreFirstRunWizards"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)] + public bool ShowTimestampsInUpdatesLog { + get { + return ((bool)(this["ShowTimestampsInUpdatesLog"])); + } + set { + this["ShowTimestampsInUpdatesLog"] = value; + } + } } } diff --git a/XenAdmin/Properties/Settings.settings b/XenAdmin/Properties/Settings.settings index 763ec74700..1bea407769 100644 --- a/XenAdmin/Properties/Settings.settings +++ b/XenAdmin/Properties/Settings.settings @@ -206,5 +206,8 @@ <?xml version="1.0" encoding="utf-16"?> <ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /> + + True + \ No newline at end of file diff --git a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs index 09a5e5e6fe..e076589458 100644 --- a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs @@ -271,72 +271,75 @@ private void UpdateStatus() newVal = 0; else if (newVal > 100) newVal = 100; - progressBar.Value = (int) newVal; + progressBar.Value = (int)newVal; - var allsb = new StringBuilder(); + var stringBuilder = new StringBuilder(); + + var addTimestamp = Properties.Settings.Default.ShowTimestampsInUpdatesLog; foreach (var bgw in backgroundWorkers) { - int bgwErrorCount = 0; - int bgwCancellationCount = 0; + var bgwErrorCount = 0; + var bgwCancellationCount = 0; var sb = new StringBuilder(); var errorSb = new StringBuilder(); if (!string.IsNullOrEmpty(bgw.Name)) - sb.AppendLine(string.Format("{0}:", bgw.Name)); + sb.AppendFormattedLine($"{bgw.Name}:", addTimestamp); foreach (var pa in bgw.DoneActions) { - pa.ProgressHistory.ForEach(step => sb.AppendIndented(step).AppendLine()); + pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(step, addTimestamp, true)); + + if (pa.Error == null) + continue; - if (pa.Error != null) + if (pa.Error is CancelledException) { - if (pa.Error is CancelledException) - { - bgwCancellationCount++; - continue; - } + bgwCancellationCount++; + continue; + } + errorSb.AppendFormattedLine(!(pa.Error.InnerException is Failure innerEx) ? pa.Error.Message : innerEx.Message, addTimestamp, true, true); - var innerEx = pa.Error.InnerException as Failure; - errorSb.AppendLine(innerEx == null ? pa.Error.Message : innerEx.Message); - if (pa.IsSkippable) - { - Debug.Assert(!string.IsNullOrEmpty(pa.Title)); - errorSb.AppendLine(string.Format(Messages.RPU_WIZARD_ERROR_SKIP_MSG, pa.Title)) - .AppendLine(); - } + if (pa.IsSkippable) + { + Debug.Assert(!string.IsNullOrEmpty(pa.Title)); + errorSb.AppendFormattedLine(string.Format(Messages.RPU_WIZARD_ERROR_SKIP_MSG, pa.Title), addTimestamp, true, true); - bgwErrorCount++; } + + bgwErrorCount++; } foreach (var pa in bgw.InProgressActions) { - pa.ProgressHistory.ForEach(step => sb.AppendIndented(step).AppendLine()); + pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(step, addTimestamp, true)); } sb.AppendLine(); if (bgwCancellationCount > 0) { - sb.AppendIndented(UserCancellationMessage()).AppendLine(); + sb.AppendFormattedLine(UserCancellationMessage(), addTimestamp, indent: true); } else if (bgwErrorCount > 0) { - sb.AppendIndented(FailureMessagePerPool(bgwErrorCount > 1)).AppendLine(); - sb.AppendIndented(errorSb); + sb.AppendFormattedLine(FailureMessagePerPool(bgwErrorCount > 1), addTimestamp, true); + + // we don't add formatting since errorSb has its own + sb.Append(errorSb.ToString()); } else if (!bgw.IsBusy) { - sb.AppendIndented(WarningMessagePerPool(bgw.Pool) ?? SuccessMessagePerPool(bgw.Pool)).AppendLine(); + sb.AppendFormattedLine(WarningMessagePerPool(bgw.Pool) ?? SuccessMessagePerPool(bgw.Pool), addTimestamp, true); } sb.AppendLine(); - allsb.Append(sb); + stringBuilder.Append(sb); } - var newText = allsb.ToString(); + var newText = stringBuilder.ToString(); if (!_userMovedVerticalScrollbar) { diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs index dc496942d7..7cfb56d659 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs @@ -113,7 +113,7 @@ protected override void PageLoadedCore(PageLoadedDirection direction) foreach (var kvp in ManualTextInstructions) { sb.AppendFormat("{0}:", kvp.Key).AppendLine(); - sb.AppendIndented(kvp.Value).AppendLine(); + sb.AppendIndented(kvp.Value.ToString()).AppendLine(); } textBoxLog.Text = sb.ToString(); } diff --git a/XenAdmin/app.config b/XenAdmin/app.config index 2daf2a94fe..21845a6afb 100644 --- a/XenAdmin/app.config +++ b/XenAdmin/app.config @@ -201,6 +201,9 @@ + + True + From 20e05e90fafe0709a8e277f653bf6829d8c9b8c9 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 15 Aug 2022 13:10:22 +0100 Subject: [PATCH 05/14] CP-39929: Prevent whitespace strings from being prepended with timestamp Signed-off-by: Danilo Del Busso (cherry picked from commit 4340892b599d77cb365bada04dd2ad188886cfb9) --- XenAdmin/Core/ExtensionMethods.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index 6e59b658a2..b75dca5563 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -106,6 +106,7 @@ public static StringBuilder AppendIndented(this StringBuilder builder, string va /// /// Add a new line to the input , with options to format the input value before it's appended. + /// timestamps and indentation will be ignored if the input value is an null or whitespace /// /// The to which the modified value will be appended. /// The value to format before appending. @@ -116,7 +117,7 @@ public static StringBuilder AppendIndented(this StringBuilder builder, string va public static StringBuilder AppendFormattedLine(this StringBuilder builder, string value, bool addTimestamp = false, bool indent = false, bool addExtraLine = false) { var formattedValue = value; - if (!string.IsNullOrEmpty(value)) + if (!string.IsNullOrWhiteSpace(value)) { if (indent) { From f9ff39ef5b53af1e14dc2194325da475e949edb2 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 15 Aug 2022 13:10:53 +0100 Subject: [PATCH 06/14] CP-39929: Remove useless new line after appending error string Signed-off-by: Danilo Del Busso (cherry picked from commit 158be06d8d83f0201f39b210e1eb337c235846a8) --- XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs index e076589458..64c4e15506 100644 --- a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs @@ -299,7 +299,7 @@ private void UpdateStatus() bgwCancellationCount++; continue; } - errorSb.AppendFormattedLine(!(pa.Error.InnerException is Failure innerEx) ? pa.Error.Message : innerEx.Message, addTimestamp, true, true); + errorSb.AppendFormattedLine(pa.Error.InnerException is Failure innerEx ? innerEx.Message : pa.Error.Message , addTimestamp, true); if (pa.IsSkippable) From 432c4ff95c0da1d06287c82fa8df03434f5e5ccc Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 15 Aug 2022 15:47:59 +0100 Subject: [PATCH 07/14] CP-39929: Enable `MaximizeBox` for `PatchingWizard` Signed-off-by: Danilo Del Busso (cherry picked from commit c2dc35359f3aa4475ddf0ba95d7297e1fd082c80) --- XenAdmin/Wizards/PatchingWizard/PatchingWizard.Designer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.Designer.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.Designer.cs index d048041043..dfbbe68b98 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.Designer.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.Designer.cs @@ -52,7 +52,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.XSHelpButton)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); - + this.MaximizeBox = true; } #endregion From 9046fe1dc377d6bb73d43e9b4ddc1e48c103db7c Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 15 Aug 2022 15:57:55 +0100 Subject: [PATCH 08/14] CP-39929: Fix incorrect timestamp shown in RPU/Update wizards Also: - Use new date format for logs - Specify option parameter names - Do not show timestamp for host name log - Do not show timestamp for null/whitespace only lines Signed-off-by: Danilo Del Busso (cherry picked from commit 60cd8b9f885ca202b105a9cd08ff08aaf37f80e5) Conflicts: XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs Signed-off-by: Danilo Del Busso --- XenAdmin/Core/ExtensionMethods.cs | 15 ++++--- .../AutomatedUpdatesBasePage.cs | 19 ++++---- .../PatchingWizard/PlanActions/PlanAction.cs | 45 ++++++++++--------- XenModel/Messages.Designer.cs | 9 ++++ XenModel/Messages.resx | 3 ++ 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index b75dca5563..c084d4fdfc 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -110,11 +110,12 @@ public static StringBuilder AppendIndented(this StringBuilder builder, string va /// /// The to which the modified value will be appended. /// The value to format before appending. - /// true if each line should be prepended with a timestamp + /// The timestamp to prepend to each line. If null, no timestamp will be added. + /// Override for the timestamp. If set to false, no timestamp will be shown even if the value is null. /// true if each line should be prepended with indentation. Uses the default indentation defined in : /// true to append an extra line. /// The input after the operation has been completed. - public static StringBuilder AppendFormattedLine(this StringBuilder builder, string value, bool addTimestamp = false, bool indent = false, bool addExtraLine = false) + public static StringBuilder AppendFormattedLine(this StringBuilder builder, string value, DateTime? timestamp, bool showTimestamp = true, bool indent = false, bool addExtraLine = false) { var formattedValue = value; if (!string.IsNullOrWhiteSpace(value)) @@ -123,9 +124,9 @@ public static StringBuilder AppendFormattedLine(this StringBuilder builder, stri { formattedValue = PrependIndentation(formattedValue); } - if (addTimestamp) + if (timestamp != null && showTimestamp) { - formattedValue = PrependTimestamps(formattedValue); + formattedValue = PrependTimestamps(formattedValue, (DateTime) timestamp); } } @@ -156,12 +157,12 @@ private static string PrependIndentation(string value, int indent = DEFAULT_STRI /// Prepend every line in the input value with a formatted string of . /// /// The input value + /// The timestamp to show /// true to format the string with the user's locale /// The input value with prepended timestamps/ - public static string PrependTimestamps(string value, bool localize = true) + public static string PrependTimestamps(string value, DateTime timestamp, bool localize = true) { - var timestamp = DateTime.Now; - var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_HMS, localize); + var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_DM_HM, localize); // normalise all line endings before splitting var lines = value.Replace(Environment.NewLine, "\n").Split('\n'); return string.Join(Environment.NewLine, lines.Select(line => $"{timestampString}> {line}")); diff --git a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs index 64c4e15506..066073def7 100644 --- a/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/AutomatedUpdatesBasePage.cs @@ -285,11 +285,11 @@ private void UpdateStatus() var errorSb = new StringBuilder(); if (!string.IsNullOrEmpty(bgw.Name)) - sb.AppendFormattedLine($"{bgw.Name}:", addTimestamp); + sb.AppendLine($"{bgw.Name}:"); foreach (var pa in bgw.DoneActions) { - pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(step, addTimestamp, true)); + pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(value: step.Description, timestamp: step.Timestamp, showTimestamp: addTimestamp ,indent: true)); if (pa.Error == null) continue; @@ -299,14 +299,13 @@ private void UpdateStatus() bgwCancellationCount++; continue; } - errorSb.AppendFormattedLine(pa.Error.InnerException is Failure innerEx ? innerEx.Message : pa.Error.Message , addTimestamp, true); + errorSb.AppendFormattedLine(pa.Error.InnerException is Failure innerEx ? innerEx.Message : pa.Error.Message , timestamp: pa.Timestamp, showTimestamp: addTimestamp, indent: true); if (pa.IsSkippable) { Debug.Assert(!string.IsNullOrEmpty(pa.Title)); - errorSb.AppendFormattedLine(string.Format(Messages.RPU_WIZARD_ERROR_SKIP_MSG, pa.Title), addTimestamp, true, true); - + errorSb.AppendFormattedLine(string.Format(Messages.RPU_WIZARD_ERROR_SKIP_MSG, pa.Title), timestamp : pa.Timestamp, showTimestamp: addTimestamp, indent: true, addExtraLine: true); } bgwErrorCount++; @@ -314,25 +313,25 @@ private void UpdateStatus() foreach (var pa in bgw.InProgressActions) { - pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(step, addTimestamp, true)); + pa.ProgressHistory.ForEach(step => sb.AppendFormattedLine(value: step.Description, timestamp: step.Timestamp, showTimestamp: addTimestamp, indent: true)); } sb.AppendLine(); if (bgwCancellationCount > 0) { - sb.AppendFormattedLine(UserCancellationMessage(), addTimestamp, indent: true); + sb.AppendFormattedLine(UserCancellationMessage(), timestamp: DateTime.Now, showTimestamp: addTimestamp, indent: true); } else if (bgwErrorCount > 0) { - sb.AppendFormattedLine(FailureMessagePerPool(bgwErrorCount > 1), addTimestamp, true); + sb.AppendFormattedLine(FailureMessagePerPool(bgwErrorCount > 1), timestamp: DateTime.Now, showTimestamp: addTimestamp, indent: true); // we don't add formatting since errorSb has its own - sb.Append(errorSb.ToString()); + sb.Append(errorSb); } else if (!bgw.IsBusy) { - sb.AppendFormattedLine(WarningMessagePerPool(bgw.Pool) ?? SuccessMessagePerPool(bgw.Pool), addTimestamp, true); + sb.AppendFormattedLine(WarningMessagePerPool(bgw.Pool) ?? SuccessMessagePerPool(bgw.Pool), DateTime.Now, showTimestamp: addTimestamp, indent: true); } sb.AppendLine(); diff --git a/XenAdmin/Wizards/PatchingWizard/PlanActions/PlanAction.cs b/XenAdmin/Wizards/PatchingWizard/PlanActions/PlanAction.cs index 937a9041a4..b98680ca1b 100644 --- a/XenAdmin/Wizards/PatchingWizard/PlanActions/PlanAction.cs +++ b/XenAdmin/Wizards/PatchingWizard/PlanActions/PlanAction.cs @@ -51,37 +51,29 @@ public abstract class PlanAction : IEquatable private readonly Guid _actionId; private readonly object historyLock = new object(); - private readonly Stack _progressHistory = new Stack(); + private readonly Stack _progressHistory = new Stack(); - public virtual string Title - { - get { return null; } - } + public virtual string Title => null; - public virtual bool IsSkippable - { - get { return false; } - } + public virtual bool IsSkippable => false; public virtual bool Skipping { private get; set; } protected virtual void DoOnSkip() { } + public DateTime Timestamp { get; private set; } + public int PercentComplete { - get - { - return _percentComplete; - } + get => _percentComplete; protected set { _percentComplete = value; - if (OnProgressChange != null) - OnProgressChange(this); + OnProgressChange?.Invoke(this); } } - public List ProgressHistory + public List ProgressHistory { get { @@ -143,6 +135,7 @@ public virtual void Run() finally { _running = false; + Timestamp = DateTime.Now; PercentComplete = 100; } } @@ -152,7 +145,7 @@ public string CurrentProgressStep get { lock (historyLock) - return _progressHistory.Count > 0 ? _progressHistory.Peek() : string.Empty; + return _progressHistory.Count > 0 ? _progressHistory.Peek().Description : string.Empty; } } @@ -163,11 +156,12 @@ protected void AddProgressStep(string step) if (_progressHistory.Count > 0) { var popped = _progressHistory.Pop(); - _progressHistory.Push(popped + Messages.PLAN_ACTION_DONE); + var newItem = new PlanActionProgressStep(popped.Description + Messages.PLAN_ACTION_DONE, DateTime.Now); + _progressHistory.Push(newItem); } if (step != null) - _progressHistory.Push(step); + _progressHistory.Push(new PlanActionProgressStep(step, DateTime.Now)); if (OnProgressChange != null) OnProgressChange(this); @@ -181,7 +175,7 @@ protected void ReplaceProgressStep(string step) if (_progressHistory.Count > 0) _progressHistory.Pop(); - _progressHistory.Push(step); + _progressHistory.Push(new PlanActionProgressStep(step, DateTime.Now)); if (OnProgressChange != null) OnProgressChange(this); @@ -263,6 +257,17 @@ public virtual void Cancel() { Cancelling = true; } + + public class PlanActionProgressStep + { + public string Description { get; } + public DateTime Timestamp { get; } + public PlanActionProgressStep(string description, DateTime timestamp) + { + Description = description; + Timestamp = timestamp; + } + } } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 862fe22e88..ee05c5a56a 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -11538,6 +11538,15 @@ public static string DATEFORMAT_DM { } } + /// + /// Looks up a localized string similar to MMM d, h:mm:ss. + /// + public static string DATEFORMAT_DM_HM { + get { + return ResourceManager.GetString("DATEFORMAT_DM_HM", resourceCulture); + } + } + /// /// Looks up a localized string similar to MMM d, yyyy. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 5d1a7e3cc6..c43d35ffc1 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -4089,6 +4089,9 @@ For optimal performance and reliability during VM migration, ensure that the net MMM d + + MMM d, h:mm:ss + MMM d, yyyy From d8b8847269e5f823122678d41c2946fd11f93c9e Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 15 Aug 2022 15:58:39 +0100 Subject: [PATCH 09/14] CP-39929: Fix checkbox text in `DisplayOptionsPage` Also add missing ALT shortcuts Signed-off-by: Danilo Del Busso (cherry picked from commit 4ef260111bb933d7f79aaa4318117e6a50139862) --- XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx index 039e96f164..3f3522f05b 100644 --- a/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx +++ b/XenAdmin/Dialogs/OptionsPages/DisplayOptionsPage.resx @@ -160,7 +160,7 @@ 0 - Show timestamps in the update logs + &Show timestamps on the update and upgrade log consoles showTimestampsCheckBox @@ -223,7 +223,7 @@ 2 - Update logs options + Log consoles options updateLogOptionsDecentGroupBox @@ -521,7 +521,7 @@ 0 - Remember the last selected Tab for a resource + &Remember the last selected Tab for a resource checkBoxStoreTab From 6899d80d76f4c2b4d11456f603304ecf920794dc Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 22 Aug 2022 13:32:05 +0100 Subject: [PATCH 10/14] Use expression-bodied format for properties in `Xenadmin/Diagnostics/Problems/*` Signed-off-by: Danilo Del Busso --- .../HostProblem/ConflictingUpdatePresent.cs | 13 +---- .../HostProblem/HostMaintenanceMode.cs | 10 +--- .../Problems/HostProblem/HostNotLive.cs | 23 ++------- .../HostProblem/HostOutOfSpaceProblem.cs | 13 +---- .../HostProblem/LicenseRestrictionProblem.cs | 25 ++-------- .../Problems/HostProblem/NotEnoughMem.cs | 10 +--- .../HostProblem/PatchAlreadyApplied.cs | 15 ++---- .../Problems/HostProblem/PrecheckFailed.cs | 13 +---- .../HostProblem/PrerequisiteUpdateMissing.cs | 13 +---- .../HostProblem/WrongServerVersion.cs | 13 +---- .../PoolProblem/CPUIncompatibilityProblem.cs | 29 ++--------- .../Problems/PoolProblem/HAEnabledProblem.cs | 34 ++----------- .../MasterIsPendingRestartProblems.cs | 36 ++++--------- .../MissingMultipleFCSRsProblem.cs | 10 +--- .../Problems/PoolProblem/MissingSRProblem.cs | 21 ++------ .../PoolProblem/PoolHasGFS2SRProblem.cs | 9 +--- .../Problems/PoolProblem/PoolProblem.cs | 13 +---- .../PoolProblem/ServerSelectionProblem.cs | 23 ++------- .../Problems/PoolProblem/WLBEnabledProblem.cs | 23 ++------- .../UtilityProblem/CfuNotAvailableProblem.cs | 15 ++---- .../Problems/VMProblem/AutoStartEnabled.cs | 10 +--- .../Problems/VMProblem/ExistingVmProblem.cs | 13 +---- .../Problems/VMProblem/ExistingVmWarning.cs | 18 ++----- .../VMProblem/InvalidVCPUConfiguration.cs | 10 +--- .../Diagnostics/Problems/VMProblem/LocalCD.cs | 11 +--- .../Problems/VMProblem/LocalStorage.cs | 5 +- .../Diagnostics/Problems/VMProblem/NoHosts.cs | 5 +- .../Problems/VMProblem/NoPVDrivers.cs | 14 ++---- .../Problems/VMProblem/PVDriversOutOfDate.cs | 13 +---- .../Problems/VMProblem/RunningVMProblem.cs | 13 +---- .../Diagnostics/Problems/VMProblem/ToolsCD.cs | 5 +- .../Problems/VMProblem/VMCannotSeeNetwork.cs | 5 +- .../Problems/VMProblem/VMProblem.cs | 21 ++------ .../Problems/VMProblem/VmHasVgpu.cs | 5 +- .../ExistingVmApplianceProblem.cs | 13 +---- .../ExistingVmApplianceWarning.cs | 18 ++----- .../RunningVmApplianceProblem.cs | 13 +---- .../VmApplianceProblem/VmApplianceProblem.cs | 14 +----- .../Problems/XenCenterVersionProblem.cs | 50 ++++--------------- 39 files changed, 109 insertions(+), 508 deletions(-) diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/ConflictingUpdatePresent.cs b/XenAdmin/Diagnostics/Problems/HostProblem/ConflictingUpdatePresent.cs index 683475135b..00a1a006c3 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/ConflictingUpdatePresent.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/ConflictingUpdatePresent.cs @@ -45,17 +45,8 @@ public ConflictingUpdatePresent(Check check, string conflictingUpdates, Host hos this.conflictingUpdates = conflictingUpdates; } - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED_CONFLICTING_UPDATE, ServerName, conflictingUpdates); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED_CONFLICTING_UPDATE, ServerName, conflictingUpdates); - public override string HelpMessage - { - get { return string.Empty; } - } + public override string HelpMessage => string.Empty; } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs index f70f5b2d58..1ffd705ad9 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs @@ -44,10 +44,7 @@ public HostMaintenanceMode(Check check, Host host) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_HOST_MAINTENANCE_MODE, ServerName); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_HOST_MAINTENANCE_MODE, ServerName); protected override AsyncAction CreateAction(out bool cancelled) { @@ -56,10 +53,7 @@ protected override AsyncAction CreateAction(out bool cancelled) return new EnableHostAction(Server, false, AddHostToPoolCommand.EnableNtolDialog); } - public override string HelpMessage - { - get { return Messages.ENABLE_PLAIN; } - } + public override string HelpMessage => Messages.ENABLE_PLAIN; public override AsyncAction CreateUnwindChangesAction() { diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostNotLive.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostNotLive.cs index 798ee5cc3c..9042a3aa42 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostNotLive.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostNotLive.cs @@ -45,15 +45,9 @@ public HostNotLive(Check check, Host host) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_HOST_NOT_LIVE, ServerName); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_HOST_NOT_LIVE, ServerName); - public override string HelpMessage - { - get { return CanStartHost() ? Messages.START_HOST : string.Empty; } - } + public override string HelpMessage => CanStartHost() ? Messages.START_HOST : string.Empty; protected override AsyncAction CreateAction(out bool cancelled) { @@ -85,17 +79,8 @@ public HostNotLiveWarning(Check check, Host host) this.host = host; } - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_HOST_NOT_LIVE_WARNING, host); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_HOST_NOT_LIVE_WARNING, host); } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs index 8b93c1a283..91ce5894c9 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs @@ -134,18 +134,9 @@ protected override AsyncAction CreateAction(out bool cancelled) return action; } - public override string HelpMessage - { - get { return diskSpaceReq.GetMessageForActionLink(); } - } + public override string HelpMessage => diskSpaceReq.GetMessageForActionLink(); - public override bool IsFixable - { - get - { - return false; - } - } + public override bool IsFixable => false; public override bool Equals(object obj) { diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/LicenseRestrictionProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/LicenseRestrictionProblem.cs index e680715a67..ff0653eb7a 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/LicenseRestrictionProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/LicenseRestrictionProblem.cs @@ -46,29 +46,14 @@ public LicenseRestrictionProblem(Check check, Host host) this.host = host; } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED, Helpers.GetName(host).Ellipsise(30), FriendlyErrorNames.LICENCE_RESTRICTION); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED, Helpers.GetName(host).Ellipsise(30), FriendlyErrorNames.LICENCE_RESTRICTION); - public override string Title - { - get { return Description; } - } + public override string Title => Description; - public override string LinkText - { - get { return Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; } - } + public override string LinkText => Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; - public override string HelpMessage - { - get { return LinkText; } - } + public override string HelpMessage => LinkText; - public override Uri UriToLaunch - { - get { return new Uri(InvisibleMessages.UPSELL_SA); } - } + public override Uri UriToLaunch => new Uri(InvisibleMessages.UPSELL_SA); } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs index 1578915276..47c1bddc59 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs @@ -51,10 +51,7 @@ public NotEnoughMem(Check check, Host host) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_NO_MEMORY, ServerName); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_NO_MEMORY, ServerName); protected override AsyncAction CreateAction(out bool cancelled) { @@ -75,10 +72,7 @@ protected override AsyncAction CreateAction(out bool cancelled) return null; } - public override string HelpMessage - { - get { return Messages.SUSPEND_VMS; } - } + public override string HelpMessage => Messages.SUSPEND_VMS; public override AsyncAction CreateUnwindChangesAction() { diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs index 5428f69b9c..0bed4ad79c 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs @@ -46,19 +46,10 @@ public PatchAlreadyApplied(Check check, Host host) _host = host; } - public override string Title - { - get { return string.Format(Messages.UPDATES_WIZARD_PATCH_ALREADY_APPLIED_TITLE, Helpers.GetName(_host).Ellipsise(30)); } - } + public override string Title => string.Format(Messages.UPDATES_WIZARD_PATCH_ALREADY_APPLIED_TITLE, Helpers.GetName(_host).Ellipsise(30)); - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_PATCH_ALREADY_APPLIED, Helpers.GetName(_host).Ellipsise(30)); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_PATCH_ALREADY_APPLIED, Helpers.GetName(_host).Ellipsise(30)); - public override string HelpMessage - { - get { return string.Empty; } - } + public override string HelpMessage => string.Empty; } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs index 087ec2f0b4..09b797e546 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs @@ -45,17 +45,8 @@ public PrecheckFailed(Check check, Host host, Failure failure) Failure = failure; } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED, ServerName, Failure.Message); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED, ServerName, Failure.Message); - public override string HelpMessage - { - get - { - return string.Empty; - } - } + public override string HelpMessage => string.Empty; } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PrerequisiteUpdateMissing.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PrerequisiteUpdateMissing.cs index 375c9e7aba..fb49a42ce5 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PrerequisiteUpdateMissing.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PrerequisiteUpdateMissing.cs @@ -44,17 +44,8 @@ public PrerequisiteUpdateMissing(Check check, string requiredUpdates, Host host) this.requiredUpdates = requiredUpdates; } - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED_REQUIRED_UPDATE_MISSING, ServerName, requiredUpdates); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_PRECHECK_FAILED_REQUIRED_UPDATE_MISSING, ServerName, requiredUpdates); - public override string HelpMessage - { - get { return string.Empty; } - } + public override string HelpMessage => string.Empty; } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/WrongServerVersion.cs b/XenAdmin/Diagnostics/Problems/HostProblem/WrongServerVersion.cs index 4c481e9dc1..b830890730 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/WrongServerVersion.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/WrongServerVersion.cs @@ -50,17 +50,8 @@ public WrongServerVersion(Check check, Host host) { } - public override string Description - { - get - { - return string.Format(Messages.UPDATE_FOR_DIFFERENT_XENSERVER_VERSION, ServerName); - } - } + public override string Description => string.Format(Messages.UPDATE_FOR_DIFFERENT_XENSERVER_VERSION, ServerName); - public override string HelpMessage - { - get { return string.Empty; } - } + public override string HelpMessage => string.Empty; } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs index 74a8382946..bfc1ed0e70 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs @@ -99,21 +99,9 @@ public override AsyncAction CreateUnwindChangesAction() return null; } - public override string Description - { - get - { - return String.Format(Messages.UPGRADEWIZARD_PROBLEM_INCOMPATIBLE_CPUS, Pool); - } - } + public override string Description => String.Format(Messages.UPGRADEWIZARD_PROBLEM_INCOMPATIBLE_CPUS, Pool); - public override string HelpMessage - { - get - { - return Messages.UPGRADEWIZARD_PROBLEM_INCOMPATIBLE_CPUS_HELPMESSAGE; - } - } + public override string HelpMessage => Messages.UPGRADEWIZARD_PROBLEM_INCOMPATIBLE_CPUS_HELPMESSAGE; } class CPUCIncompatibilityWarning : Warning @@ -128,17 +116,8 @@ public CPUCIncompatibilityWarning(Check check, Pool pool, Host host) this.host = host; } - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; - public override string Description - { - get - { - return string.Format(Messages.UPGRADEWIZARD_WARNING_INCOMPATIBLE_CPUS, host, pool); - } - } + public override string Description => string.Format(Messages.UPGRADEWIZARD_WARNING_INCOMPATIBLE_CPUS, host, pool); } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/HAEnabledProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/HAEnabledProblem.cs index 46d2ce9049..3206c56a13 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/HAEnabledProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/HAEnabledProblem.cs @@ -72,21 +72,9 @@ public override AsyncAction CreateUnwindChangesAction() return pool != null ? new EnableHAAction(pool, null, HeartbeatSrs, FailuresToTolerate) : null; } - public override string Description - { - get - { - return String.Format(Messages.UPDATES_WIZARD_HA_ON_DESCRIPTION, Pool); - } - } + public override string Description => String.Format(Messages.UPDATES_WIZARD_HA_ON_DESCRIPTION, Pool); - public override string HelpMessage - { - get - { - return Messages.TURN_HA_OFF; - } - } + public override string HelpMessage => Messages.TURN_HA_OFF; } class DrHAEnabledProblem : HAEnabledProblem @@ -96,10 +84,7 @@ public DrHAEnabledProblem(Check check, Pool pool) { } - public override string Description - { - get { return Messages.DR_WIZARD_PROBLEM_HA_ENABLED; } - } + public override string Description => Messages.DR_WIZARD_PROBLEM_HA_ENABLED; } class HAEnabledWarning : Warning @@ -114,17 +99,8 @@ public HAEnabledWarning(Check check, Pool pool, Host host) this.host = host; } - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_HA_ON_WARNING, host, pool); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_HA_ON_WARNING, host, pool); } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/MasterIsPendingRestartProblems.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/MasterIsPendingRestartProblems.cs index 837d757e9d..2a71171c21 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/MasterIsPendingRestartProblems.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/MasterIsPendingRestartProblems.cs @@ -41,22 +41,14 @@ public MasterIsPendingRestartHostProblem(RestartHostOrToolstackPendingOnMasterCh : base(check, pool) { } - public override string Description - { - get - { - return string.Format( - ((RestartHostOrToolstackPendingOnMasterCheck)Check).UpdateUuid != null + public override string Description => + string.Format( + ((RestartHostOrToolstackPendingOnMasterCheck)Check).UpdateUuid != null ? Messages.PROBLEM_MASTER_PENDING_RESTART_HOST_THIS_UPDATE : Messages.PROBLEM_MASTER_PENDING_RESTART_HOST, - Helpers.GetName(Pool).Ellipsise(30)); - } - } + Helpers.GetName(Pool).Ellipsise(30)); - public override string HelpMessage - { - get { return null; } - } + public override string HelpMessage => null; } class MasterIsPendingRestartToolstackProblem : PoolProblem @@ -65,21 +57,13 @@ public MasterIsPendingRestartToolstackProblem(RestartHostOrToolstackPendingOnMas : base(check, pool) { } - public override string Description - { - get - { - return string.Format( - ((RestartHostOrToolstackPendingOnMasterCheck)Check).UpdateUuid != null + public override string Description => + string.Format( + ((RestartHostOrToolstackPendingOnMasterCheck)Check).UpdateUuid != null ? Messages.PROBLEM_MASTER_PENDING_RESTART_TOOLSTACK_THIS_UPDATE : Messages.PROBLEM_MASTER_PENDING_RESTART_TOOLSTACK, - Helpers.GetName(Pool).Ellipsise(30)); - } - } + Helpers.GetName(Pool).Ellipsise(30)); - public override string HelpMessage - { - get { return null; } - } + public override string HelpMessage => null; } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/MissingMultipleFCSRsProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/MissingMultipleFCSRsProblem.cs index 3b9d0e7973..2e4bde30ea 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/MissingMultipleFCSRsProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/MissingMultipleFCSRsProblem.cs @@ -50,15 +50,9 @@ public MissingMultipleFCSRsProblem(Check check, Pool pool, List this.srDeviceConfigList = srDeviceConfigList; } - private bool EmptySRDeviceConfigList - { - get { return srDeviceConfigList == null || srDeviceConfigList.Count == 0; } - } + private bool EmptySRDeviceConfigList => srDeviceConfigList == null || srDeviceConfigList.Count == 0; - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; public override string Description { diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/MissingSRProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/MissingSRProblem.cs index 2226a55bd2..45b3ee035e 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/MissingSRProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/MissingSRProblem.cs @@ -54,27 +54,12 @@ public MissingSRProblem(Check check, Pool pool, SR sr, Dictionary Check.Description; - public override string Description - { - get - { - return String.Format(sr.shared ? Messages.DR_WIZARD_PROBLEM_MISSING_SR : Messages.DR_WIZARD_PROBLEM_LOCAL_STORAGE, sr.Name()); - } - } + public override string Description => String.Format(sr.shared ? Messages.DR_WIZARD_PROBLEM_MISSING_SR : Messages.DR_WIZARD_PROBLEM_LOCAL_STORAGE, sr.Name()); - public override string HelpMessage - { - get - { - return sr.shared ? Messages.DR_WIZARD_PROBLEM_MISSING_SR_HELPMESSAGE : ""; - } - } + public override string HelpMessage => sr.shared ? Messages.DR_WIZARD_PROBLEM_MISSING_SR_HELPMESSAGE : ""; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs index 801333c72b..081039e210 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs @@ -70,13 +70,6 @@ public override string Description } } - public override string HelpMessage - { - get - { - return ""; - } - } - + public override string HelpMessage => ""; } } \ No newline at end of file diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolProblem.cs index dfeaf1c32b..d5e1279ae5 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolProblem.cs @@ -46,17 +46,8 @@ public PoolProblem(Check check, Pool pool) _pool = pool; } - public Pool Pool - { - get - { - return _pool; - } - } + public Pool Pool => _pool; - public sealed override string Title - { - get { return string.Format(Messages.PROBLEM_POOLPROBLEM_TITLE, Helpers.GetName(Pool).Ellipsise(30)); } - } + public sealed override string Title => string.Format(Messages.PROBLEM_POOLPROBLEM_TITLE, Helpers.GetName(Pool).Ellipsise(30)); } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/ServerSelectionProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/ServerSelectionProblem.cs index 811160c9d0..34d34e7b5a 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/ServerSelectionProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/ServerSelectionProblem.cs @@ -42,15 +42,9 @@ public ServerSelectionProblem(Check check, Pool pool) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_SERVER_SELECTION_PROBLEM, Pool); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_SERVER_SELECTION_PROBLEM, Pool); - public override string HelpMessage - { - get { return null; } - } + public override string HelpMessage => null; } class MixedPoolServerSelectionWarning : Warning @@ -63,17 +57,8 @@ public MixedPoolServerSelectionWarning(Check check, Pool pool) this.pool = pool; } - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_MIXED_POOL_SERVER_SELECTION_WARNING, pool); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_MIXED_POOL_SERVER_SELECTION_WARNING, pool); } } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/WLBEnabledProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/WLBEnabledProblem.cs index 21278af0c0..a3de5394e2 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/WLBEnabledProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/WLBEnabledProblem.cs @@ -46,15 +46,9 @@ public WLBEnabledProblem(Check check, Pool pool) { } - public override string Description - { - get { return string.Format(Messages.CHECK_WLB_ENABLED, Pool); } - } + public override string Description => string.Format(Messages.CHECK_WLB_ENABLED, Pool); - public override string HelpMessage - { - get { return Messages.HELP_MESSAGE_DISABLE_WLB; } - } + public override string HelpMessage => Messages.HELP_MESSAGE_DISABLE_WLB; protected override AsyncAction CreateAction(out bool cancelled) { @@ -87,17 +81,8 @@ public WLBEnabledWarning(Check check, Pool pool, Host host) this.host = host; } - public override string Title - { - get { return Check.Description; } - } + public override string Title => Check.Description; - public override string Description - { - get - { - return string.Format(Messages.UPDATES_WIZARD_WLB_ON_WARNING, host, pool); - } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_WLB_ON_WARNING, host, pool); } } diff --git a/XenAdmin/Diagnostics/Problems/UtilityProblem/CfuNotAvailableProblem.cs b/XenAdmin/Diagnostics/Problems/UtilityProblem/CfuNotAvailableProblem.cs index 0e5f216a76..ead015d363 100644 --- a/XenAdmin/Diagnostics/Problems/UtilityProblem/CfuNotAvailableProblem.cs +++ b/XenAdmin/Diagnostics/Problems/UtilityProblem/CfuNotAvailableProblem.cs @@ -42,10 +42,7 @@ public CfuNotAvailableProblem(Check check) { } - public override string Description - { - get { return Messages.UPGRADEWIZARD_PROBLEM_CFU_STATUS; } - } + public override string Description => Messages.UPGRADEWIZARD_PROBLEM_CFU_STATUS; protected override AsyncAction CreateAction(out bool cancelled) { @@ -58,14 +55,8 @@ protected override AsyncAction CreateAction(out bool cancelled) public override string HelpMessage => Messages.MORE_INFO; - public sealed override string Title - { - get { return string.Empty; } - } + public sealed override string Title => string.Empty; - public override bool IsFixable - { - get { return false; } - } + public override bool IsFixable => false; } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs b/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs index 045cb6622a..d9dc2a7911 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs @@ -45,10 +45,7 @@ public AutoStartEnabled(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return string.Format(Messages.AUTOSTART_ENABLED_CHECK_DESCRIPTION, ServerName, Helpers.GetName(VM).Ellipsise(30)); } - } + public override string Description => string.Format(Messages.AUTOSTART_ENABLED_CHECK_DESCRIPTION, ServerName, Helpers.GetName(VM).Ellipsise(30)); protected override AsyncAction CreateAction(out bool cancelled) { @@ -56,10 +53,7 @@ protected override AsyncAction CreateAction(out bool cancelled) return new DelegatedAsyncAction(VM.Connection, Messages.ACTION_DISABLE_AUTOSTART_ON_VM, string.Format(Messages.ACTION_DISABLING_AUTOSTART_ON_VM, Helpers.GetName(VM)), null, ActionDelegate(false)); } - public override string HelpMessage - { - get { return Messages.DISABLE_NOAMP; } - } + public override string HelpMessage => Messages.DISABLE_NOAMP; private Action ActionDelegate(bool autostartValue) { diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs index 6778de989d..0b451c0ff5 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs @@ -49,18 +49,9 @@ public ExistingVmProblem(Check check, VM vm) { } - public override string Description - { - get - { - return String.Format(Messages.DR_WIZARD_PROBLEM_EXISTING_VM, Helpers.GetPoolOfOne(VM.Connection).Name()); - } - } + public override string Description => String.Format(Messages.DR_WIZARD_PROBLEM_EXISTING_VM, Helpers.GetPoolOfOne(VM.Connection).Name()); - public override string HelpMessage - { - get { return Messages.DR_WIZARD_PROBLEM_EXISTING_VM_HELPMESSAGE; } - } + public override string HelpMessage => Messages.DR_WIZARD_PROBLEM_EXISTING_VM_HELPMESSAGE; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs index 34197635d6..04fb127ed5 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs @@ -47,22 +47,10 @@ public ExistingVmWarning(Check check, VM vm) _vm = vm; } - protected VM Vm - { - get - { - return _vm.Connection.WaitForCache(new XenRef(_vm.opaque_ref)); - } - } + protected VM Vm => _vm.Connection.WaitForCache(new XenRef(_vm.opaque_ref)); - public sealed override string Title - { - get { return string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, Helpers.GetName(Vm).Ellipsise(30)); } - } + public sealed override string Title => string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, Helpers.GetName(Vm).Ellipsise(30)); - public override string Description - { - get { return String.Format(Messages.DR_WIZARD_WARNING_EXISTING_VM, Helpers.GetPoolOfOne(Vm.Connection).Name()); } - } + public override string Description => String.Format(Messages.DR_WIZARD_WARNING_EXISTING_VM, Helpers.GetPoolOfOne(Vm.Connection).Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs b/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs index 1a2838e2ab..740864d6cc 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs @@ -44,15 +44,9 @@ public class InvalidVCPUConfiguration : VMProblem public InvalidVCPUConfiguration(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return String.Format(Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS, ServerName, VM.Name()); } - } + public override string Description => String.Format(Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS, ServerName, VM.Name()); - public override string HelpMessage - { - get { return Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS_HELPMESSAGE; } - } + public override string HelpMessage => Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS_HELPMESSAGE; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs b/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs index 34e4ce8e3f..8375ccf275 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/LocalCD.cs @@ -41,10 +41,7 @@ public class LocalCD : VMProblem public LocalCD(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, ServerName, VM.Name()); protected override AsyncAction CreateAction(out bool cancelled) { @@ -60,10 +57,6 @@ public override AsyncAction CreateUnwindChangesAction() } - public override string HelpMessage - { - get { return Messages.EJECT_CD; } - } - + public override string HelpMessage => Messages.EJECT_CD; } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs b/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs index c8d1e9d5cf..786b9eb084 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/LocalStorage.cs @@ -40,9 +40,6 @@ public class LocalStorage : VMProblem public LocalStorage(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_STORAGE, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_LOCAL_STORAGE, ServerName, VM.Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs b/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs index 73a4d174c2..c3be128048 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/NoHosts.cs @@ -42,9 +42,6 @@ public NoHosts(Check check, VM vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_NO_HOSTS, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_NO_HOSTS, ServerName, VM.Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs b/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs index 3b46c4725c..b2d73b3181 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs @@ -43,18 +43,10 @@ public NoPVDrivers(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return String.Format(Messages.UPDATES_WIZARD_NO_TOOLS, ServerName, VM.Name()); } - } + public override string Description => String.Format(Messages.UPDATES_WIZARD_NO_TOOLS, ServerName, VM.Name()); + + public override string HelpMessage => Messages.INSTALL_XENSERVER_TOOLS; - public override string HelpMessage - { - get - { - return Messages.INSTALL_XENSERVER_TOOLS; - } - } protected override AsyncAction CreateAction(out bool cancelled) { cancelled = false; diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/PVDriversOutOfDate.cs b/XenAdmin/Diagnostics/Problems/VMProblem/PVDriversOutOfDate.cs index 92c1e093eb..63723c3463 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/PVDriversOutOfDate.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/PVDriversOutOfDate.cs @@ -40,17 +40,8 @@ public class PVDriversOutOfDate : NoPVDrivers public PVDriversOutOfDate(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_OUT_OF_DATE_TOOLS, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_OUT_OF_DATE_TOOLS, ServerName, VM.Name()); - public override string HelpMessage - { - get - { - return Messages.INSTALL_XENSERVER_TOOLS; - } - } + public override string HelpMessage => Messages.INSTALL_XENSERVER_TOOLS; } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs index 948a02ebd9..ecda7b2e14 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs @@ -49,18 +49,9 @@ public RunningVMProblem(Check check, VM vm, bool hardShutdown) this.hardShutdown = hardShutdown; } - public override string Description - { - get - { - return String.Format(Messages.DR_WIZARD_PROBLEM_RUNNING_VM, Helpers.GetPoolOfOne(VM.Connection).Name()); - } - } + public override string Description => String.Format(Messages.DR_WIZARD_PROBLEM_RUNNING_VM, Helpers.GetPoolOfOne(VM.Connection).Name()); - public override string HelpMessage - { - get { return Messages.DR_WIZARD_PROBLEM_RUNNING_VM_HELPMESSAGE; } - } + public override string HelpMessage => Messages.DR_WIZARD_PROBLEM_RUNNING_VM_HELPMESSAGE; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs index 9bce2e7319..96f702d930 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs @@ -42,9 +42,6 @@ public ToolsCD(Check check, VM vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_TOOLS_CD, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_TOOLS_CD, ServerName, VM.Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs b/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs index a286a0adfe..0c04a7067c 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs @@ -46,9 +46,6 @@ public VMCannotSeeNetwork(Check check, VM vm, XenAPI.Network network) Network = network; } - public override string Description - { - get { return String.Format(Messages.UPDATES_WIZARD_CANNOT_SEE_NETWORK, ServerName, VM.Name(), Network.Name()); } - } + public override string Description => String.Format(Messages.UPDATES_WIZARD_CANNOT_SEE_NETWORK, ServerName, VM.Name(), Network.Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs index 953bc86b1e..ed1c99cba0 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs @@ -53,13 +53,7 @@ protected VMProblem(Check check, VM vm) } - protected string ServerName - { - get - { - return residentOn != null ? Helpers.GetName(residentOn).Ellipsise(30) : Helpers.GetName(Helpers.GetPoolOfOne(VM.Connection)).Ellipsise(30); - } - } + protected string ServerName => residentOn != null ? Helpers.GetName(residentOn).Ellipsise(30) : Helpers.GetName(Helpers.GetPoolOfOne(VM.Connection)).Ellipsise(30); public override string HelpMessage { @@ -74,10 +68,7 @@ public override string HelpMessage } } - public sealed override string Title - { - get { return string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, VM.uuid); } - } + public sealed override string Title => string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, VM.uuid); protected AsyncAction SuspendVM() { @@ -89,13 +80,7 @@ protected AsyncAction ShutdownVM() return new VMHardShutdown(VM); } - protected virtual bool CanSuspendVM - { - get - { - return VM.allowed_operations.Contains(vm_operations.suspend); - } - } + protected virtual bool CanSuspendVM => VM.allowed_operations.Contains(vm_operations.suspend); protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/VmHasVgpu.cs b/XenAdmin/Diagnostics/Problems/VMProblem/VmHasVgpu.cs index 943845576f..eb62cd723c 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/VmHasVgpu.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/VmHasVgpu.cs @@ -39,9 +39,6 @@ public class VmHasVgpu : VMProblem public VmHasVgpu(Check check, VM vm) : base(check, vm) { } - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_VM_HAS_VGPU, ServerName, VM.Name()); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_VM_HAS_VGPU, ServerName, VM.Name()); } } diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs index ec15d8e1a7..67d65f8da7 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs @@ -52,18 +52,9 @@ public ExistingVmApplianceProblem(Check check, VM_appliance vmAppliance, List String.Format(Messages.DR_WIZARD_PROBLEM_EXISTING_APPLIANCE, Helpers.GetPoolOfOne(vmsToDestroy[0].Connection).Name()); - public override string HelpMessage - { - get { return Messages.DR_WIZARD_PROBLEM_EXISTING_APPLIANCE_HELPMESSAGE; } - } + public override string HelpMessage => Messages.DR_WIZARD_PROBLEM_EXISTING_APPLIANCE_HELPMESSAGE; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceWarning.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceWarning.cs index 7bf9d874ca..4d4f48d0a8 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceWarning.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceWarning.cs @@ -47,22 +47,10 @@ public ExistingVmApplianceWarning(Check check, VM_appliance vmAppliance) this.vmAppliance = vmAppliance; } - protected VM_appliance VmAppliance - { - get - { - return vmAppliance.Connection.WaitForCache(new XenRef(vmAppliance.opaque_ref)); - } - } + protected VM_appliance VmAppliance => vmAppliance.Connection.WaitForCache(new XenRef(vmAppliance.opaque_ref)); - public sealed override string Title - { - get { return Helpers.GetName(VmAppliance).Ellipsise(30); } - } + public sealed override string Title => Helpers.GetName(VmAppliance).Ellipsise(30); - public override string Description - { - get { return String.Format(Messages.DR_WIZARD_WARNING_EXISTING_VM, Helpers.GetPoolOfOne(VmAppliance.Connection).Name()); } - } + public override string Description => String.Format(Messages.DR_WIZARD_WARNING_EXISTING_VM, Helpers.GetPoolOfOne(VmAppliance.Connection).Name()); } } \ No newline at end of file diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs index a78c70c167..aba576bcf0 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs @@ -52,18 +52,9 @@ public RunningVmApplianceProblem(Check check, VM_appliance vmAppliance, bool har this.hardShutdown = hardShutdown; } - public override string Description - { - get - { - return String.Format(Messages.DR_WIZARD_PROBLEM_RUNNING_APPLIANCE, Helpers.GetPoolOfOne(VmAppliance.Connection).Name()); - } - } + public override string Description => String.Format(Messages.DR_WIZARD_PROBLEM_RUNNING_APPLIANCE, Helpers.GetPoolOfOne(VmAppliance.Connection).Name()); - public override string HelpMessage - { - get { return Messages.DR_WIZARD_PROBLEM_RUNNING_APPLIANCE_HELPMESSAGE; } - } + public override string HelpMessage => Messages.DR_WIZARD_PROBLEM_RUNNING_APPLIANCE_HELPMESSAGE; protected override AsyncAction CreateAction(out bool cancelled) { diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/VmApplianceProblem.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/VmApplianceProblem.cs index 1bbf8ce405..8461644d93 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/VmApplianceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/VmApplianceProblem.cs @@ -46,18 +46,8 @@ public VmApplianceProblem(Check check, VM_appliance vmAppliance) _vmAppliance = vmAppliance; } - public VM_appliance VmAppliance - { - get - { - return _vmAppliance; - } - } - - public sealed override string Title - { - get { return string.Format(Messages.PROBLEM_VMAPPLIANCEPROBLEM_TITLE, Helpers.GetName(VmAppliance).Ellipsise(30)); } - } + public VM_appliance VmAppliance => _vmAppliance; + public sealed override string Title => string.Format(Messages.PROBLEM_VMAPPLIANCEPROBLEM_TITLE, Helpers.GetName(VmAppliance).Ellipsise(30)); } } diff --git a/XenAdmin/Diagnostics/Problems/XenCenterVersionProblem.cs b/XenAdmin/Diagnostics/Problems/XenCenterVersionProblem.cs index d18a02dd83..436132d795 100644 --- a/XenAdmin/Diagnostics/Problems/XenCenterVersionProblem.cs +++ b/XenAdmin/Diagnostics/Problems/XenCenterVersionProblem.cs @@ -45,30 +45,15 @@ public XenCenterVersionProblem(Check check, XenCenterVersion requiredXenCenterVe _requiredXenCenterVersion = requiredXenCenterVersion; } - public override string Title - { - get { return Messages.PROBLEM_XENCENTER_VERSION_TITLE; } - } + public override string Title => Messages.PROBLEM_XENCENTER_VERSION_TITLE; - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_NEWER_XENCENTER_REQUIRED, _requiredXenCenterVersion.Version); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_NEWER_XENCENTER_REQUIRED, _requiredXenCenterVersion.Version); - public override string HelpMessage - { - get { return LinkText; } - } + public override string HelpMessage => LinkText; - public override string LinkText - { - get { return Messages.PATCHING_WIZARD_WEBPAGE_CELL; } - } + public override string LinkText => Messages.PATCHING_WIZARD_WEBPAGE_CELL; - public override Uri UriToLaunch - { - get { return new Uri(_requiredXenCenterVersion.Url); } - } + public override Uri UriToLaunch => new Uri(_requiredXenCenterVersion.Url); } public class XenCenterVersionWarning : WarningWithInformationUrl @@ -81,29 +66,14 @@ public XenCenterVersionWarning(Check check, XenCenterVersion requiredXenCenterVe _requiredXenCenterVersion = requiredXenCenterVersion; } - public override string Title - { - get { return Messages.PROBLEM_XENCENTER_VERSION_TITLE; } - } + public override string Title => Messages.PROBLEM_XENCENTER_VERSION_TITLE; - public override string Description - { - get { return string.Format(Messages.UPDATES_WIZARD_NEWER_XENCENTER_WARNING, _requiredXenCenterVersion.Version); } - } + public override string Description => string.Format(Messages.UPDATES_WIZARD_NEWER_XENCENTER_WARNING, _requiredXenCenterVersion.Version); - public override string HelpMessage - { - get { return LinkText; } - } + public override string HelpMessage => LinkText; - public override string LinkText - { - get { return Messages.PATCHING_WIZARD_WEBPAGE_CELL; } - } + public override string LinkText => Messages.PATCHING_WIZARD_WEBPAGE_CELL; - public override Uri UriToLaunch - { - get { return new Uri(_requiredXenCenterVersion.Url); } - } + public override Uri UriToLaunch => new Uri(_requiredXenCenterVersion.Url); } } From 39766b64baa848c0ab1438a2a907a32143f304a3 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 22 Aug 2022 13:36:04 +0100 Subject: [PATCH 11/14] Normalise whitespace in `Xenadmin/Diagnostics/Problems/*` Signed-off-by: Danilo Del Busso --- .../HostProblem/HostMaintenanceMode.cs | 4 +-- .../Problems/HostProblem/HostNeedsReboot.cs | 4 +-- .../HostNotSafeToUpgradeWarning.cs | 6 ++--- .../HostProblem/HostOutOfSpaceProblem.cs | 26 +++++++++---------- .../HostPrepareToUpgradeProblem.cs | 2 +- .../Problems/HostProblem/HostProblem.cs | 2 +- .../Problems/HostProblem/NotEnoughMem.cs | 4 +-- .../HostProblem/PatchAlreadyApplied.cs | 2 +- .../Problems/HostProblem/PowerOniLoProblem.cs | 2 +- .../Problems/HostProblem/PrecheckFailed.cs | 2 +- .../PoolProblem/CPUIncompatibilityProblem.cs | 2 +- .../PoolProblem/PoolHasGFS2SRProblem.cs | 2 +- .../PoolProblem/VSwitchControllerProblem.cs | 4 +-- XenAdmin/Diagnostics/Problems/Problem.cs | 8 +++--- .../Problems/VMProblem/AutoStartEnabled.cs | 2 +- .../Problems/VMProblem/CannotMigrateVM.cs | 8 +++--- .../Problems/VMProblem/ExistingVmProblem.cs | 4 +-- .../Problems/VMProblem/ExistingVmWarning.cs | 2 +- .../VMProblem/InvalidVCPUConfiguration.cs | 2 +- .../Problems/VMProblem/NoPVDrivers.cs | 2 +- .../Problems/VMProblem/RunningVMProblem.cs | 2 +- .../Diagnostics/Problems/VMProblem/ToolsCD.cs | 4 +-- .../Problems/VMProblem/VMCannotSeeNetwork.cs | 4 +-- .../Problems/VMProblem/VMProblem.cs | 2 +- .../ExistingVmApplianceProblem.cs | 4 +-- .../RunningVmApplianceProblem.cs | 4 +-- XenAdmin/Diagnostics/Problems/Warning.cs | 4 +-- 27 files changed, 57 insertions(+), 57 deletions(-) diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs index 1ffd705ad9..9778b6dbe8 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostMaintenanceMode.cs @@ -39,8 +39,8 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem { public class HostMaintenanceMode : HostProblem { - public HostMaintenanceMode(Check check, Host host) - : base(check, host) + public HostMaintenanceMode(Check check, Host host) + : base(check, host) { } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostNeedsReboot.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostNeedsReboot.cs index c46946568b..eb010c55bd 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostNeedsReboot.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostNeedsReboot.cs @@ -52,8 +52,8 @@ public HostNeedsReboot(Check check, Host host, bool livePatchingRestricted = fal public override string Description => livePatchingRestricted ? string.Format(Messages.UPDATES_WIZARD_REBOOT_NEEDED_LIVEPATCH_RESTRICTED, host.name_label) - : livePatchingDisabled - ? string.Format(Messages.UPDATES_WIZARD_REBOOT_NEEDED_LIVEPATCH_DISABLED, host.name_label) + : livePatchingDisabled + ? string.Format(Messages.UPDATES_WIZARD_REBOOT_NEEDED_LIVEPATCH_DISABLED, host.name_label) : string.Format(Messages.UPDATES_WIZARD_REBOOT_NEEDED, host.name_label); } } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostNotSafeToUpgradeWarning.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostNotSafeToUpgradeWarning.cs index 0ba2f177d2..749f9b3856 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostNotSafeToUpgradeWarning.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostNotSafeToUpgradeWarning.cs @@ -60,9 +60,9 @@ public override string Message { switch (reason) { - case HostNotSafeToUpgradeReason.NotEnoughSpace : - return string.Format(Messages.NOT_SAFE_TO_UPGRADE_NOT_ENOUGH_SPACE_LONG, BrandManager.ProductVersion70); - + case HostNotSafeToUpgradeReason.NotEnoughSpace: + return string.Format(Messages.NOT_SAFE_TO_UPGRADE_NOT_ENOUGH_SPACE_LONG, BrandManager.ProductVersion70); + default: return string.Format(Messages.NOT_SAFE_TO_UPGRADE_DEFAULT_WARNING_LONG, BrandManager.ProductVersion70); } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs index 91ce5894c9..849006ecd4 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostOutOfSpaceProblem.cs @@ -46,7 +46,7 @@ public class HostOutOfSpaceProblem : HostProblem private readonly Pool_update update; public HostOutOfSpaceProblem(Check check, Host host, Pool_patch patch, DiskSpaceRequirements diskSpaceReq) - : base(check, host) + : base(check, host) { this.patch = patch; this.diskSpaceReq = diskSpaceReq; @@ -82,13 +82,13 @@ public override string Description switch (diskSpaceReq.Operation) { - case DiskSpaceRequirements.OperationTypes.install : - return string.Format(Messages.NOT_ENOUGH_SPACE_MESSAGE_INSTALL, ServerName, name); - - case DiskSpaceRequirements.OperationTypes.upload : - return string.Format(Messages.NOT_ENOUGH_SPACE_MESSAGE_UPLOAD, ServerName, name); - - case DiskSpaceRequirements.OperationTypes.automatedUpdates : + case DiskSpaceRequirements.OperationTypes.install: + return string.Format(Messages.NOT_ENOUGH_SPACE_MESSAGE_INSTALL, ServerName, name); + + case DiskSpaceRequirements.OperationTypes.upload: + return string.Format(Messages.NOT_ENOUGH_SPACE_MESSAGE_UPLOAD, ServerName, name); + + case DiskSpaceRequirements.OperationTypes.automatedUpdates: return string.Format(Messages.NOT_ENOUGH_SPACE_MESSAGE_AUTO_UPDATE, ServerName); case DiskSpaceRequirements.OperationTypes.automatedUpdatesUploadOne: @@ -108,7 +108,7 @@ protected override AsyncAction CreateAction(out bool cancelled) if (patch != null && diskSpaceReq.CanCleanup) { - Program.Invoke(Program.MainWindow, delegate() + Program.Invoke(Program.MainWindow, delegate () { using (var dlg = new WarningDialog(diskSpaceReq.GetSpaceRequirementsMessage(), new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, selected: true), @@ -122,15 +122,15 @@ protected override AsyncAction CreateAction(out bool cancelled) }); } else - { - Program.Invoke(Program.MainWindow, delegate() + { + Program.Invoke(Program.MainWindow, delegate () { using (var dlg = new WarningDialog(diskSpaceReq.GetSpaceRequirementsMessage())) dlg.ShowDialog(); }); } - cancelled = action == null; - + cancelled = action == null; + return action; } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostPrepareToUpgradeProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostPrepareToUpgradeProblem.cs index bd41e20178..ca642269f8 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostPrepareToUpgradeProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostPrepareToUpgradeProblem.cs @@ -51,7 +51,7 @@ public HostPrepareToUpgradeProblem(Check check, Host host, string friendlyErrorK public override bool IsFixable => false; public override string Description => _shortMessage; - + public override string HelpMessage => Messages.MORE_INFO; protected override Actions.AsyncAction CreateAction(out bool cancelled) diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/HostProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/HostProblem.cs index c07873375f..b1e2d4db82 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/HostProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/HostProblem.cs @@ -38,7 +38,7 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem { public abstract class HostProblem : Problem { - protected HostProblem(Check check, Host server) + protected HostProblem(Check check, Host server) : base(check) { Server = server; diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs index 47c1bddc59..314ff6b4b1 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/NotEnoughMem.cs @@ -47,7 +47,7 @@ public class NotEnoughMem : HostProblem private List VmsToShutdown = new List(); public NotEnoughMem(Check check, Host host) - : base(check, host) + : base(check, host) { } @@ -76,7 +76,7 @@ protected override AsyncAction CreateAction(out bool cancelled) public override AsyncAction CreateUnwindChangesAction() { - return new ResumeAndStartVMsAction(Server.Connection, Server, VmsToSuspend, VmsToShutdown,VMOperationCommand.WarningDialogHAInvalidConfig,VMOperationCommand.StartDiagnosisForm); + return new ResumeAndStartVMsAction(Server.Connection, Server, VmsToSuspend, VmsToShutdown, VMOperationCommand.WarningDialogHAInvalidConfig, VMOperationCommand.StartDiagnosisForm); } diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs index 0bed4ad79c..3f4f1b0997 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PatchAlreadyApplied.cs @@ -40,7 +40,7 @@ public class PatchAlreadyApplied : Warning { private readonly Host _host; - public PatchAlreadyApplied(Check check, Host host) + public PatchAlreadyApplied(Check check, Host host) : base(check) { _host = host; diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PowerOniLoProblem.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PowerOniLoProblem.cs index 940fd67290..eb07bbc511 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PowerOniLoProblem.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PowerOniLoProblem.cs @@ -50,7 +50,7 @@ protected override AsyncAction CreateAction(out bool cancelled) cancelled = false; var mode = new KeyValuePair(Server, new Host.PowerOnModeDisabled()); return new SavePowerOnSettingsAction(Server.Connection, - new List> {mode}, false); + new List> { mode }, false); } public override string Description => diff --git a/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs b/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs index 09b797e546..1b702b19d3 100644 --- a/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs +++ b/XenAdmin/Diagnostics/Problems/HostProblem/PrecheckFailed.cs @@ -40,7 +40,7 @@ public class PrecheckFailed : HostProblem private readonly Failure Failure; public PrecheckFailed(Check check, Host host, Failure failure) - : base(check, host) + : base(check, host) { Failure = failure; } diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs index bfc1ed0e70..379bf4523d 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs @@ -82,7 +82,7 @@ public override AsyncAction CreateUnwindChangesAction() var vm = vmOnHost.Key; // check if the vm is still in the cache and is halted - if (vm.Connection.Resolve(new XenRef(vm.opaque_ref)) == null || vm.power_state != vm_power_state.Halted) + if (vm.Connection.Resolve(new XenRef(vm.opaque_ref)) == null || vm.power_state != vm_power_state.Halted) continue; var startOn = vm.Connection.Resolve(vmOnHost.Value); diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs index 081039e210..51b14180a6 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/PoolHasGFS2SRProblem.cs @@ -39,7 +39,7 @@ class PoolHasGFS2SRProblem : PoolProblem { public bool clusterEnabled; public bool gfs2; - + public PoolHasGFS2SRProblem(Check check, Pool pool, bool clusteringEnabled, bool hasGfs2Sr) : base(check, pool) diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs index e362703bcd..0af4aca3fa 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs @@ -46,7 +46,7 @@ public VSwitchControllerProblem(Check check, Pool pool) _pool = pool; } - public override string LinkData => InvisibleMessages.DEPRECATION_URL; + public override string LinkData => InvisibleMessages.DEPRECATION_URL; public override string LinkText => Messages.LEARN_MORE; public override string Description => @@ -70,7 +70,7 @@ public VSwitchControllerWarning(Check check, Pool pool) public override string Title => Check.Description; - public override string LinkData => InvisibleMessages.DEPRECATION_URL; + public override string LinkData => InvisibleMessages.DEPRECATION_URL; public override string LinkText => Messages.LEARN_MORE; public override string Description => diff --git a/XenAdmin/Diagnostics/Problems/Problem.cs b/XenAdmin/Diagnostics/Problems/Problem.cs index e17e01c5ef..f3ecbf935b 100644 --- a/XenAdmin/Diagnostics/Problems/Problem.cs +++ b/XenAdmin/Diagnostics/Problems/Problem.cs @@ -144,10 +144,10 @@ public static List GetUnwindChangesActions(List problems) return new List(); var actions = from problem in problems - where problem.SolutionActionCompleted - let action = problem.CreateUnwindChangesAction() - where action != null && action.Connection != null && action.Connection.IsConnected - select action; + where problem.SolutionActionCompleted + let action = problem.CreateUnwindChangesAction() + where action != null && action.Connection != null && action.Connection.IsConnected + select action; return actions.ToList(); } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs b/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs index d9dc2a7911..c7fd0a12af 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/AutoStartEnabled.cs @@ -57,7 +57,7 @@ protected override AsyncAction CreateAction(out bool cancelled) private Action ActionDelegate(bool autostartValue) { - return delegate(Session session) + return delegate (Session session) { var vm = VM.Connection.Resolve(new XenRef(VM.opaque_ref)); var vmclone = (VM)vm.Clone(); diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/CannotMigrateVM.cs b/XenAdmin/Diagnostics/Problems/VMProblem/CannotMigrateVM.cs index 26ef9905fa..931193bf7d 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/CannotMigrateVM.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/CannotMigrateVM.cs @@ -43,14 +43,14 @@ public class CannotMigrateVM : VMProblem public enum CannotMigrateVMReason { Unknown, LicenseRestriction, CannotMigrateVm, CannotMigrateVmNoTools, CannotMigrateVmNoGpu, LacksFeatureSuspend, HasPCIAttached, OperationInProgress } public CannotMigrateVM(Check check, VM vm, CannotMigrateVMReason licenseRestriction = CannotMigrateVMReason.Unknown) - : base(check, vm) + : base(check, vm) { this.reason = licenseRestriction; } public override string Description { - get + get { string descriptionFormat; @@ -72,7 +72,7 @@ public override string Description descriptionFormat = Messages.UPDATES_WIZARD_CANNOT_MIGRATE_VM_SUSPEND_REASON; break; - case CannotMigrateVMReason.LicenseRestriction : + case CannotMigrateVMReason.LicenseRestriction: descriptionFormat = Messages.UPDATES_WIZARD_CANNOT_MIGRATE_VM_LICENSE_REASON; break; @@ -89,7 +89,7 @@ public override string Description break; } - return String.Format(descriptionFormat, ServerName, VM.Name()); + return String.Format(descriptionFormat, ServerName, VM.Name()); } } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs index 0b451c0ff5..fed60a17b0 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmProblem.cs @@ -42,7 +42,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem { - public class ExistingVmProblem: VMProblem + public class ExistingVmProblem : VMProblem { public ExistingVmProblem(Check check, VM vm) : base(check, vm) @@ -60,7 +60,7 @@ protected override AsyncAction CreateAction(out bool cancelled) DialogResult dialogResult; using (var dlg = new WarningDialog(string.Format(Messages.CONFIRM_DELETE_VM, VM.Name(), VM.Connection.Name), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo) - {WindowTitle = Messages.ACTION_SHUTDOWN_AND_DESTROY_VM_TITLE}) + { WindowTitle = Messages.ACTION_SHUTDOWN_AND_DESTROY_VM_TITLE }) { dialogResult = dlg.ShowDialog(); } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs index 04fb127ed5..32a151d74f 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ExistingVmWarning.cs @@ -52,5 +52,5 @@ public ExistingVmWarning(Check check, VM vm) public sealed override string Title => string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, Helpers.GetName(Vm).Ellipsise(30)); public override string Description => String.Format(Messages.DR_WIZARD_WARNING_EXISTING_VM, Helpers.GetPoolOfOne(Vm.Connection).Name()); - } + } } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs b/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs index 740864d6cc..6fd63e1e27 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/InvalidVCPUConfiguration.cs @@ -67,7 +67,7 @@ protected override AsyncAction CreateAction(out bool cancelled) action = ee.Action; } }; - + propertiesDialog.ShowDialog(Program.MainWindow); if (propertiesDialog.DialogResult != DialogResult.Yes || action == null) cancelled = true; diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs b/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs index b2d73b3181..ba20935cb4 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/NoPVDrivers.cs @@ -37,7 +37,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem { - public class NoPVDrivers: VMProblem + public class NoPVDrivers : VMProblem { public NoPVDrivers(Check check, VM vm) : base(check, vm) diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs index ecda7b2e14..0535806c41 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/RunningVMProblem.cs @@ -39,7 +39,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem { - public class RunningVMProblem: VMProblem + public class RunningVMProblem : VMProblem { private readonly bool hardShutdown; diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs b/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs index 96f702d930..ba5f7b2463 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/ToolsCD.cs @@ -37,8 +37,8 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem { class ToolsCD : LocalCD { - public ToolsCD(Check check, VM vm) - : base(check, vm) + public ToolsCD(Check check, VM vm) + : base(check, vm) { } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs b/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs index 0c04a7067c..c767ca5fe8 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/VMCannotSeeNetwork.cs @@ -40,8 +40,8 @@ public class VMCannotSeeNetwork : VMProblem { private readonly XenAPI.Network Network; - public VMCannotSeeNetwork(Check check, VM vm, XenAPI.Network network) - : base(check, vm) + public VMCannotSeeNetwork(Check check, VM vm, XenAPI.Network network) + : base(check, vm) { Network = network; } diff --git a/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs b/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs index ed1c99cba0..f56e60ae91 100644 --- a/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VMProblem/VMProblem.cs @@ -100,7 +100,7 @@ public override AsyncAction CreateUnwindChangesAction() Debug.Assert(VM.power_state == vm_power_state.Halted || VM.power_state == vm_power_state.Suspended, "Expected VM to be suspended or shut down!"); - if(VM.power_state==vm_power_state.Halted) + if (VM.power_state == vm_power_state.Halted) return new VMStartOnAction(VM, residentOn, VMOperationCommand.WarningDialogHAInvalidConfig, VMOperationCommand.StartDiagnosisForm); else { diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs index 67d65f8da7..167f2818fc 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/ExistingVmApplianceProblem.cs @@ -43,7 +43,7 @@ namespace XenAdmin.Diagnostics.Problems.VmApplianceProblem { - public class ExistingVmApplianceProblem: VmApplianceProblem + public class ExistingVmApplianceProblem : VmApplianceProblem { private readonly List vmsToDestroy; public ExistingVmApplianceProblem(Check check, VM_appliance vmAppliance, List vmsToDestroy) @@ -64,7 +64,7 @@ protected override AsyncAction CreateAction(out bool cancelled) DialogResult dialogResult; using (var dlg = new WarningDialog(string.Format(Messages.CONFIRM_DELETE_VMS, vmNames, vmsToDestroy[0].Connection.Name), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo) - {WindowTitle = Messages.ACTION_SHUTDOWN_AND_DESTROY_VMS_TITLE}) + { WindowTitle = Messages.ACTION_SHUTDOWN_AND_DESTROY_VMS_TITLE }) { dialogResult = dlg.ShowDialog(); } diff --git a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs index aba576bcf0..764fadc422 100644 --- a/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs +++ b/XenAdmin/Diagnostics/Problems/VmApplianceProblem/RunningVmApplianceProblem.cs @@ -76,14 +76,14 @@ protected override AsyncAction CreateAction(out bool cancelled) //shut down appliance action AsyncAction shutDownAction = hardShutdown - ? (AsyncAction) new HardShutDownApplianceAction(VmAppliance) + ? (AsyncAction)new HardShutDownApplianceAction(VmAppliance) : new ShutDownApplianceAction(VmAppliance); if (!shutdown) return shutDownAction; //shut down fate-sharing VMs - var actions = new List {shutDownAction}; + var actions = new List { shutDownAction }; foreach (var vm in fateSharingVms) { diff --git a/XenAdmin/Diagnostics/Problems/Warning.cs b/XenAdmin/Diagnostics/Problems/Warning.cs index 5dbfcfc0ce..14a2998015 100644 --- a/XenAdmin/Diagnostics/Problems/Warning.cs +++ b/XenAdmin/Diagnostics/Problems/Warning.cs @@ -57,7 +57,7 @@ public abstract class WarningWithMoreInfo : Warning protected WarningWithMoreInfo(Check check) : base(check) { } - + public override string HelpMessage => Messages.MORE_INFO; protected override Actions.AsyncAction CreateAction(out bool cancelled) @@ -86,7 +86,7 @@ protected override Actions.AsyncAction CreateAction(out bool cancelled) public virtual string LinkText => LinkData; } - + public abstract class WarningWithInformationUrl : Warning { protected WarningWithInformationUrl(Check check) : base(check) From 7950cd7a7c8ab437c0f241ef1b3161b95b64a2de Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Tue, 16 Aug 2022 13:47:07 +0100 Subject: [PATCH 12/14] CP-39929: Use pipe `|` as delimiter for RPU/Update logs Signed-off-by: Danilo Del Busso (cherry picked from commit 2438996c69af19e7a78bddc1f1148fbe5d198468) --- XenAdmin/Core/ExtensionMethods.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index c084d4fdfc..b726fcdd89 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -165,7 +165,7 @@ public static string PrependTimestamps(string value, DateTime timestamp, bool lo var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_DM_HM, localize); // normalise all line endings before splitting var lines = value.Replace(Environment.NewLine, "\n").Split('\n'); - return string.Join(Environment.NewLine, lines.Select(line => $"{timestampString}> {line}")); + return string.Join(Environment.NewLine, lines.Select(line => $"{timestampString} | {line}")); } } } From 5a5056295954e02b409587f45ee9c178ea54e7a9 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Wed, 17 Aug 2022 11:40:38 +0100 Subject: [PATCH 13/14] CP-39929: Use 24hrs format for RPU/Update logs Signed-off-by: Danilo Del Busso (cherry picked from commit 85e0ffec12478692eb0b2ffb15a7ffc43245dc0b) --- XenAdmin/Core/ExtensionMethods.cs | 2 +- XenModel/Messages.Designer.cs | 6 +++--- XenModel/Messages.resx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index b726fcdd89..3afba8056f 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -162,7 +162,7 @@ private static string PrependIndentation(string value, int indent = DEFAULT_STRI /// The input value with prepended timestamps/ public static string PrependTimestamps(string value, DateTime timestamp, bool localize = true) { - var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_DM_HM, localize); + var timestampString = HelpersGUI.DateTimeToString(timestamp, Messages.DATEFORMAT_DM_HMS, localize); // normalise all line endings before splitting var lines = value.Replace(Environment.NewLine, "\n").Split('\n'); return string.Join(Environment.NewLine, lines.Select(line => $"{timestampString} | {line}")); diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index ee05c5a56a..3f83b6fb62 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -11539,11 +11539,11 @@ public static string DATEFORMAT_DM { } /// - /// Looks up a localized string similar to MMM d, h:mm:ss. + /// Looks up a localized string similar to MMM d, hh:mm:ss. /// - public static string DATEFORMAT_DM_HM { + public static string DATEFORMAT_DM_HMS { get { - return ResourceManager.GetString("DATEFORMAT_DM_HM", resourceCulture); + return ResourceManager.GetString("DATEFORMAT_DM_HMS", resourceCulture); } } diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index c43d35ffc1..58cf08eb6e 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -4089,8 +4089,8 @@ For optimal performance and reliability during VM migration, ensure that the net MMM d - - MMM d, h:mm:ss + + MMM d, hh:mm:ss MMM d, yyyy From e30137d8eb17d55329ffbef18be374cb62910fae Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Tue, 30 Aug 2022 15:28:20 +0100 Subject: [PATCH 14/14] Revert copyright whitespace changes in `ExtensionMethods.cs` Signed-off-by: Danilo Del Busso --- XenAdmin/Core/ExtensionMethods.cs | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/XenAdmin/Core/ExtensionMethods.cs b/XenAdmin/Core/ExtensionMethods.cs index 3afba8056f..d6f2751f2c 100644 --- a/XenAdmin/Core/ExtensionMethods.cs +++ b/XenAdmin/Core/ExtensionMethods.cs @@ -1,33 +1,33 @@ /* Copyright (c) Citrix Systems, Inc. -* All rights reserved. -* -* Redistribution and use in source and binary forms, -* with or without modification, are permitted provided -* that the following conditions are met: -* -* * Redistributions of source code must retain the above -* copyright notice, this list of conditions and the -* following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the -* following disclaimer in the documentation and/or other -* materials provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -*/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ using System; using System.Drawing;