RDS collections namig fixes

This commit is contained in:
vfedosevich 2015-01-14 03:33:02 -08:00
parent c341c7f58e
commit f19ca9c8c5
8 changed files with 58 additions and 32 deletions

View file

@ -5462,6 +5462,16 @@ CREATE TABLE RDSCollections
)
GO
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RDSCollections' AND COLUMN_NAME = 'DisplayName')
BEGIN
ALTER TABLE [dbo].[RDSCollections]
ADD DisplayName NVARCHAR(255)
END
GO
UPDATE [dbo].[RDSCollections] SET DisplayName = [Name] WHERE DisplayName IS NULL
ALTER TABLE [dbo].[RDSCollectionUsers]
DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId]
GO
@ -5744,7 +5754,8 @@ SELECT
CR.ID,
CR.ItemID,
CR.Name,
CR.Description
CR.Description,
CR.DisplayName
FROM @RDSCollections AS C
INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID
WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow'
@ -5777,7 +5788,8 @@ SELECT
Id,
ItemId,
Name,
Description
Description,
DisplayName
FROM RDSCollections
WHERE ItemID = @ItemID
GO
@ -5796,9 +5808,10 @@ SELECT TOP 1
Id,
Name,
ItemId,
Description
Description,
DisplayName
FROM RDSCollections
WHERE Name = @Name
WHERE DisplayName = @Name
GO
@ -5815,7 +5828,8 @@ SELECT TOP 1
Id,
ItemId,
Name,
Description
Description,
DisplayName
FROM RDSCollections
WHERE ID = @ID
GO
@ -5829,7 +5843,8 @@ CREATE PROCEDURE [dbo].[AddRDSCollection]
@RDSCollectionID INT OUTPUT,
@ItemID INT,
@Name NVARCHAR(255),
@Description NVARCHAR(255)
@Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
)
AS
@ -5837,13 +5852,15 @@ INSERT INTO RDSCollections
(
ItemID,
Name,
Description
Description,
DisplayName
)
VALUES
(
@ItemID,
@Name,
@Description
@Description,
@DisplayName
)
SET @RDSCollectionID = SCOPE_IDENTITY()
@ -5860,7 +5877,8 @@ CREATE PROCEDURE [dbo].[UpdateRDSCollection]
@ID INT,
@ItemID INT,
@Name NVARCHAR(255),
@Description NVARCHAR(255)
@Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
)
AS
@ -5868,7 +5886,8 @@ UPDATE RDSCollections
SET
ItemID = @ItemID,
Name = @Name,
Description = @Description
Description = @Description,
DisplayName = @DisplayName
WHERE ID = @Id
GO

View file

@ -4498,7 +4498,7 @@ namespace WebsitePanel.EnterpriseServer
);
}
public static int AddRDSCollection(int itemId, string name, string description)
public static int AddRDSCollection(int itemId, string name, string description, string displayName)
{
SqlParameter rdsCollectionId = new SqlParameter("@RDSCollectionID", SqlDbType.Int);
rdsCollectionId.Direction = ParameterDirection.Output;
@ -4510,7 +4510,8 @@ namespace WebsitePanel.EnterpriseServer
rdsCollectionId,
new SqlParameter("@ItemID", itemId),
new SqlParameter("@Name", name),
new SqlParameter("@Description", description)
new SqlParameter("@Description", description),
new SqlParameter("DisplayName", displayName)
);
// read identity
@ -4533,10 +4534,10 @@ namespace WebsitePanel.EnterpriseServer
public static void UpdateRDSCollection(RdsCollection collection)
{
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description);
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description, collection.DisplayName);
}
public static void UpdateRDSCollection(int id, int itemId, string name, string description)
public static void UpdateRDSCollection(int id, int itemId, string name, string description, string displayName)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
@ -4545,7 +4546,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@Id", id),
new SqlParameter("@ItemID", itemId),
new SqlParameter("@Name", name),
new SqlParameter("@Description", description)
new SqlParameter("@Description", description),
new SqlParameter("@DisplayName", displayName)
);
}

View file

@ -271,10 +271,9 @@ namespace WebsitePanel.EnterpriseServer
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
rds.CreateCollection(org.OrganizationId, collection);
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description);
collection.Name = GetFormattedCollectionName(collection.DisplayName, org.OrganizationId);
rds.CreateCollection(org.OrganizationId, collection);
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName);
foreach (var server in collection.Servers)
{
@ -1247,5 +1246,10 @@ namespace WebsitePanel.EnterpriseServer
return rds;
}
private static string GetFormattedCollectionName(string displayName, string organizationId)
{
return string.Format("{0}-{1}", organizationId, displayName.Replace(" ", "_"));
}
}
}

View file

@ -15,7 +15,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public int ItemId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string DisplayName { get; set; }
public List<RdsServer> Servers { get; set; }
}
}

View file

@ -1123,7 +1123,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private string GetPolicyName(string organizationId, string collectionName, RdsPolicyTypes policyType)
{
string policyName = string.Format("{0}-{1}-", organizationId, collectionName);
string policyName = string.Format("{0}-", collectionName);
switch (policyType)
{

View file

@ -45,10 +45,10 @@
OnRowCommand="gvRDSCollections_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsRDSCollectionsPaged" PageSize="20">
<Columns>
<asp:TemplateField HeaderText="gvCollectionName" SortExpression="Name">
<asp:TemplateField HeaderText="gvCollectionName" SortExpression="DisplayName">
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkCollectionName" meta:resourcekey="lnkApps" runat="server" NavigateUrl='<%# GetCollectionEditUrl(Eval("Id").ToString()) %>'><%# Eval("Name").ToString() %></asp:hyperlink>
<asp:hyperlink id="lnkCollectionName" meta:resourcekey="lnkApps" runat="server" NavigateUrl='<%# GetCollectionEditUrl(Eval("Id").ToString()) %>'><%# Eval("DisplayName").ToString() %></asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvServer">

View file

@ -62,7 +62,7 @@ namespace WebsitePanel.Portal.RDS
return;
}
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, DisplayName = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId));
}

View file

@ -472,13 +472,7 @@ namespace WebsitePanel.Portal.UserControls
private void PrepareEnterpriseStorageMenu(MenuItemCollection enterpriseStorageItems)
{
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png"));
//if (ShortMenu) return;
if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png"));
}
private void PrepareRDSMenuRoot(MenuItemCollection items)
@ -507,7 +501,14 @@ namespace WebsitePanel.Portal.UserControls
rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null));
if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User))
rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
{
rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
}
if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
{
rdsItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
}
}
private MenuItem CreateMenuItem(string text, string key)