From 176eec6fd826fc3af6c22efb122b48af8b968201 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Thu, 28 Dec 2023 19:53:13 +0000 Subject: [PATCH 1/2] GUACAMOLE-1896: Refresh connection parameters when focused client updates. --- .../frontend/src/app/client/directives/guacTiledClients.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js b/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js index 01ecab50d..ea94f046a 100644 --- a/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js +++ b/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js @@ -92,6 +92,11 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient $scope.$emit('guacClientFocused', focusedClient); }); + // Notify whenever arguments of currently-focused client changes + $scope.$watch('getFocusedClient().arguments', function focusedClientParametersChanged() { + $scope.$emit('guacClientFocused', $scope.getFocusedClient()); + }, true); + /** * Returns a callback for guacClick that assigns or updates keyboard * focus to the given client, allowing that client to receive and From 83d411572785ae2de712bf5a230f4a8c7f3938d2 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Tue, 2 Jan 2024 23:27:04 +0000 Subject: [PATCH 2/2] GUACAMOLE-1896: Add a new guacClientArgumentsUpdated event instead of abusing guacClientFocused. --- .../src/app/client/controllers/clientController.js | 12 ++++++++++++ .../src/app/client/directives/guacTiledClients.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/frontend/src/app/client/controllers/clientController.js b/guacamole/src/main/frontend/src/app/client/controllers/clientController.js index 2821146f8..920d79b3a 100644 --- a/guacamole/src/main/frontend/src/app/client/controllers/clientController.js +++ b/guacamole/src/main/frontend/src/app/client/controllers/clientController.js @@ -486,6 +486,18 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }); + // Automatically update connection parameters that have been modified + // for the current focused client + $scope.$on('guacClientArgumentsUpdated', function focusedClientChanged(event, focusedClient) { + + // Update available connection parameters, if the updated arguments are + // for the current focused client - otherwise ignore them + if ($scope.focusedClient && $scope.focusedClient === focusedClient) + $scope.menu.connectionParameters = focusedClient ? + ManagedClient.getArgumentModel(focusedClient) : {}; + + }); + // Update page icon when thumbnail changes $scope.$watch('focusedClient.thumbnail.canvas', function thumbnailChanged(canvas) { iconService.setIcons(canvas); diff --git a/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js b/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js index ea94f046a..e43c2603f 100644 --- a/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js +++ b/guacamole/src/main/frontend/src/app/client/directives/guacTiledClients.js @@ -94,7 +94,7 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient // Notify whenever arguments of currently-focused client changes $scope.$watch('getFocusedClient().arguments', function focusedClientParametersChanged() { - $scope.$emit('guacClientFocused', $scope.getFocusedClient()); + $scope.$emit('guacClientArgumentsUpdated', $scope.getFocusedClient()); }, true); /**