RDS quotas

This commit is contained in:
vfedosevich 2015-01-16 02:47:54 -08:00
parent 69e4f8db27
commit b1af779c18
14 changed files with 310 additions and 49 deletions

View file

@ -222,4 +222,16 @@
<data name="locServiceLevels.Text" xml:space="preserve">
<value>Service Levels</value>
</data>
<data name="locRemoteDesktop.Text" xml:space="preserve">
<value>Remote Desktop</value>
</data>
<data name="lnkRdsServers.Text" xml:space="preserve">
<value>RDS Servers</value>
</data>
<data name="lnkRdsCollections.Text" xml:space="preserve">
<value>RDS Collections</value>
</data>
<data name="lnkRdsUsers.Text" xml:space="preserve">
<value>RDS Users</value>
</data>
</root>

View file

@ -341,6 +341,38 @@
</td>
</tr>
</asp:Panel>
<asp:Panel runat="server" ID="remoteDesktopStatsPanel">
<tr>
<td class="OrgStatsGroup" width="100%" colspan="2">
<asp:Localize ID="locRemoteDesktop" runat="server" meta:resourcekey="locRemoteDesktop" ></asp:Localize>
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsServers" runat="server" meta:resourcekey="lnkRdsServers" />
</td>
<td>
<wsp:QuotaViewer ID="rdsServers" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsCollections" runat="server" meta:resourcekey="lnkRdsCollections" />
</td>
<td>
<wsp:QuotaViewer ID="rdsCollections" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
<tr class="OrgStatsRow">
<td class="OrgStatsQuota" nowrap>
<asp:HyperLink ID="lnkRdsUsers" runat="server" meta:resourcekey="lnkRdsUsers" />
</td>
<td>
<wsp:QuotaViewer ID="rdsUsers" QuotaTypeId="2" runat="server" DisplayGauge="true" />
</td>
</tr>
</asp:Panel>
</table>
</div>

View file

@ -305,6 +305,16 @@ namespace WebsitePanel.Portal.ExchangeServer
}
else
serviceLevelsStatsPanel.Visible = false;
if (cntx.Groups.ContainsKey(ResourceGroups.RDS))
{
remoteDesktopStatsPanel.Visible = true;
BindRemoteDesktopStats(orgStats, tenantStats);
}
else
{
remoteDesktopStatsPanel.Visible = false;
}
}
private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
@ -447,5 +457,34 @@ namespace WebsitePanel.Portal.ExchangeServer
}
}
private void BindRemoteDesktopStats(OrganizationStatistics stats, OrganizationStatistics tenantStats)
{
rdsServers.QuotaValue = stats.AllocatedRdsServers;
rdsServers.QuotaUsedValue = stats.CreatedRdsServers;
if (stats.AllocatedRdsServers != -1)
{
rdsServers.QuotaAvailable = tenantStats.AllocatedRdsServers - tenantStats.CreatedRdsServers;
}
rdsCollections.QuotaValue = stats.AllocatedRdsCollections;
rdsCollections.QuotaUsedValue = stats.CreatedRdsCollections;
if (stats.AllocatedRdsCollections != -1)
{
rdsCollections.QuotaAvailable = tenantStats.AllocatedRdsCollections - tenantStats.CreatedRdsCollections;
}
rdsUsers.QuotaValue = stats.AllocatedRdsUsers;
rdsUsers.QuotaUsedValue = stats.CreatedRdsUsers;
if (stats.AllocatedRdsCollections != -1)
{
rdsUsers.QuotaAvailable = tenantStats.AllocatedRdsUsers - tenantStats.CreatedRdsUsers;
}
lnkRdsServers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
lnkRdsCollections.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
lnkRdsUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId);
}
}
}

View file

@ -1,31 +1,3 @@
// 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -822,5 +794,77 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locServiceLevels;
/// <summary>
/// remoteDesktopStatsPanel 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 remoteDesktopStatsPanel;
/// <summary>
/// locRemoteDesktop 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 locRemoteDesktop;
/// <summary>
/// lnkRdsServers 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.HyperLink lnkRdsServers;
/// <summary>
/// rdsServers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsServers;
/// <summary>
/// lnkRdsCollections 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.HyperLink lnkRdsCollections;
/// <summary>
/// rdsCollections control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsCollections;
/// <summary>
/// lnkRdsUsers 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.HyperLink lnkRdsUsers;
/// <summary>
/// rdsUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsUsers;
}
}

View file

@ -45,6 +45,12 @@ namespace WebsitePanel.Portal.RDS
if (!IsPostBack)
{
}
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.RDS_COLLECTIONS))
{
btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1));
}
}
public string GetServerName(string collectionId)