mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-05 20:57:40 +00:00
GUACAMOLE-1904: Deduplicate events by broadcasting all directly from the root scope.
This commit is contained in:
@@ -498,20 +498,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
||||
$scope.menu.connectionParameters = newFocusedClient ?
|
||||
ManagedClient.getArgumentModel(newFocusedClient) : {};
|
||||
|
||||
// Re-broadcast the updated client
|
||||
$scope.$broadcast('guacClientChanged', newFocusedClient);
|
||||
|
||||
});
|
||||
|
||||
// Track when the protocol changes for the current client - generally
|
||||
// this will be when the protocol is first set for the client
|
||||
$scope.$on('guacClientProtocolUpdated', function protocolChanged(event, focusedClient) {
|
||||
|
||||
// Ignore any updated protocol not for the current focused client
|
||||
if ($scope.focusedClient && $scope.focusedClient === focusedClient)
|
||||
|
||||
// Re-broadcast the updated protocol
|
||||
$scope.$broadcast('guacClientProtocolChanged', focusedClient);
|
||||
});
|
||||
|
||||
// Automatically update connection parameters that have been modified
|
||||
@@ -519,13 +505,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
||||
$scope.$on('guacClientArgumentsUpdated', function argumentsChanged(event, focusedClient) {
|
||||
|
||||
// Ignore any updated arguments not for the current focused client
|
||||
if ($scope.focusedClient && $scope.focusedClient === focusedClient) {
|
||||
if ($scope.focusedClient && $scope.focusedClient === focusedClient)
|
||||
$scope.menu.connectionParameters = ManagedClient.getArgumentModel(focusedClient);
|
||||
|
||||
// Re-broadcast the updated arguments
|
||||
$scope.$broadcast('guacClientArgumentsChanged', focusedClient);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Update page icon when thumbnail changes
|
||||
|
@@ -62,6 +62,9 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
|
||||
directive.controller = ['$scope', '$injector', '$element',
|
||||
function guacTiledClientsController($scope, $injector, $element) {
|
||||
|
||||
// Required services
|
||||
const $rootScope = $injector.get('$rootScope');
|
||||
|
||||
// Required types
|
||||
const ManagedClient = $injector.get('ManagedClient');
|
||||
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||
@@ -89,17 +92,17 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
|
||||
|
||||
// Notify whenever identify of currently-focused client changes
|
||||
$scope.$watch('getFocusedClient()', function focusedClientChanged(focusedClient) {
|
||||
$scope.$emit('guacClientFocused', focusedClient);
|
||||
$rootScope.$broadcast('guacClientFocused', focusedClient);
|
||||
});
|
||||
|
||||
// Notify whenever arguments of currently-focused client changes
|
||||
$scope.$watch('getFocusedClient().arguments', function focusedClientParametersChanged() {
|
||||
$scope.$emit('guacClientArgumentsUpdated', $scope.getFocusedClient());
|
||||
$rootScope.$broadcast('guacClientArgumentsUpdated', $scope.getFocusedClient());
|
||||
}, true);
|
||||
|
||||
// Notify whenever protocol of currently-focused client changes
|
||||
$scope.$watch('getFocusedClient().protocol', function focusedClientParametersChanged() {
|
||||
$scope.$emit('guacClientProtocolUpdated', $scope.getFocusedClient());
|
||||
$rootScope.$broadcast('guacClientProtocolUpdated', $scope.getFocusedClient());
|
||||
}, true);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user