GUACAMOLE-630: Allow parameters received via "argv" streams to be edited within the Guacamole menu.

This commit is contained in:
Michael Jumper
2019-08-03 19:52:39 -07:00
parent 02dadfac97
commit c41b6774fd
4 changed files with 308 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
var Protocol = $injector.get('Protocol');
var ScrollState = $injector.get('ScrollState');
// Required services
@@ -248,7 +249,15 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
*
* @type ScrollState
*/
scrollState : new ScrollState()
scrollState : new ScrollState(),
/**
* The current desired values of all editable connection parameters as
* a set of name/value pairs, including any changes made by the user.
*
* @type {Object.<String, String>}
*/
connectionParameters : {}
};
@@ -257,6 +266,16 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
$scope.menu.shown = false;
};
/**
* Applies any changes to connection parameters made by the user within the
* Guacamole menu.
*/
$scope.applyParameterChanges = function applyParameterChanges() {
angular.forEach($scope.menu.connectionParameters, function sendArgv(value, name) {
ManagedClient.setArgument($scope.client, name, value);
});
};
/**
* The client which should be attached to the client UI.
*
@@ -429,12 +448,20 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
});
// Update client state/behavior as visibility of the Guacamole menu changes
$scope.$watch('menu.shown', function menuVisibilityChanged(menuShown, menuShownPreviousState) {
// Send clipboard data if menu is hidden
if (!menuShown && menuShownPreviousState)
// Send clipboard and argument value data once menu is hidden
if (!menuShown && menuShownPreviousState) {
$scope.$broadcast('guacClipboard', $scope.client.clipboardData);
$scope.applyParameterChanges();
}
// Obtain snapshot of current editable connection parameters when menu
// is opened
else if (menuShown)
$scope.menu.connectionParameters = ManagedClient.getArgumentModel($scope.client);
// Disable client keyboard if the menu is shown
$scope.client.clientProperties.keyboardEnabled = !menuShown;
@@ -805,6 +832,11 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// Set client-specific menu actions
$scope.clientMenuActions = [ DISCONNECT_MENU_ACTION ];
/**
* @borrows Protocol.getNamespace
*/
$scope.getProtocolNamespace = Protocol.getNamespace;
/**
* The currently-visible filesystem within the filesystem menu, if the
* filesystem menu is open. If no filesystem is currently visible, this