From 53f61909819532521b6a7260ebdaf23924059c8c Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Tue, 7 Apr 2015 12:06:32 +0300 Subject: [PATCH] wsp-10327 Add Dynamic Memory to VPS - Portal Part. Step 2. --- .../VirtualMachineSettingExtensions.cs | 34 ++ .../IVirtualMachineSettingsControl.cs | 14 +- .../VdcCreateServer.ascx.resx | 3 + ...cx.resx => DynamicMemoryControl.ascx.resx} | 46 ++- .../VPS2012/UserControls/DynamicMemory.ascx | 17 - .../UserControls/DynamicMemory.ascx.cs | 50 --- .../DynamicMemory.ascx.designer.cs | 42 -- .../UserControls/DynamicMemoryControl.ascx | 126 ++++++ .../UserControls/DynamicMemoryControl.ascx.cs | 88 +++++ .../DynamicMemoryControl.ascx.designer.cs | 366 ++++++++++++++++++ .../VPS2012/UserControls/Generation.ascx | 44 ++- .../VPS2012/UserControls/Generation.ascx.cs | 14 +- .../UserControls/Generation.ascx.designer.cs | 27 ++ .../WebsitePanel/VPS2012/VdcCreateServer.ascx | 76 ++-- .../VPS2012/VdcCreateServer.ascx.cs | 46 ++- .../VPS2012/VdcCreateServer.ascx.designer.cs | 72 ++-- .../VPS2012/VpsDetailsConfiguration.ascx | 5 + .../VPS2012/VpsDetailsConfiguration.ascx.cs | 3 + .../VpsDetailsConfiguration.ascx.designer.cs | 18 + .../VPS2012/VpsDetailsEditConfiguration.ascx | 16 +- .../VpsDetailsEditConfiguration.ascx.cs | 30 +- ...sDetailsEditConfiguration.ascx.designer.cs | 4 +- .../VPS2012/VpsDetailsGeneral.ascx.cs | 11 +- .../WebsitePanel.Portal.Modules.csproj | 13 +- 24 files changed, 901 insertions(+), 264 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/{DynamicMemory.ascx.resx => DynamicMemoryControl.ascx.resx} (74%) delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs new file mode 100644 index 00000000..ec313c46 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Web.UI; +using WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.Code.Helpers +{ + + public static class VirtualMachineSettingExtensions + { + public static void BindSettingsControls(this Control page, VirtualMachine vm) + { + page.GetSettingsControls().ForEach(s => s.BindItem(vm)); + } + + public static void SaveSettingsControls(this Control page, ref VirtualMachine vm) + { + foreach (var s in page.GetSettingsControls()) s.SaveItem(ref vm); + } + + public static List GetSettingsControls(this Control parent) + { + var result = new List(); + foreach (Control control in parent.Controls) + { + if (control is IVirtualMachineSettingsControl) + result.Add((IVirtualMachineSettingsControl)control); + + if (control.HasControls()) + result.AddRange(control.GetSettingsControls()); + } + return result; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs index 5e19f7cb..c35799ea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs @@ -26,14 +26,24 @@ // (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.Collections.Generic; +using System.Web.UI; using WebsitePanel.Providers.Virtualization; namespace WebsitePanel.Portal { + public enum VirtualMachineSettingsMode + { + Display, + Edit, + Summary, + } + public interface IVirtualMachineSettingsControl { - bool IsEditMode { get; set; } + VirtualMachineSettingsMode Mode { get; set; } void BindItem(VirtualMachine item); - void SaveItem(VirtualMachine item); + void SaveItem(ref VirtualMachine item); } + } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx index dab48649..b095172a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx @@ -372,4 +372,7 @@ Generation: + + Dynamic Memory + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx similarity index 74% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx index de7f7771..2e9c22f9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx @@ -117,10 +117,52 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Dymanic memory: + + Minimum RAM: + + + Minimum memory must be a whole number + + + Enter the minimum memory + + + Dymanic memory enabled Dymanic memory + + Dymanic memory enabled: + + + Dynamic memory enabled + + + Buffer must be a whole number between 0 and 100 + + + Enter the buffer + + + Buffer (%): + + + Maximum RAM: + + + Weight (Priority): + + + Maximum memory must be a whole number + + + Enter the maximum memory + + + Weight (priority) must be a whole number between 0 and 100 + + + Enter the weight (priority) + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx deleted file mode 100644 index acf4d304..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx +++ /dev/null @@ -1,17 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMemory.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.DynamicMemory" %> -<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> - - - - - - - - - -
- - -
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs deleted file mode 100644 index 0ab36ea9..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2015, Outercurve Foundation. -// 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. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// 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 WebsitePanel.Providers.Virtualization; - -namespace WebsitePanel.Portal.VPS2012.UserControls -{ - public partial class DynamicMemory : WebsitePanelControlBase, IVirtualMachineSettingsControl - { - protected void Page_Load(object sender, EventArgs e) - { - } - - public bool IsEditMode { get; set; } - - public void BindItem(VirtualMachine item) - { - } - - public void SaveItem(VirtualMachine item) - { - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs deleted file mode 100644 index 5124bc48..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WebsitePanel.Portal.VPS2012.UserControls { - - - public partial class DynamicMemory { - - /// - /// secDymanicMemory control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secDymanicMemory; - - /// - /// DymanicMemoryPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel DymanicMemoryPanel; - - /// - /// locDymanicMemory control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locDymanicMemory; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx new file mode 100644 index 00000000..a8c9888a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx @@ -0,0 +1,126 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMemoryControl.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl" %> +<%@ Import Namespace="WebsitePanel.Portal" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> +<%@ Register TagPrefix="wsp" TagName="CheckBoxOption" Src="../../UserControls/CheckBoxOption.ascx" %> + +<% if (Mode != VirtualMachineSettingsMode.Summary){ %> + + + + + <% if (Mode == VirtualMachineSettingsMode.Edit) { %> + + + + <% } else { %> + + + + + + + + + + + + + + + + + + + + <% } %> +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + * + * +
+ + + + + * + * +
+ + + + + * + * +
+ + + + + * + * +
+
+ +
+
+<% } else { %> + + + + + + + + + + + + + + + + + + + + +<% } %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs new file mode 100644 index 00000000..e2344882 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs @@ -0,0 +1,88 @@ +// Copyright (c) 2015, Outercurve Foundation. +// 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. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// 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 WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.VPS2012.UserControls +{ + public partial class DynamicMemoryControl : WebsitePanelControlBase, IVirtualMachineSettingsControl + { + protected void Page_Load(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + tableDynamicMemory.Visible = chkDynamicMemoryEnabled.Checked; + } + + public VirtualMachineSettingsMode Mode { get; set; } + + public void BindItem(VirtualMachine item) + { + if (item.DynamicMemory == null) + item.DynamicMemory = new DynamicMemory(); + + // set values + chkDynamicMemoryEnabled.Checked = optionDymanicMemoryDisplay.Value = optionDymanicMemorySummary.Value = item.DynamicMemory.Enabled; + txtMinimum.Text = litMinimumDisplay.Text = litMinimumSummary.Text = item.DynamicMemory.Minimum.ToString(); + txtMaximum.Text = litMaximumDisplay.Text = litMaximumSummary.Text = item.DynamicMemory.Maximum.ToString(); + txtBuffer.Text = litBufferDisplay.Text = litBufferSummary.Text = item.DynamicMemory.Buffer.ToString(); + txtPriority.Text = litPriorityDisplay.Text = litPrioritySummary.Text = item.DynamicMemory.Priority.ToString(); + + // set visibilities + trMinimumDisplay.Visible = trMaximumDisplay.Visible = trBufferDisplay.Visible = trPriorityDisplay.Visible = item.DynamicMemory.Enabled; + trMinimumSummary.Visible = trMaximumSummary.Visible = trBufferSummary.Visible = trPrioritySummary.Visible = item.DynamicMemory.Enabled; + } + + public void SaveItem(ref VirtualMachine item) + { + if (Mode != VirtualMachineSettingsMode.Edit) + return; + + item.DynamicMemory = new DynamicMemory + { + Enabled = chkDynamicMemoryEnabled.Checked, + Minimum = ParseInt(txtMinimum.Text), + Maximum = ParseInt(txtMaximum.Text), + Buffer = ParseInt(txtBuffer.Text), + Priority = ParseInt(txtPriority.Text), + }; + } + + private int ParseInt(string text) + { + if (string.IsNullOrEmpty(text)) + return 0; + + return Int32.Parse(txtMinimum.Text); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs new file mode 100644 index 00000000..328179bb --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs @@ -0,0 +1,366 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.VPS2012.UserControls { + + + public partial class DynamicMemoryControl { + + /// + /// secDymanicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDymanicMemory; + + /// + /// DymanicMemoryPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel DymanicMemoryPanel; + + /// + /// chkDynamicMemoryEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkDynamicMemoryEnabled; + + /// + /// tableDynamicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tableDynamicMemory; + + /// + /// locMinimum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimum; + + /// + /// txtMinimum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMinimum; + + /// + /// locMaximum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximum; + + /// + /// txtMaximum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaximum; + + /// + /// locBuffer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBuffer; + + /// + /// txtBuffer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtBuffer; + + /// + /// locPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPriority; + + /// + /// txtPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPriority; + + /// + /// optionDymanicMemoryDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemoryDisplay; + + /// + /// trMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumDisplay; + + /// + /// locMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimumDisplay; + + /// + /// litMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMinimumDisplay; + + /// + /// trMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumDisplay; + + /// + /// locMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximumDisplay; + + /// + /// litMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMaximumDisplay; + + /// + /// trBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferDisplay; + + /// + /// locBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBufferDisplay; + + /// + /// litBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litBufferDisplay; + + /// + /// trPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trPriorityDisplay; + + /// + /// locPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPriorityDisplay; + + /// + /// litPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litPriorityDisplay; + + /// + /// locDymanicMemorySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDymanicMemorySummary; + + /// + /// optionDymanicMemorySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemorySummary; + + /// + /// trMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumSummary; + + /// + /// locMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimumSummary; + + /// + /// litMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMinimumSummary; + + /// + /// trMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumSummary; + + /// + /// locMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximumSummary; + + /// + /// litMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMaximumSummary; + + /// + /// trBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferSummary; + + /// + /// locBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBufferSummary; + + /// + /// litBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litBufferSummary; + + /// + /// trPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trPrioritySummary; + + /// + /// locPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrioritySummary; + + /// + /// litPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litPrioritySummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx index 423a7077..ad9dc272 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx @@ -1,24 +1,36 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Generation.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.Generation" %> +<%@ Import Namespace="WebsitePanel.Portal" %> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> - - - - - - + + <% } %> +
- - - <% if (IsEditMode) - { %> +<% if (Mode != VirtualMachineSettingsMode.Summary){ %> + + + + <% if (Mode == VirtualMachineSettingsMode.Edit) { %> + + + + + <% } else { %> + + - -
+ + 1 2 - <% } else { %> +
+ - <% } %> -
-
+
+
+<% } else { %> + + + + +<% } %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs index 12299712..e092af49 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs @@ -37,18 +37,20 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { } - public bool IsEditMode { get; set; } + public VirtualMachineSettingsMode Mode { get; set; } public void BindItem(VirtualMachine item) { - var generation = item.Generation > 1 ? item.Generation : 1; - ddlGeneration.SelectedValue = generation.ToString(); - lblGeneration.Text = generation.ToString(); + var generation = item.Generation > 1 ? item.Generation.ToString () : "1"; + + ddlGeneration.SelectedValue = generation; + lblGeneration.Text = litGeneration.Text = GetLocalizedString("ddlGenerationItem." + generation); } - public void SaveItem(VirtualMachine item) + public void SaveItem(ref VirtualMachine item) { - item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); + if (Mode == VirtualMachineSettingsMode.Edit) + item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs index 7ae3a102..690bec4e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs @@ -48,6 +48,15 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { /// protected global::System.Web.UI.WebControls.DropDownList ddlGeneration; + /// + /// locGenerationDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGenerationDisplay; + /// /// lblGeneration control. /// @@ -56,5 +65,23 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblGeneration; + + /// + /// locGeneration2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneration2; + + /// + /// litGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litGeneration; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx index 6a22866b..9719b3a9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx @@ -7,7 +7,7 @@ <%@ Register Src="../UserControls/CheckBoxOption.ascx" TagName="CheckBoxOption" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register TagPrefix="wsp" TagName="Generation" Src="UserControls/Generation.ascx" %> -<%@ Register TagPrefix="wsp" TagName="DynamicMemory" Src="UserControls/DynamicMemory.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -33,7 +33,7 @@ + ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" /> - - - - - @@ -84,10 +84,10 @@ * + ValidationGroup="Vps">* + ControlToValidate="txtHostname" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps"> . @@ -95,10 +95,10 @@ * + ValidationGroup="Vps">* + ControlToValidate="txtDomain" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps"> @@ -112,7 +112,7 @@ * + ValidationGroup="Vps">*   @@ -120,7 +120,7 @@ - + @@ -135,7 +135,7 @@ * + ValidationGroup="Vps">* @@ -148,14 +148,16 @@ meta:resourcekey="locConfigStepTitle" Text="Configuration" />


+ + - + - +
@@ -165,35 +167,33 @@
- +
* + ValidationGroup="Vps">*
- +
* + ValidationGroup="Vps">*
- - - + @@ -208,7 +208,7 @@ * + ValidationGroup="Vps">* @@ -313,7 +313,7 @@ * + ValidationGroup="Vps">* @@ -368,7 +368,7 @@ * + ValidationGroup="Vps">* @@ -447,6 +447,9 @@ meta:resourcekey="locConfigStepTitle" Text="Configuration" /> + + + @@ -455,10 +458,6 @@ - - - - @@ -505,6 +504,17 @@ + +   + + + + + + + +   diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs index 8a0f8508..0427461b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs @@ -28,11 +28,13 @@ using System; using System.Collections.Generic; -using System.Web; + using System.Linq; + using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; -using WebsitePanel.Providers.Virtualization; + using WebsitePanel.Portal.Code.Helpers; + using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.ResultObjects; @@ -71,8 +73,18 @@ namespace WebsitePanel.Portal.VPS2012 } } + private void BindFormControls() { + var virtualMachine = new VirtualMachine + { + DynamicMemory = new DynamicMemory + { + Buffer = 20, + Priority = 50 + } + }; + // bind password policy password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.VPS_POLICY, "AdministratorPasswordPolicy"); @@ -112,11 +124,7 @@ namespace WebsitePanel.Portal.VPS2012 ddlCpu.Items.Add(i.ToString()); ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item - - // the user controls - GenerationSetting.BindItem(new VirtualMachine()); - DynamicMemorySetting.BindItem(new VirtualMachine()); - + // external network details if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_EXTERNAL_NETWORK_ENABLED)) { @@ -174,6 +182,12 @@ namespace WebsitePanel.Portal.VPS2012 { int availSize = ramQuota.QuotaAllocatedValue - ramQuota.QuotaUsedValue; txtRam.Text = availSize < 0 ? "" : availSize.ToString(); + + if (availSize > 0) + { + virtualMachine.DynamicMemory.Minimum = availSize/2; + virtualMachine.DynamicMemory.Maximum = availSize; + } } } @@ -210,6 +224,9 @@ namespace WebsitePanel.Portal.VPS2012 BindCheckboxOption(chkReset, Quotas.VPS2012_RESET_ALOWED); BindCheckboxOption(chkReboot, Quotas.VPS2012_REBOOT_ALLOWED); BindCheckboxOption(chkReinstall, Quotas.VPS2012_REINSTALL_ALLOWED); + + // the settings user controls + this.BindSettingsControls(virtualMachine); } private void BindCheckboxOption(CheckBox chk, string quotaName) @@ -241,11 +258,11 @@ namespace WebsitePanel.Portal.VPS2012 private void BindSummary() { - //VirtualMachine virtualMachine = new VirtualMachine(); + var resultVm = new VirtualMachine(); - //// the user controls - //GenerationSetting.SaveItem(virtualMachine); - //DynamicMemorySetting.BindItem(virtualMachine); + // the user controls + this.SaveSettingsControls(ref resultVm); + this.BindSettingsControls(resultVm); // general litHostname.Text = PortalAntiXSS.Encode(String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim())); @@ -257,7 +274,6 @@ namespace WebsitePanel.Portal.VPS2012 // config litCpu.Text = PortalAntiXSS.Encode(ddlCpu.SelectedValue); litRam.Text = PortalAntiXSS.Encode(txtRam.Text.Trim()); - //litGeneration.Text = CreareSettingsProviderControl != null ? PortalAntiXSS.Encode(virtualMachine.Generation.ToString()) : "1"; litHdd.Text = PortalAntiXSS.Encode(txtHdd.Text.Trim()); litSnapshots.Text = PortalAntiXSS.Encode(txtSnapshots.Text.Trim()); optionDvdInstalled.Value = chkDvdInstalled.Checked; @@ -289,6 +305,7 @@ namespace WebsitePanel.Portal.VPS2012 string[] privIps = Utils.ParseDelimitedString(txtPrivateAddressesList.Text, '\n', '\r', ' ', '\t'); litPrivateAddressesList.Text = PortalAntiXSS.Encode(String.Join(", ", privIps)); + } protected void wizard_FinishButtonClick(object sender, WizardNavigationEventArgs e) @@ -301,8 +318,7 @@ namespace WebsitePanel.Portal.VPS2012 VirtualMachine virtualMachine = new VirtualMachine(); // the user controls - GenerationSetting.BindItem(virtualMachine); - DynamicMemorySetting.BindItem(virtualMachine); + this.SaveSettingsControls(ref virtualMachine); // collect and prepare data string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim()); @@ -354,7 +370,7 @@ namespace WebsitePanel.Portal.VPS2012 if (wizard.ActiveStepIndex == 0) ViewState["Password"] = password.Password; - Page.Validate("VpsWizard"); + Page.Validate("Vps"); if (!Page.IsValid) e.Cancel = true; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs index 51cbe0be..e7a1f597 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs @@ -255,6 +255,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locConfigStepTitle; + /// + /// GenerationSetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; + /// /// secResources control. /// @@ -372,24 +381,6 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locGB; - /// - /// GenerationSetting control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; - - /// - /// DynamicMemorySetting control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemory DynamicMemorySetting; - /// /// secSnapshots control. /// @@ -966,6 +957,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locConfig2; + /// + /// GenerationSettingsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSettingsSummary; + /// /// locCpu control. /// @@ -1002,24 +1002,6 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Literal litRam; - /// - /// locGeneration control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locGeneration; - - /// - /// litGeneration control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litGeneration; - /// /// locHdd control. /// @@ -1200,6 +1182,24 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionReinstall; + /// + /// locDynamicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDynamicMemory; + + /// + /// DynamicMemoryControlSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemoryControlSummary; + /// /// locExternalNetwork2 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx index 2dbb9845..39f25576 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx @@ -8,6 +8,8 @@ <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="../UserControls/PasswordControl.ascx" TagName="PasswordControl" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="Generation" Src="UserControls/Generation.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -57,6 +59,7 @@
+ @@ -91,6 +94,8 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs index 18ec2f17..6acbe292 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs @@ -34,6 +34,7 @@ using System.Web.UI.WebControls; using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Common; using WebsitePanel.EnterpriseServer; +using WebsitePanel.Portal.Code.Helpers; namespace WebsitePanel.Portal.VPS2012 { @@ -93,6 +94,8 @@ namespace WebsitePanel.Portal.VPS2012 // toggle buttons bool manageAllowed = VirtualMachines2012Helper.IsVirtualMachineManagementAllowed(PanelSecurity.PackageId); btnEdit.Visible = manageAllowed; + + this.BindSettingsControls(vm); } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs index ba604a17..0e1944fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs @@ -129,6 +129,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.LinkButton btnChangePasswordPopup; + /// + /// GenerationSetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; + /// /// secResources control. /// @@ -201,6 +210,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Literal litHdd; + /// + /// DynamicMemorySetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; + /// /// secSnapshots control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx index 6db26b25..1d0a2e75 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx @@ -6,6 +6,7 @@ <%@ Register Src="UserControls/FormTitle.ascx" TagName="FormTitle" TagPrefix="wsp" %> <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -35,8 +36,8 @@

- + ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" /> + @@ -60,7 +61,7 @@ * + ValidationGroup="Vps">* @@ -73,15 +74,14 @@ * + ValidationGroup="Vps">* - <%-- Additional Custom Settings. Provider Control --%> - + @@ -96,7 +96,7 @@ * + ValidationGroup="Vps">* @@ -186,7 +186,7 @@

- /// editSettingsProviderControl control. + /// DynamicMemorySetting control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.PlaceHolder editSettingsProviderControl; + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; ///

/// secSnapshots control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs index 48c6fa40..5f768272 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs @@ -109,11 +109,16 @@ namespace WebsitePanel.Portal.VPS2012 // RAM if (vm.RamSize > 0) { - int ramPercent = Convert.ToInt32((float)vm.RamUsage / (float)vm.RamSize * 100); - ramGauge.Total = vm.RamSize; + var totalRam = vm.RamSize; + + if (vm.DynamicMemory != null && vm.DynamicMemory.Enabled) + totalRam = vm.DynamicMemory.Maximum; + + int ramPercent = Convert.ToInt32((float)vm.RamUsage / (float)totalRam * 100); + ramGauge.Total = totalRam; ramGauge.Progress = vm.RamUsage; litRamPercentage.Text = String.Format(GetLocalizedString("MemoryPercentage.Text"), ramPercent); - litRamUsage.Text = String.Format(GetLocalizedString("MemoryUsage.Text"), vm.RamUsage, vm.RamSize); + litRamUsage.Text = String.Format(GetLocalizedString("MemoryUsage.Text"), vm.RamUsage, totalRam); } // HDD diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 423c3b49..333314fe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -172,6 +172,7 @@ + @@ -287,12 +288,12 @@ Breadcrumb.ascx - - DynamicMemory.ascx + + DynamicMemoryControl.ascx ASPXCodeBehind - - DynamicMemory.ascx + + DynamicMemoryControl.ascx FormTitle.ascx @@ -4774,7 +4775,7 @@ - + @@ -5140,7 +5141,7 @@ Designer - + Designer