From d063e2ce2dfa56569e83f983bbeaa13e77046268 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 30 Jan 2015 06:43:13 -0800 Subject: [PATCH] UI changes --- .../RemoteDesktopServices/RdsUserSession.cs | 1 + .../RemoteDesktopServices/StartMenuApp.cs | 1 + .../Windows2012.cs | 4 +- .../RDSUserSessions.ascx.resx | 3 + .../WebsitePanel/RDS/RDSUserSessions.ascx | 97 ++++++++++--------- .../WebsitePanel/RDS/RDSUserSessions.ascx.cs | 30 +++++- .../RDS/RDSUserSessions.ascx.designer.cs | 18 ++++ .../RDSCollectionApps.ascx.resx | 3 - .../RDS/UserControls/RDSCollectionApps.ascx | 4 +- .../UserControls/RDSCollectionApps.ascx.cs | 64 ++++++------ .../RDSCollectionApps.ascx.designer.cs | 9 -- .../RDS/UserControls/RDSCollectionUsers.ascx | 6 +- 12 files changed, 139 insertions(+), 101 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs index 8b03a51b..8c3e9729 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs @@ -12,5 +12,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string UnifiedSessionId { get; set; } public string SessionState { get; set; } public string HostServer { get; set; } + public string DomainName { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs index b6195e49..afdee244 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs @@ -33,5 +33,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string DisplayName { get; set; } public string FilePath { get; set; } public string FileVirtualPath { get; set; } + public string RequiredCommandLine { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index a7380569..15cadff0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -1738,9 +1738,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Command cmd = new Command("Get-RDUserSession"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); - var userSessions = ExecuteShellCommand(runSpace, cmd, false, out errors); - - //var userSessions = ExecuteShellCommand(runSpace, scripts, out errors); + var userSessions = ExecuteShellCommand(runSpace, cmd, false, out errors); var properties = typeof(RdsUserSession).GetProperties(); foreach(var userSession in userSessions) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx index 53c766e3..e8f7f85d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx @@ -147,4 +147,7 @@ Log Off + + Refresh + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx index cb81c5b5..33aab7ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx @@ -22,51 +22,58 @@
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- -
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs index 24873e88..79e37ea8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs @@ -1,4 +1,5 @@ -using System; +using AjaxControlToolkit; +using System; using System.Collections.Generic; using System.Linq; using System.Web; @@ -17,7 +18,7 @@ namespace WebsitePanel.Portal.RDS if (!IsPostBack) { var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); - litCollectionName.Text = collection.Name; + litCollectionName.Text = collection.DisplayName; BindGrid(); } } @@ -34,7 +35,7 @@ namespace WebsitePanel.Portal.RDS { ES.Services.RDS.LogOffRdsUser(PanelRequest.ItemID, unifiedSessionId, hostServer); BindGrid(); - + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); } catch (Exception ex) { @@ -49,6 +50,8 @@ namespace WebsitePanel.Portal.RDS { return; } + + BindGrid(); } protected void btnSaveExit_Click(object sender, EventArgs e) @@ -61,6 +64,17 @@ namespace WebsitePanel.Portal.RDS Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId)); } + protected void btnRefresh_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + BindGrid(); + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + } + private void BindGrid() { var userSessions = new List(); @@ -74,6 +88,16 @@ namespace WebsitePanel.Portal.RDS ShowErrorMessage("REMOTE_DESKTOP_SERVICES_USER_SESSIONS", ex); } + foreach(var userSession in userSessions) + { + var states = userSession.SessionState.Split('_'); + + if (states.Length == 2) + { + userSession.SessionState = states[1]; + } + } + gvRDSUserSessions.DataSource = userSessions; gvRDSUserSessions.DataBind(); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs index 9f276bcc..e9944d67 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs @@ -66,6 +66,24 @@ namespace WebsitePanel.Portal.RDS { /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + /// + /// RDAppsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel RDAppsUpdatePanel; + + /// + /// btnRefresh control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRefresh; + /// /// secRdsUserSessions control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx index 85e03fdd..0adb8a73 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx @@ -138,9 +138,6 @@ Delete - - Add Full Desktop Connection - Remote Application Name diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx index 386d3a51..088d5153 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -5,8 +5,7 @@
- - +
+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs index 59402625..403eea17 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs @@ -104,39 +104,45 @@ namespace WebsitePanel.Portal.RDS.UserControls List selectedApps = GetPopUpGridViewApps(); BindApps(selectedApps.ToArray(), true); - } - - protected void btnFullDesktopConnection_Click(object sender, EventArgs e) - { - var newApps = new RemoteApplication[] - { - new RemoteApplication - { - DisplayName = "Session Host", - FilePath = "%SystemRoot%\\system32\\mstsc.exe", - Alias = "mstsc", - RequiredCommandLine = "/v:", - ShowInWebAccess = true - } - }; - - BindApps(newApps, true); - } + } protected void BindPopupApps() { RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); - StartMenuApp[] apps = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name); + List apps = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name).ToList(); + + var fullRemote = new StartMenuApp + { + DisplayName = "Session Host", + FilePath = "%SystemRoot%\\system32\\mstsc.exe", + RequiredCommandLine = string.Format("/v:{0}", collection.Servers.First().FqdName) + }; + + var displayNames = GetApps().Select(p => p.DisplayName); + apps = apps.Where(x => !displayNames.Contains(x.DisplayName)).ToList(); - apps = apps.Where(x => !GetApps().Select(p => p.DisplayName).Contains(x.DisplayName)).ToArray(); - Array.Sort(apps, CompareAccount); if (Direction == SortDirection.Ascending) { - Array.Reverse(apps); + apps = apps.OrderBy(a => a.DisplayName).ToList(); Direction = SortDirection.Descending; } else + { + apps = apps.OrderByDescending(a => a.DisplayName).ToList(); Direction = SortDirection.Ascending; + } + + if (!displayNames.Contains(fullRemote.DisplayName)) + { + if (apps.Count > 0) + { + apps.Insert(0, fullRemote); + } + else + { + apps.Add(fullRemote); + } + } gvPopupApps.DataSource = apps; gvPopupApps.DataBind(); @@ -170,16 +176,7 @@ namespace WebsitePanel.Portal.RDS.UserControls apps.Add(newApp); } - } - - if (apps.Any(a => a.DisplayName.Equals("session host", StringComparison.CurrentCultureIgnoreCase))) - { - btnFullDesktopConnection.Enabled = false; - } - else - { - btnFullDesktopConnection.Enabled = true; - } + } gvApps.DataSource = apps; gvApps.DataBind(); @@ -226,7 +223,8 @@ namespace WebsitePanel.Portal.RDS.UserControls { Alias = (string)gvPopupApps.DataKeys[i][0], DisplayName = ((Literal)row.FindControl("litName")).Text, - FilePath = ((HiddenField)row.FindControl("hfFilePathPopup")).Value + FilePath = ((HiddenField)row.FindControl("hfFilePathPopup")).Value, + RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLinePopup")).Value }); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs index 7e892653..6c195540 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.designer.cs @@ -39,15 +39,6 @@ namespace WebsitePanel.Portal.RDS.UserControls { /// protected global::System.Web.UI.WebControls.Button btnDelete; - /// - /// btnFullDesktopConnection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnFullDesktopConnection; - /// /// gvApps control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx index b2dc9efc..8f2bbf36 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx @@ -21,7 +21,7 @@ - + @@ -75,14 +75,14 @@ - + - +