mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Merge pull request #71 from glyptodon/GUAC-997
GUAC-997 Added active user count to REST API and UI.
This commit is contained in:
@@ -22,10 +22,12 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest.connection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.Connection;
|
||||
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
||||
import org.glyptodon.guacamole.net.basic.rest.connectiongroup.APIConnectionGroup;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
|
||||
@@ -62,6 +64,11 @@ public class APIConnection {
|
||||
*/
|
||||
private Map<String, String> parameters;
|
||||
|
||||
/**
|
||||
* The count of currently active users for this connection.
|
||||
*/
|
||||
private int activeUsers;
|
||||
|
||||
/**
|
||||
* Create an empty APIConnection.
|
||||
*/
|
||||
@@ -87,6 +94,14 @@ public class APIConnection {
|
||||
if (this.parentIdentifier == null)
|
||||
this.parentIdentifier = APIConnectionGroup.ROOT_IDENTIFIER;
|
||||
|
||||
// Set the number of currently active users
|
||||
this.activeUsers = 0;
|
||||
|
||||
for (ConnectionRecord history : connection.getHistory()) {
|
||||
if (history.isActive())
|
||||
this.activeUsers++;
|
||||
}
|
||||
|
||||
// Set protocol from configuration
|
||||
GuacamoleConfiguration configuration = connection.getConfiguration();
|
||||
this.protocol = configuration.getProtocol();
|
||||
@@ -174,4 +189,20 @@ public class APIConnection {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of currently active users for this connection.
|
||||
* @return The number of currently active users for this connection.
|
||||
*/
|
||||
public int getActiveUsers() {
|
||||
return activeUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of currently active users for this connection.
|
||||
* @param activeUsers The number of currently active users for this connection.
|
||||
*/
|
||||
public void setActiveUsers(int activeUsers) {
|
||||
this.activeUsers = activeUsers;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -101,6 +101,14 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
|
||||
*/
|
||||
this.isExpanded = template.isExpanded;
|
||||
|
||||
/**
|
||||
* The number of currently active users for this connection. This field
|
||||
* has no meaning for a connection group, and may be null or undefined.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
this.activeUsers = template.activeUsers;
|
||||
|
||||
/**
|
||||
* The connection or connection group whose data is exposed within
|
||||
* this GroupListItem.
|
||||
@@ -135,6 +143,9 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
|
||||
isConnection : true,
|
||||
isConnectionGroup : false,
|
||||
|
||||
// Count of currently active users
|
||||
activeUsers : connection.activeUsers,
|
||||
|
||||
// Wrapped item
|
||||
wrappedItem : connection
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<div class="caption">
|
||||
<div class="caption" ng-class="{active: item.activeUsers}">
|
||||
|
||||
<!-- Connection icon -->
|
||||
<div class="protocol">
|
||||
@@ -31,5 +31,10 @@
|
||||
<!-- Connection name -->
|
||||
<span class="name">{{item.name}}</span>
|
||||
|
||||
<!-- Active user count -->
|
||||
<span class="activeUserCount" ng-show="item.activeUsers">
|
||||
{{'HOME.INFO_ACTIVE_USER_COUNT' | translate:'{USERS: item.activeUsers}'}}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</a>
|
||||
|
@@ -41,3 +41,10 @@
|
||||
font-style: normal;
|
||||
src: url('fonts/carlito/Carlito-Bold.woff') format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Carlito';
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
src: url('fonts/carlito/Carlito-Italic.woff') format('woff');
|
||||
}
|
||||
|
@@ -140,6 +140,16 @@ div.section {
|
||||
background: #DEB;
|
||||
}
|
||||
|
||||
.caption.active * {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.caption .activeUserCount {
|
||||
font-style: italic;
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
}
|
||||
|
||||
.list-item:not(.selected) .caption:hover {
|
||||
background: #CDA;
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@
|
||||
THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<div class="caption">
|
||||
<div class="caption" ng-class="{active: item.activeUsers}">
|
||||
|
||||
<!-- Connection icon -->
|
||||
<div class="protocol">
|
||||
@@ -31,5 +31,10 @@
|
||||
<!-- Connection name -->
|
||||
<span class="name">{{item.name}}</span>
|
||||
|
||||
<!-- Active user count -->
|
||||
<span class="activeUserCount" ng-show="item.activeUsers">
|
||||
{{'MANAGE.INFO_ACTIVE_USER_COUNT' | translate:'{USERS: item.activeUsers}'}}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</a>
|
||||
|
@@ -80,6 +80,15 @@ angular.module('rest').factory('Connection', [function defineConnection() {
|
||||
*/
|
||||
this.parameters = template.parameters;
|
||||
|
||||
/**
|
||||
* The count of currently active users for this connection. This field
|
||||
* will be returned from the REST API during a get operation,
|
||||
* but may not be set when doing an update or create operation.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
this.activeUsers = template.activeUsers;
|
||||
|
||||
};
|
||||
|
||||
return Connection;
|
||||
|
BIN
guacamole/src/main/webapp/fonts/carlito/Carlito-Italic.woff
Normal file
BIN
guacamole/src/main/webapp/fonts/carlito/Carlito-Italic.woff
Normal file
Binary file not shown.
@@ -12,6 +12,8 @@
|
||||
"ACTION_NAVIGATE_HOME" : "Home",
|
||||
"ACTION_SAVE" : "Save",
|
||||
|
||||
"INFO_ACTIVE_USER_COUNT" : "Currently in use by {USERS} {USERS, plural, one{user} other{users}}.",
|
||||
|
||||
"NAME" : "Guacamole ${project.version}"
|
||||
|
||||
},
|
||||
@@ -106,6 +108,8 @@
|
||||
"ACTION_LOGOUT" : "@:APP.ACTION_LOGOUT",
|
||||
"ACTION_MANAGE" : "@:APP.ACTION_MANAGE",
|
||||
|
||||
"INFO_ACTIVE_USER_COUNT" : "@:APP.INFO_ACTIVE_USER_COUNT",
|
||||
|
||||
"INFO_NO_RECENT_CONNECTIONS" : "No recent connections.",
|
||||
|
||||
"SECTION_HEADER_ALL_CONNECTIONS" : "All Connections",
|
||||
@@ -140,6 +144,8 @@
|
||||
"HELP_HIDE_PASSWORD" : "Click to hide password",
|
||||
"HELP_USERS" : "Click or tap on a user below to manage that user. Depending on your access level, users can be added and deleted, and their passwords can be changed.",
|
||||
|
||||
"INFO_ACTIVE_USER_COUNT" : "@:APP.INFO_ACTIVE_USER_COUNT",
|
||||
|
||||
"SECTION_HEADER_ADMINISTRATION" : "Administration",
|
||||
"SECTION_HEADER_CONNECTIONS" : "Connections",
|
||||
"SECTION_HEADER_USERS" : "Users"
|
||||
|
Reference in New Issue
Block a user