mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 07:01:21 +00:00
Add support for connecting to groups.
This commit is contained in:
@@ -108,6 +108,32 @@ GuacUI.removeClass = function(element, classname) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the connection group having the given ID in a new tab/window.
|
||||
*
|
||||
* @param {String} id The ID of the connection group to open.
|
||||
* @param {String} parameters Any parameters that should be added to the URL,
|
||||
* for sake of authentication.
|
||||
*/
|
||||
GuacUI.openConnectionGroup = function(id, parameters) {
|
||||
|
||||
// Get URL
|
||||
var url = "client.xhtml?id=g/" + encodeURIComponent(id);
|
||||
|
||||
// Add parameters, if given
|
||||
if (parameters)
|
||||
url += "&" + parameters;
|
||||
|
||||
// Attempt to focus existing window
|
||||
var current = window.open(null, id);
|
||||
|
||||
// If window did not already exist, set up as
|
||||
// Guacamole client
|
||||
if (!current.GuacUI)
|
||||
window.open(url, id);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the connection having the given ID in a new tab/window.
|
||||
*
|
||||
@@ -118,7 +144,7 @@ GuacUI.removeClass = function(element, classname) {
|
||||
GuacUI.openConnection = function(id, parameters) {
|
||||
|
||||
// Get URL
|
||||
var url = "client.xhtml?id=" + encodeURIComponent(id);
|
||||
var url = "client.xhtml?id=c/" + encodeURIComponent(id);
|
||||
|
||||
// Add parameters, if given
|
||||
if (parameters)
|
||||
|
@@ -197,6 +197,15 @@ GuacamoleRootUI.reset = function() {
|
||||
GuacUI.openConnection(connection.id, GuacamoleRootUI.parameters);
|
||||
};
|
||||
|
||||
// Open connection groups when clicked
|
||||
group_view.ongroupclick = function(group) {
|
||||
|
||||
// Connect if balancing
|
||||
if (group.type === GuacamoleService.ConnectionGroup.Type.BALANCING)
|
||||
GuacUI.openConnectionGroup(group.id, GuacamoleRootUI.parameters);
|
||||
|
||||
};
|
||||
|
||||
// Save all connections for later reference
|
||||
GuacamoleRootUI.connections = group_view.connections;
|
||||
|
||||
|
Reference in New Issue
Block a user