wsp-10327 Add Dynamic Memory to VPS - Portal Part. Step 2.

This commit is contained in:
Alexander Trofimov 2015-04-07 12:06:32 +03:00
parent 03a675cf03
commit 53f6190981
24 changed files with 901 additions and 264 deletions

View file

@ -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<IVirtualMachineSettingsControl> GetSettingsControls(this Control parent)
{
var result = new List<IVirtualMachineSettingsControl>();
foreach (Control control in parent.Controls)
{
if (control is IVirtualMachineSettingsControl)
result.Add((IVirtualMachineSettingsControl)control);
if (control.HasControls())
result.AddRange(control.GetSettingsControls());
}
return result;
}
}
}

View file

@ -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);
}
}

View file

@ -372,4 +372,7 @@
<data name="locGeneration.Text" xml:space="preserve">
<value>Generation:</value>
</data>
<data name="locDynamicMemory.Text" xml:space="preserve">
<value>Dynamic Memory</value>
</data>
</root>

View file

@ -117,10 +117,52 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="locDymanicMemory.Text" xml:space="preserve">
<value>Dymanic memory:</value>
<data name="locMinimum.Text" xml:space="preserve">
<value>Minimum RAM:</value>
</data>
<data name="MinimumCompareValidator.ErrorMessage" xml:space="preserve">
<value>Minimum memory must be a whole number</value>
</data>
<data name="MinimumRequireValidator.ErrorMessage" xml:space="preserve">
<value>Enter the minimum memory</value>
</data>
<data name="optionDymanicMemory.Text" xml:space="preserve">
<value>Dymanic memory enabled</value>
</data>
<data name="secDymanicMemory.Text" xml:space="preserve">
<value>Dymanic memory</value>
</data>
<data name="locDymanicMemorySummary.Text" xml:space="preserve">
<value>Dymanic memory enabled:</value>
</data>
<data name="chkDynamicMemoryEnabled" xml:space="preserve">
<value>Dynamic memory enabled</value>
</data>
<data name="BufferRangeValidator.ErrorMessage" xml:space="preserve">
<value>Buffer must be a whole number between 0 and 100</value>
</data>
<data name="BufferRequireValidator.ErrorMessage" xml:space="preserve">
<value>Enter the buffer</value>
</data>
<data name="locBuffer.Text" xml:space="preserve">
<value>Buffer (%):</value>
</data>
<data name="locMaximum.Text" xml:space="preserve">
<value>Maximum RAM:</value>
</data>
<data name="locPriority.Text" xml:space="preserve">
<value>Weight (Priority):</value>
</data>
<data name="MaximumCompareValidator.ErrorMessage" xml:space="preserve">
<value>Maximum memory must be a whole number</value>
</data>
<data name="MaximumRequireValidator.ErrorMessage" xml:space="preserve">
<value>Enter the maximum memory</value>
</data>
<data name="PriorityRangeValidator.ErrorMessage" xml:space="preserve">
<value>Weight (priority) must be a whole number between 0 and 100</value>
</data>
<data name="PriorityRequireValidator.ErrorMessage" xml:space="preserve">
<value>Enter the weight (priority)</value>
</data>
</root>

View file

@ -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" %>
<wsp:CollapsiblePanel id="secDymanicMemory" runat="server" TargetControlID="DymanicMemoryPanel" meta:resourcekey="secDymanicMemory" Text="Dymanic memory">
</wsp:CollapsiblePanel>
<asp:Panel ID="DymanicMemoryPanel" runat="server" Height="0" Style="overflow: hidden; padding: 5px;">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize ID="locDymanicMemory" runat="server"
meta:resourcekey="locDymanicMemory" Text="Dymanic Memory:"></asp:Localize></td>
<td>
</td>
</tr>
</table>
</asp:Panel>

View file

@ -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)
{
}
}
}

View file

@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.VPS2012.UserControls {
public partial class DynamicMemory {
/// <summary>
/// secDymanicMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secDymanicMemory;
/// <summary>
/// DymanicMemoryPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel DymanicMemoryPanel;
/// <summary>
/// locDymanicMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locDymanicMemory;
}
}

View file

@ -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){ %>
<wsp:CollapsiblePanel id="secDymanicMemory" runat="server" TargetControlID="DymanicMemoryPanel" meta:resourcekey="secDymanicMemory" Text="Dymanic memory">
</wsp:CollapsiblePanel>
<asp:Panel ID="DymanicMemoryPanel" runat="server" Height="0" Style="overflow: hidden; padding: 5px;">
<table>
<% if (Mode == VirtualMachineSettingsMode.Edit) { %>
<tr>
<td colspan="2">
<asp:CheckBox ID="chkDynamicMemoryEnabled" runat="server" AutoPostBack="true" meta:resourcekey="chkDynamicMemoryEnabled" Text="Dynamic memory enabled" />
<table id="tableDynamicMemory" runat="server" cellspacing="5" style="width: 100%; margin-top: 15px">
<tr>
<td class="FormLabel150" >
<asp:Localize ID="locMinimum" runat="server" meta:resourcekey="locMinimum" Text="Minimum RAM:"></asp:Localize>
</td>
<td>
<asp:TextBox ID="txtMinimum" runat="server" CssClass="NormalTextBox" Width="50" Text=""></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtMinimum" Display="Dynamic"
meta:resourcekey="MinimumRequireValidator" runat="server" SetFocusOnError="true"
Text="*" ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:CompareValidator ControlToValidate="txtMinimum" ErrorMessage="Value must be a whole number"
meta:resourcekey="MinimumCompareValidator" Operator="DataTypeCheck" runat="server" SetFocusOnError="True"
Text="*" Type="Integer" ValidationGroup="Vps">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="FormLabel150" >
<asp:Localize ID="locMaximum" runat="server" meta:resourcekey="locMaximum" Text="Maximum RAM:"></asp:Localize>
</td>
<td>
<asp:TextBox ID="txtMaximum" runat="server" CssClass="NormalTextBox" Width="50" Text=""></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtMaximum" Display="Dynamic"
meta:resourcekey="MaximumRequireValidator" runat="server" SetFocusOnError="true"
Text="*" ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:CompareValidator ControlToValidate="txtMaximum" ErrorMessage="Value must be a whole number"
meta:resourcekey="MaximumCompareValidator" Operator="DataTypeCheck" runat="server" SetFocusOnError="True"
Text="*" Type="Integer" ValidationGroup="Vps">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="FormLabel150" >
<asp:Localize ID="locBuffer" runat="server" meta:resourcekey="locBuffer" Text="Buffer (%):"></asp:Localize>
</td>
<td>
<asp:TextBox ID="txtBuffer" runat="server" CssClass="NormalTextBox" Width="50" Text=""></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtBuffer" Display="Dynamic"
meta:resourcekey="BufferRequireValidator" runat="server" SetFocusOnError="true"
Text="*" ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:RangeValidator runat="server" Type="Integer" MinimumValue="0" MaximumValue="100" ControlToValidate="txtBuffer"
meta:resourcekey="BufferRangeValidator" ErrorMessage="Value must be a whole number between 0 and 100"
Text="*" ValidationGroup="Vps">*</asp:RangeValidator>
</td>
</tr>
<tr>
<td class="FormLabel150" >
<asp:Localize ID="locPriority" runat="server" meta:resourcekey="locPriority" Text="Weight (Priority):"></asp:Localize>
</td>
<td>
<asp:TextBox ID="txtPriority" runat="server" CssClass="NormalTextBox" Width="50" Text=""></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtPriority" Display="Dynamic"
meta:resourcekey="PriorityRequireValidator" runat="server" SetFocusOnError="true"
Text="*" ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:RangeValidator runat="server" Type="Integer" MinimumValue="0" MaximumValue="100" ControlToValidate="txtPriority"
meta:resourcekey="PriorityRangeValidator" ErrorMessage="Value must be a whole number between 0 and 100"
Text="*" ValidationGroup="Vps">*</asp:RangeValidator>
</td>
</tr>
</table>
</td>
</tr>
<% } else { %>
<tr>
<td colspan="2">
<wsp:CheckBoxOption ID="optionDymanicMemoryDisplay" runat="server" Text="Dymanic memory enabled" meta:resourcekey="optionDymanicMemory" />
</td>
</tr>
<tr runat="server" id="trMinimumDisplay">
<td><asp:Localize ID="locMinimumDisplay" runat="server" meta:resourcekey="locMinimum" Text="Minimum:" /></td>
<td><asp:Literal ID="litMinimumDisplay" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trMaximumDisplay">
<td><asp:Localize ID="locMaximumDisplay" runat="server" meta:resourcekey="locMaximum" Text="Maximum:" /></td>
<td><asp:Literal ID="litMaximumDisplay" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trBufferDisplay">
<td><asp:Localize ID="locBufferDisplay" runat="server" meta:resourcekey="locBuffer" Text="Buffer (%):" /></td>
<td><asp:Literal ID="litBufferDisplay" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trPriorityDisplay">
<td><asp:Localize ID="locPriorityDisplay" runat="server" meta:resourcekey="locPriority" Text="Weight (Priority):" /></td>
<td><asp:Literal ID="litPriorityDisplay" runat="server"></asp:Literal></td>
</tr>
<% } %>
</table>
</asp:Panel>
<% } else { %>
<tr>
<td><asp:Localize ID="locDymanicMemorySummary" runat="server" meta:resourcekey="locDymanicMemorySummary" Text="Dymanic memory enabled:" /></td>
<td><wsp:CheckBoxOption id="optionDymanicMemorySummary" runat="server" /></td>
</tr>
<tr runat="server" id="trMinimumSummary">
<td><asp:Localize ID="locMinimumSummary" runat="server" meta:resourcekey="locMinimum" Text="Minimum:" /></td>
<td><asp:Literal ID="litMinimumSummary" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trMaximumSummary">
<td><asp:Localize ID="locMaximumSummary" runat="server" meta:resourcekey="locMaximum" Text="Maximum:" /></td>
<td><asp:Literal ID="litMaximumSummary" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trBufferSummary">
<td><asp:Localize ID="locBufferSummary" runat="server" meta:resourcekey="locBuffer" Text="Buffer (%):" /></td>
<td><asp:Literal ID="litBufferSummary" runat="server"></asp:Literal></td>
</tr>
<tr runat="server" id="trPrioritySummary">
<td><asp:Localize ID="locPrioritySummary" runat="server" meta:resourcekey="locPriority" Text="Weight (Priority):" /></td>
<td><asp:Literal ID="litPrioritySummary" runat="server"></asp:Literal></td>
</tr>
<% } %>

View file

@ -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);
}
}
}

View file

@ -0,0 +1,366 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.VPS2012.UserControls {
public partial class DynamicMemoryControl {
/// <summary>
/// secDymanicMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secDymanicMemory;
/// <summary>
/// DymanicMemoryPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel DymanicMemoryPanel;
/// <summary>
/// chkDynamicMemoryEnabled control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkDynamicMemoryEnabled;
/// <summary>
/// tableDynamicMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTable tableDynamicMemory;
/// <summary>
/// locMinimum control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMinimum;
/// <summary>
/// txtMinimum control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtMinimum;
/// <summary>
/// locMaximum control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMaximum;
/// <summary>
/// txtMaximum control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtMaximum;
/// <summary>
/// locBuffer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locBuffer;
/// <summary>
/// txtBuffer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtBuffer;
/// <summary>
/// locPriority control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locPriority;
/// <summary>
/// txtPriority control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPriority;
/// <summary>
/// optionDymanicMemoryDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemoryDisplay;
/// <summary>
/// trMinimumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumDisplay;
/// <summary>
/// locMinimumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMinimumDisplay;
/// <summary>
/// litMinimumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMinimumDisplay;
/// <summary>
/// trMaximumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumDisplay;
/// <summary>
/// locMaximumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMaximumDisplay;
/// <summary>
/// litMaximumDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMaximumDisplay;
/// <summary>
/// trBufferDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferDisplay;
/// <summary>
/// locBufferDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locBufferDisplay;
/// <summary>
/// litBufferDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litBufferDisplay;
/// <summary>
/// trPriorityDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trPriorityDisplay;
/// <summary>
/// locPriorityDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locPriorityDisplay;
/// <summary>
/// litPriorityDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litPriorityDisplay;
/// <summary>
/// locDymanicMemorySummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locDymanicMemorySummary;
/// <summary>
/// optionDymanicMemorySummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemorySummary;
/// <summary>
/// trMinimumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumSummary;
/// <summary>
/// locMinimumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMinimumSummary;
/// <summary>
/// litMinimumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMinimumSummary;
/// <summary>
/// trMaximumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumSummary;
/// <summary>
/// locMaximumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locMaximumSummary;
/// <summary>
/// litMaximumSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMaximumSummary;
/// <summary>
/// trBufferSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferSummary;
/// <summary>
/// locBufferSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locBufferSummary;
/// <summary>
/// litBufferSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litBufferSummary;
/// <summary>
/// trPrioritySummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow trPrioritySummary;
/// <summary>
/// locPrioritySummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locPrioritySummary;
/// <summary>
/// litPrioritySummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litPrioritySummary;
}
}

View file

@ -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" %>
<wsp:CollapsiblePanel ID="secGeneration" runat="server" TargetControlID="GenerationPanel" meta:ResourceKey="secGeneration" Text="Generation"></wsp:CollapsiblePanel>
<asp:Panel ID="GenerationPanel" runat="server" Height="0" Style="overflow: hidden; padding: 5px;">
<table>
<tr>
<td class="FormLabel150">
<asp:Localize ID="locGeneration" runat="server" meta:resourcekey="locGeneration" Text="Generation:"></asp:Localize>
</td>
<td>
<% if (IsEditMode)
{ %>
<% if (Mode != VirtualMachineSettingsMode.Summary){ %>
<wsp:CollapsiblePanel ID="secGeneration" runat="server" TargetControlID="GenerationPanel" meta:ResourceKey="secGeneration" Text="Generation"></wsp:CollapsiblePanel>
<asp:Panel ID="GenerationPanel" runat="server" Height="0" Style="overflow: hidden; padding: 5px;">
<table>
<% if (Mode == VirtualMachineSettingsMode.Edit) { %>
<tr>
<td class="FormLabel150">
<asp:Localize ID="locGeneration" runat="server" meta:resourcekey="locGeneration" Text="Generation:"></asp:Localize>
</td>
<td>
<asp:DropDownList ID="ddlGeneration" runat="server" CssClass="NormalTextBox" resourcekey="ddlGeneration">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:DropDownList>
<% } else { %>
</td>
</tr>
<% } else { %>
<tr>
<td>
<asp:Localize ID="locGenerationDisplay" runat="server" meta:resourcekey="locGeneration" Text="Generation:"></asp:Localize>
<asp:Label runat="server" ID="lblGeneration"/>
<% } %>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<% } %>
</table>
</asp:Panel>
<% } else { %>
<tr>
<td><asp:Localize ID="locGeneration2" runat="server" meta:resourcekey="locGeneration" Text="Generation:" /></td>
<td><asp:Literal ID="litGeneration" runat="server"></asp:Literal></td>
</tr>
<% } %>

View file

@ -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);
}
}
}

View file

@ -48,6 +48,15 @@ namespace WebsitePanel.Portal.VPS2012.UserControls {
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlGeneration;
/// <summary>
/// locGenerationDisplay control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locGenerationDisplay;
/// <summary>
/// lblGeneration control.
/// </summary>
@ -56,5 +65,23 @@ namespace WebsitePanel.Portal.VPS2012.UserControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblGeneration;
/// <summary>
/// locGeneration2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locGeneration2;
/// <summary>
/// litGeneration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litGeneration;
}
}

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -33,7 +33,7 @@
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<asp:ValidationSummary ID="validatorsSummary" runat="server"
ValidationGroup="VpsWizard" ShowMessageBox="True" ShowSummary="False" />
ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" />
<asp:Wizard ID="wizard" runat="server"
meta:resourcekey="wizard" CellSpacing="5"
@ -46,24 +46,24 @@
<StepStyle VerticalAlign="Top" />
<StartNavigationTemplate>
<asp:Button ID="btnNext" runat="server" CommandName="MoveNext" ValidationGroup="VpsWizard"
<asp:Button ID="btnNext" runat="server" CommandName="MoveNext" ValidationGroup="Vps"
CssClass="Button1" Text="Next" meta:resourcekey="btnNext" />
</StartNavigationTemplate>
<StepNavigationTemplate>
<asp:Button ID="btnPrevious" runat="server" CommandName="MovePrevious" ValidationGroup="VpsWizard"
<asp:Button ID="btnPrevious" runat="server" CommandName="MovePrevious" ValidationGroup="Vps"
CssClass="Button1" Text="Previous" meta:resourcekey="btnPrevious" />
<asp:Button ID="btnNext" runat="server" CommandName="MoveNext" ValidationGroup="VpsWizard"
<asp:Button ID="btnNext" runat="server" CommandName="MoveNext" ValidationGroup="Vps"
CssClass="Button1" Text="Next" meta:resourcekey="btnNext" />
</StepNavigationTemplate>
<FinishNavigationTemplate>
<asp:Button ID="btnPrevious" runat="server" CommandName="MovePrevious" ValidationGroup="VpsWizard"
<asp:Button ID="btnPrevious" runat="server" CommandName="MovePrevious" ValidationGroup="Vps"
CssClass="Button1" Text="Previous" meta:resourcekey="btnPrevious" />
<asp:Button ID="btnFinish" runat="server" CommandName="MoveComplete" ValidationGroup="VpsWizard"
<asp:Button ID="btnFinish" runat="server" CommandName="MoveComplete" ValidationGroup="Vps"
CssClass="Button1" Text="Finish" meta:resourcekey="btnFinish" />
</FinishNavigationTemplate>
@ -84,10 +84,10 @@
<asp:RequiredFieldValidator ID="HostnameValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtHostname" meta:resourcekey="HostnameValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="valCorrectHostname" runat="server" Text="*" meta:resourcekey="valCorrectHostname"
ValidationExpression="^[a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$"
ControlToValidate="txtHostname" Display="Dynamic" SetFocusOnError="true" ValidationGroup="VpsWizard">
ControlToValidate="txtHostname" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps">
</asp:RegularExpressionValidator>
<span class="Medium">.</span>
@ -95,10 +95,10 @@
<asp:RequiredFieldValidator ID="DomainValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtDomain" meta:resourcekey="DomainValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="valNewDomainFormat" runat="server" Text="*" meta:resourcekey="valNewDomainFormat"
ValidationExpression="^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.){1,10}[a-zA-Z]{2,6}$"
ControlToValidate="txtDomain" Display="Dynamic" SetFocusOnError="true" ValidationGroup="VpsWizard">
ControlToValidate="txtDomain" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps">
</asp:RegularExpressionValidator>
</td>
</tr>
@ -112,7 +112,7 @@
</asp:DropDownList>
<asp:RequiredFieldValidator ID="OperatingSystemValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="listOperatingSystems" meta:resourcekey="OperatingSystemValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
@ -120,7 +120,7 @@
<td class="FormLabel150" valign="top"><asp:Localize ID="locAdminPassword" runat="server"
meta:resourcekey="locAdminPassword" Text="Administrator password:"></asp:Localize></td>
<td>
<wsp:PasswordControl id="password" runat="server" ValidationGroup="VpsWizard" AllowGeneratePassword="true">
<wsp:PasswordControl id="password" runat="server" ValidationGroup="Vps" AllowGeneratePassword="true">
</wsp:PasswordControl>
</td>
@ -135,7 +135,7 @@
<asp:TextBox ID="txtSummaryEmail" runat="server" CssClass="NormalTextBox" AutoPostBack="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="SummaryEmailValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtSummaryEmail" meta:resourcekey="SummaryEmailValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
@ -148,14 +148,16 @@
meta:resourcekey="locConfigStepTitle" Text="Configuration" /></p>
<br />
<wsp:Generation runat="server" ID="GenerationSetting" Mode="Edit"/>
<wsp:CollapsiblePanel id="secResources" runat="server"
TargetControlID="ResourcesPanel" meta:resourcekey="secResources" Text="Resources">
</wsp:CollapsiblePanel>
<asp:Panel ID="ResourcesPanel" runat="server" Height="0" style="overflow:hidden;padding:10px;width:400px;">
<asp:Panel ID="ResourcesPanel" runat="server" Height="0" style="overflow: hidden; padding: 5px;">
<table cellpadding="3">
<tr>
<td style="width:60px;"><asp:Label ID="lblCpu" runat="server" AssociatedControlID="ddlCpu"
meta:resourcekey="lblCpu" Text="CPU:" CssClass="MediumBold" /></td>
<td class="FormLabel150"><asp:Label ID="lblCpu" runat="server"
meta:resourcekey="lblCpu" Text="CPU:" /></td>
<td>
<asp:DropDownList ID="ddlCpu" runat="server" CssClass="HugeTextBox" Width="70">
</asp:DropDownList>
@ -165,35 +167,33 @@
</table>
<table cellpadding="3">
<tr>
<td style="width:60px;"><asp:Label ID="lblRam" runat="server" AssociatedControlID="txtRam"
meta:resourcekey="lblRam" Text="RAM:" CssClass="MediumBold" /></td>
<td class="FormLabel150"><asp:Label ID="lblRam" runat="server"
meta:resourcekey="lblRam" Text="RAM:"/></td>
<td>
<asp:TextBox ID="txtRam" runat="server" CssClass="HugeTextBox" Width="70" Text="0"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequireRamValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtRam" meta:resourcekey="RequireRamValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
<td><asp:Localize ID="locMB" runat="server" meta:resourcekey="locMB" Text="MB"/></td>
</tr>
</table>
<table cellpadding="3">
<tr>
<td style="width:60px;"><asp:Label ID="lblHdd" runat="server" AssociatedControlID="txtHdd"
meta:resourcekey="lblHdd" Text="HDD:" CssClass="MediumBold" /></td>
<td class="FormLabel150"><asp:Label ID="lblHdd" runat="server"
meta:resourcekey="lblHdd" Text="HDD:" /></td>
<td>
<asp:TextBox ID="txtHdd" runat="server" CssClass="HugeTextBox" Width="70" Text="0"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequireHddValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtHdd" meta:resourcekey="RequireHddValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
<td><asp:Localize ID="locGB" runat="server" meta:resourcekey="locGB" Text="GB"/></td>
</tr>
</table>
</asp:Panel>
<wsp:Generation runat="server" ID="GenerationSetting" IsEditMode="True"></wsp:Generation>
<wsp:DynamicMemory runat="server" ID="DynamicMemorySetting" IsEditMode="True"></wsp:DynamicMemory>
<wsp:DynamicMemoryControl ruVpsnat="server" ID="DynamicMemorySetting" Mode="Edit"/>
<wsp:CollapsiblePanel id="secSnapshots" runat="server"
TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots">
@ -208,7 +208,7 @@
<asp:RequiredFieldValidator ID="SnapshotsValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtSnapshots" meta:resourcekey="SnapshotsValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
@ -313,7 +313,7 @@
<asp:RequiredFieldValidator ID="ExternalAddressesValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtExternalAddressesNumber" meta:resourcekey="ExternalAddressesValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:Literal ID="litMaxExternalAddresses" runat="server"></asp:Literal>
</td>
@ -368,7 +368,7 @@
<asp:RequiredFieldValidator ID="PrivateAddressesValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtPrivateAddressesNumber" meta:resourcekey="PrivateAddressesValidator" SetFocusOnError="true"
ValidationGroup="VpsWizard">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
<asp:Literal ID="litMaxPrivateAddresses" runat="server"></asp:Literal>
</td>
@ -447,6 +447,9 @@
meta:resourcekey="locConfigStepTitle" Text="Configuration" />
</td>
</tr>
<wsp:Generation runat="server" ID="GenerationSettingsSummary" Mode="Summary"/>
<tr>
<td><asp:Localize ID="locCpu" runat="server" meta:resourcekey="locCpu" Text="CPU cores:" /></td>
<td><asp:Literal ID="litCpu" runat="server"></asp:Literal></td>
@ -455,10 +458,6 @@
<td><asp:Localize ID="locRam" runat="server" meta:resourcekey="locRam" Text="RAM, MB:" /></td>
<td><asp:Literal ID="litRam" runat="server"></asp:Literal></td>
</tr>
<tr>
<td><asp:Localize ID="locGeneration" runat="server" meta:resourcekey="locGeneration" Text="Generation:" /></td>
<td><asp:Literal ID="litGeneration" runat="server"></asp:Literal></td>
</tr>
<tr>
<td><asp:Localize ID="locHdd" runat="server" meta:resourcekey="locHdd" Text="Hard disk size, GB:" /></td>
<td><asp:Literal ID="litHdd" runat="server"></asp:Literal></td>
@ -505,6 +504,17 @@
<td><wsp:CheckBoxOption id="optionReinstall" runat="server" Value="True" /></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="NormalBold">
<asp:Localize ID="locDynamicMemory" runat="server"
meta:resourcekey="locDynamicMemory" Text="Dynamic Memory" />
</td>
</tr>
<wsp:DynamicMemoryControl runat="server" ID="DynamicMemoryControlSummary" Mode="Summary"/>
<tr>
<td>&nbsp;</td>
</tr>

View file

@ -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;

View file

@ -255,6 +255,15 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locConfigStepTitle;
/// <summary>
/// GenerationSetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting;
/// <summary>
/// secResources control.
/// </summary>
@ -372,24 +381,6 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locGB;
/// <summary>
/// GenerationSetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting;
/// <summary>
/// DynamicMemorySetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemory DynamicMemorySetting;
/// <summary>
/// secSnapshots control.
/// </summary>
@ -966,6 +957,15 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locConfig2;
/// <summary>
/// GenerationSettingsSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSettingsSummary;
/// <summary>
/// locCpu control.
/// </summary>
@ -1002,24 +1002,6 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litRam;
/// <summary>
/// locGeneration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locGeneration;
/// <summary>
/// litGeneration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litGeneration;
/// <summary>
/// locHdd control.
/// </summary>
@ -1200,6 +1182,24 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionReinstall;
/// <summary>
/// locDynamicMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locDynamicMemory;
/// <summary>
/// DynamicMemoryControlSummary control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemoryControlSummary;
/// <summary>
/// locExternalNetwork2 control.
/// </summary>

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -57,6 +59,7 @@
</table>
</asp:Panel>
<wsp:Generation runat="server" ID="GenerationSetting" Mode="Display"/>
<wsp:CollapsiblePanel id="secResources" runat="server"
TargetControlID="ResourcesPanel" meta:resourcekey="secResources" Text="Resources">
@ -91,6 +94,8 @@
</table>
</asp:Panel>
<wsp:DynamicMemoryControl runat="server" ID="DynamicMemorySetting" Mode="Display"/>
<wsp:CollapsiblePanel id="secSnapshots" runat="server"
TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots">
</wsp:CollapsiblePanel>

View file

@ -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)
{

View file

@ -129,6 +129,15 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton btnChangePasswordPopup;
/// <summary>
/// GenerationSetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting;
/// <summary>
/// secResources control.
/// </summary>
@ -201,6 +210,15 @@ namespace WebsitePanel.Portal.VPS2012 {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litHdd;
/// <summary>
/// DynamicMemorySetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting;
/// <summary>
/// secSnapshots control.
/// </summary>

View file

@ -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" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
@ -35,8 +36,8 @@
</p>
<asp:ValidationSummary ID="validatorsSummary" runat="server"
ValidationGroup="VpsEdit" ShowMessageBox="True" ShowSummary="False" />
ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" />
<wsp:CollapsiblePanel id="secResources" runat="server"
TargetControlID="ResourcesPanel" meta:resourcekey="secResources" Text="Resources">
</wsp:CollapsiblePanel>
@ -60,7 +61,7 @@
<asp:TextBox ID="txtRam" runat="server" CssClass="HugeTextBox" Width="70"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequireRamValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtRam" meta:resourcekey="RequireRamValidator" SetFocusOnError="true"
ValidationGroup="VpsEdit">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
<td><asp:Localize ID="locMB" runat="server" meta:resourcekey="locMB" Text="MB"/></td>
</tr>
@ -73,15 +74,14 @@
<asp:TextBox ID="txtHdd" runat="server" CssClass="HugeTextBox" Width="70"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequireHddValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtHdd" meta:resourcekey="RequireHddValidator" SetFocusOnError="true"
ValidationGroup="VpsEdit">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
<td><asp:Localize ID="locGB" runat="server" meta:resourcekey="locGB" Text="GB"/></td>
</tr>
</table>
</asp:Panel>
<%-- Additional Custom Settings. Provider Control --%>
<asp:PlaceHolder ID="editSettingsProviderControl" runat="server"></asp:PlaceHolder>
<wsp:DynamicMemoryControl runat="server" ID="DynamicMemorySetting" Mode="Edit"/>
<wsp:CollapsiblePanel id="secSnapshots" runat="server"
TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots">
@ -96,7 +96,7 @@
<asp:RequiredFieldValidator ID="SnapshotsValidator" runat="server" Text="*" Display="Dynamic"
ControlToValidate="txtSnapshots" meta:resourcekey="SnapshotsValidator" SetFocusOnError="true"
ValidationGroup="VpsEdit">*</asp:RequiredFieldValidator>
ValidationGroup="Vps">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
@ -186,7 +186,7 @@
<p>
<asp:Button ID="btnUpdate" runat="server" meta:resourcekey="btnUpdate"
ValidationGroup="VpsEdit" Text="Update" CssClass="Button1"
ValidationGroup="Vps" Text="Update" CssClass="Button1"
onclick="btnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" meta:resourcekey="btnCancel"
CausesValidation="false" Text="Cancel" CssClass="Button1"

View file

@ -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
{
@ -41,34 +42,12 @@ namespace WebsitePanel.Portal.VPS2012
{
protected void Page_Load(object sender, EventArgs e)
{
LoadCustomProviderControls();
if (!IsPostBack)
{
BindConfiguration();
}
}
private void LoadCustomProviderControls()
{
try
{
LoadProviderControl(PanelSecurity.PackageId, "VPS2012", editSettingsProviderControl, "Edit.ascx");
}
catch { /* skip */ }
}
private IVirtualMachineSettingsControl EditSettingsProviderControl
{
get
{
if (editSettingsProviderControl.Controls.Count == 0)
return null;
return (IVirtualMachineSettingsControl)editSettingsProviderControl.Controls[0];
}
}
private void BindConfiguration()
{
VirtualMachine vm = null;
@ -118,9 +97,6 @@ namespace WebsitePanel.Portal.VPS2012
chkExternalNetworkEnabled.Checked = vm.ExternalNetworkEnabled;
chkPrivateNetworkEnabled.Checked = vm.PrivateNetworkEnabled;
// the custom provider control
if (EditSettingsProviderControl != null) EditSettingsProviderControl.BindItem(vm);
// other quotas
BindCheckboxOption(chkDvdInstalled, Quotas.VPS2012_DVD_ENABLED);
chkBootFromCd.Enabled = PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_BOOT_CD_ALLOWED);
@ -133,6 +109,8 @@ namespace WebsitePanel.Portal.VPS2012
BindCheckboxOption(chkExternalNetworkEnabled, Quotas.VPS2012_EXTERNAL_NETWORK_ENABLED);
BindCheckboxOption(chkPrivateNetworkEnabled, Quotas.VPS2012_PRIVATE_NETWORK_ENABLED);
this.BindSettingsControls(vm);
}
catch (Exception ex)
{
@ -171,7 +149,7 @@ namespace WebsitePanel.Portal.VPS2012
VirtualMachine virtualMachine = new VirtualMachine();
// the custom provider control
if (EditSettingsProviderControl != null) EditSettingsProviderControl.SaveItem(virtualMachine);
this.SaveSettingsControls(ref virtualMachine);
ResultObject res = ES.Services.VPS2012.UpdateVirtualMachineConfiguration(PanelRequest.ItemID,
Utils.ParseInt(ddlCpu.SelectedValue),

View file

@ -211,13 +211,13 @@ namespace WebsitePanel.Portal.VPS2012 {
protected global::System.Web.UI.WebControls.Localize locGB;
/// <summary>
/// editSettingsProviderControl control.
/// DynamicMemorySetting control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder editSettingsProviderControl;
protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting;
/// <summary>
/// secSnapshots control.

View file

@ -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

View file

@ -172,6 +172,7 @@
<Compile Include="Code\Helpers\RDSHelper.cs" />
<Compile Include="Code\Helpers\EnterpriseStorageHelper.cs" />
<Compile Include="Code\Helpers\LyncHelper.cs" />
<Compile Include="Code\Helpers\VirtualMachineSettingExtensions.cs" />
<Compile Include="Code\Helpers\VirtualMachinesForPCHelper.cs" />
<Compile Include="Code\Helpers\CRMHelper.cs" />
<Compile Include="Code\Helpers\ExchangeHelper.cs" />
@ -287,12 +288,12 @@
<Compile Include="VPS2012\UserControls\Breadcrumb.ascx.designer.cs">
<DependentUpon>Breadcrumb.ascx</DependentUpon>
</Compile>
<Compile Include="VPS2012\UserControls\DynamicMemory.ascx.cs">
<DependentUpon>DynamicMemory.ascx</DependentUpon>
<Compile Include="VPS2012\UserControls\DynamicMemoryControl.ascx.cs">
<DependentUpon>DynamicMemoryControl.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="VPS2012\UserControls\DynamicMemory.ascx.designer.cs">
<DependentUpon>DynamicMemory.ascx</DependentUpon>
<Compile Include="VPS2012\UserControls\DynamicMemoryControl.ascx.designer.cs">
<DependentUpon>DynamicMemoryControl.ascx</DependentUpon>
</Compile>
<Compile Include="VPS2012\UserControls\FormTitle.ascx.cs">
<DependentUpon>FormTitle.ascx</DependentUpon>
@ -4774,7 +4775,7 @@
<Content Include="VPS2012\RemoteDesktop\msrdp.cab" />
<Content Include="VPS2012\TestVirtualMachineTemplate.aspx" />
<Content Include="VPS2012\UserControls\Breadcrumb.ascx" />
<Content Include="VPS2012\UserControls\DynamicMemory.ascx" />
<Content Include="VPS2012\UserControls\DynamicMemoryControl.ascx" />
<Content Include="VPS2012\UserControls\FormTitle.ascx" />
<Content Include="VPS2012\UserControls\Generation.ascx" />
<Content Include="VPS2012\UserControls\Menu.ascx" />
@ -5140,7 +5141,7 @@
<Content Include="VPS2012\UserControls\App_LocalResources\Breadcrumb.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="VPS2012\UserControls\App_LocalResources\DynamicMemory.ascx.resx">
<Content Include="VPS2012\UserControls\App_LocalResources\DynamicMemoryControl.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="VPS2012\UserControls\App_LocalResources\Generation.ascx.resx">