diff --git a/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js b/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js index bca1498cc..737fce9c4 100644 --- a/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js +++ b/guacamole/src/main/webapp/app/client/directives/guacClientPanel.js @@ -22,7 +22,20 @@ * panel is fixed to the bottom-right corner of its container and can be * manually hidden/exposed by the user. */ -angular.module('client').directive('guacClientPanel', [function guacClientPanel() { +angular.module('client').directive('guacClientPanel', ['$injector', function guacClientPanel($injector) { + + var sessionStorageFactory = $injector.get('sessionStorageFactory'); + + /** + * Getter/setter for the boolean flag controlling whether the client panel + * is currently hidden. This flag is maintained in session-local storage to + * allow the state of the panel to persist despite navigation within the + * same tab. When hidden, the panel will be collapsed against the right + * side of the container. By default, the panel is visible. + * + * @type Function + */ + var panelHidden = sessionStorageFactory.create(false); return { // Element only @@ -34,7 +47,7 @@ angular.module('client').directive('guacClientPanel', [function guacClientPanel( * The ManagedClient instances associated with the active * connections to be displayed within this panel. * - * @type ManagedClient[] + * @type ManagedClient[]|Object. */ clients : '=' @@ -51,19 +64,28 @@ angular.module('client').directive('guacClientPanel', [function guacClientPanel( var scrollableArea = $element.find('.client-panel-connection-list')[0]; /** - * Whether the client panel is currently hidden. When hidden, the - * panel will be collapsed against the right side of the - * containiner. - * - * @type Boolean + * On-scope reference to session-local storage of the flag + * controlling whether then panel is hidden. */ - $scope.panelHidden = false; + $scope.panelHidden = panelHidden; + + /** + * Returns whether this panel currently has any clients associated + * with it. + * + * @return {Boolean} + * true if at least one client is associated with this panel, + * false otherwise. + */ + $scope.hasClients = function hasClients() { + return !_.isEmpty($scope.clients); + }; /** * Toggles whether the client panel is currently hidden. */ $scope.togglePanel = function togglePanel() { - $scope.panelHidden = !$scope.panelHidden; + panelHidden(!panelHidden()); }; // Override vertical scrolling, scrolling horizontally instead diff --git a/guacamole/src/main/webapp/app/client/styles/other-connections.css b/guacamole/src/main/webapp/app/client/styles/other-connections.css index 26da0a783..b106ec218 100644 --- a/guacamole/src/main/webapp/app/client/styles/other-connections.css +++ b/guacamole/src/main/webapp/app/client/styles/other-connections.css @@ -26,6 +26,7 @@ #other-connections .client-panel { + display: none; position: absolute; right: 0; bottom: 0; @@ -38,6 +39,10 @@ } +#other-connections .client-panel.has-clients { + display: block; +} + #other-connections .client-panel.hidden { max-width: 16px; } diff --git a/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html b/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html index 67fcfcf01..e550c849f 100644 --- a/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html +++ b/guacamole/src/main/webapp/app/client/templates/guacClientPanel.html @@ -1,5 +1,10 @@ -
+ \ No newline at end of file