From 62e58eaf9f700f56ee348da518cb78580b876ed6 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 21 Jul 2018 13:23:46 -0700 Subject: [PATCH] GUACAMOLE-220: Migrate connection permission editor to tab-based views. --- .../directives/connectionPermissionEditor.js | 41 ++++++++++++++++--- .../templates/connectionPermissionEditor.html | 6 +-- .../src/main/webapp/translations/en.json | 8 ++-- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/guacamole/src/main/webapp/app/manage/directives/connectionPermissionEditor.js b/guacamole/src/main/webapp/app/manage/directives/connectionPermissionEditor.js index 632de4906..43fa6c5b0 100644 --- a/guacamole/src/main/webapp/app/manage/directives/connectionPermissionEditor.js +++ b/guacamole/src/main/webapp/app/manage/directives/connectionPermissionEditor.js @@ -110,11 +110,40 @@ angular.module('manage').directive('connectionPermissionEditor', ['$injector', var readableRootGroups = null; /** - * Whether the items displayed within the connection permission editor - * should be limited to those which had explicit READ permission at the - * time the editor was loaded. + * The name of the tab within the connection permission editor which + * displays readable connections only. + * + * @constant + * @type String */ - $scope.displayReadableOnly = false; + var SELECTED_CONNECTIONS = 'SELECTED_CONNECTIONS'; + + /** + * The name of the tab within the connection permission editor which + * displays all connections, regardless of whether they are readable. + * + * @constant + * @type String + */ + var ALL_CONNECTIONS = 'ALL_CONNECTIONS'; + + /** + * The names of all tabs which should be available within the + * connection permission editor, in display order. + * + * @type String[] + */ + $scope.tabs = [ + SELECTED_CONNECTIONS, + ALL_CONNECTIONS + ]; + + /** + * The name of the currently selected tab. + * + * @type String + */ + $scope.currentTab = ALL_CONNECTIONS; /** * Array of all connection properties that are filterable. @@ -145,7 +174,7 @@ angular.module('manage').directive('connectionPermissionEditor', ['$injector', * root connection groups within those data sources. */ $scope.getRootGroups = function getRootGroups() { - return $scope.displayReadableOnly ? readableRootGroups : allRootGroups; + return $scope.currentTab === SELECTED_CONNECTIONS ? readableRootGroups : allRootGroups; }; /** @@ -312,7 +341,7 @@ angular.module('manage').directive('connectionPermissionEditor', ['$injector', // Display only readable connections by default if at least one // readable connection exists - $scope.displayReadableOnly = !!readableRootGroups[$scope.dataSource].children.length; + $scope.currentTab = !!readableRootGroups[$scope.dataSource].children.length ? SELECTED_CONNECTIONS : ALL_CONNECTIONS; }); diff --git a/guacamole/src/main/webapp/app/manage/templates/connectionPermissionEditor.html b/guacamole/src/main/webapp/app/manage/templates/connectionPermissionEditor.html index 0e3a373a9..f010fb9ca 100644 --- a/guacamole/src/main/webapp/app/manage/templates/connectionPermissionEditor.html +++ b/guacamole/src/main/webapp/app/manage/templates/connectionPermissionEditor.html @@ -1,15 +1,13 @@
-
+

{{'MANAGE_USER.SECTION_HEADER_CONNECTIONS' | translate}}

-
- -
+