From d58149ed05ba14b00f89b5963a6d21e078e35822 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Thu, 13 Apr 2023 18:34:58 +0000 Subject: [PATCH 1/2] GUACAMOLE-926: Ensure loading style is always removed when file processing is complete. --- .../src/app/import/controllers/importConnectionsController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/guacamole/src/main/frontend/src/app/import/controllers/importConnectionsController.js b/guacamole/src/main/frontend/src/app/import/controllers/importConnectionsController.js index 993a8e534..e30344e52 100644 --- a/guacamole/src/main/frontend/src/app/import/controllers/importConnectionsController.js +++ b/guacamole/src/main/frontend/src/app/import/controllers/importConnectionsController.js @@ -365,6 +365,7 @@ angular.module('import').controller('importConnectionsController', ['$scope', '$ */ function handleParseSuccess(parseResult) { + $scope.processing = false; $scope.parseResult = parseResult; // If errors were encounted during file parsing, abort further From 341f359c6f39e8608d09199e5956be2abe03a3c8 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Thu, 13 Apr 2023 19:01:22 +0000 Subject: [PATCH 2/2] GUACAMOLE-926: Allow a bit more leeway in import group declaration. --- .../import/services/connectionParseService.js | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/frontend/src/app/import/services/connectionParseService.js b/guacamole/src/main/frontend/src/app/import/services/connectionParseService.js index ad90145d5..476c78f69 100644 --- a/guacamole/src/main/frontend/src/app/import/services/connectionParseService.js +++ b/guacamole/src/main/frontend/src/app/import/services/connectionParseService.js @@ -45,6 +45,14 @@ angular.module('import').factory('connectionParseService', const service = {}; + /** + * The identifier of the root connection group, under which all other groups + * and connections exist. + * + * @type String + */ + const ROOT_GROUP_IDENTIFIER = 'ROOT'; + /** * Perform basic checks, common to all file types - namely that the parsed * data is an array, and contains at least one connection entry. Returns an @@ -136,6 +144,10 @@ angular.module('import').factory('connectionParseService', * are present on the provided object, or if no group exists at the specified * path, the function will throw a ParseError describing the failure. * + * The group may begin with the root identifier, a leading slash, or may omit + * the root identifier entirely. Additionally, the group may optionally end + * with a trailing slash. + * * @returns {Promise.>} * A promise that will resolve to a function that will transform a * "group" field into a "parentIdentifier" field if possible. @@ -154,8 +166,25 @@ angular.module('import').factory('connectionParseService', key: 'IMPORT.ERROR_AMBIGUOUS_PARENT_GROUP' }); + // The group path extracted from the user-provided connection, to be + // translated if needed into an absolute path from the root group + let group = connection.group; + + // Allow the group to start with a leading slash instead instead of + // explicitly requiring the root connection group + if (group.startsWith('/')) + group = ROOT_GROUP_IDENTIFIER + group; + + // Allow groups to begin directly with the path underneath the root + else if (!group.startsWith(ROOT_GROUP_IDENTIFIER)) + group = ROOT_GROUP_IDENTIFIER + '/' + group; + + // Allow groups to end with a trailing slash + if (group.endsWith('/')) + group = group.slice(0, -1); + // Look up the parent identifier for the specified group path - const identifier = lookups[connection.group]; + const identifier = lookups[group]; // If the group doesn't match anything in the tree if (!identifier)