mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Allow GroupView to be filtered via arbitrary functions.
This commit is contained in:
@@ -953,8 +953,14 @@ GuacUI.ListGroup = function(caption) {
|
|||||||
* within the view.
|
* within the view.
|
||||||
* @param {Number} flags Any flags (such as MULTISELECT or SHOW_CONNECTIONS)
|
* @param {Number} flags Any flags (such as MULTISELECT or SHOW_CONNECTIONS)
|
||||||
* for modifying the behavior of this group view.
|
* for modifying the behavior of this group view.
|
||||||
|
* @param {Function} group_filter Function which returns true if the given
|
||||||
|
* group should be displayed and false otherwise.
|
||||||
|
* @param {Function} connection_filter Function which returns true if the given
|
||||||
|
* connection should be displayed and false
|
||||||
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
GuacUI.GroupView = function(root_group, flags) {
|
GuacUI.GroupView = function(root_group, flags,
|
||||||
|
group_filter, connection_filter) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to this GroupView.
|
* Reference to this GroupView.
|
||||||
@@ -1208,6 +1214,10 @@ GuacUI.GroupView = function(root_group, flags) {
|
|||||||
*/
|
*/
|
||||||
function addConnection(connection, appendChild) {
|
function addConnection(connection, appendChild) {
|
||||||
|
|
||||||
|
// Do not add connection if filter says "no"
|
||||||
|
if (connection_filter && !connection_filter(connection))
|
||||||
|
return;
|
||||||
|
|
||||||
group_view.connections[connection.id] = connection;
|
group_view.connections[connection.id] = connection;
|
||||||
|
|
||||||
// Add connection to connection list or parent group
|
// Add connection to connection list or parent group
|
||||||
@@ -1264,6 +1274,10 @@ GuacUI.GroupView = function(root_group, flags) {
|
|||||||
*/
|
*/
|
||||||
function addGroup(group, appendChild) {
|
function addGroup(group, appendChild) {
|
||||||
|
|
||||||
|
// Do not add group if filter says "no"
|
||||||
|
if (group_filter && !group_filter(group))
|
||||||
|
return;
|
||||||
|
|
||||||
// Add group to groups collection
|
// Add group to groups collection
|
||||||
group_view.groups[group.id] = group;
|
group_view.groups[group.id] = group;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user