mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Merge pull request #128 from glyptodon/filter-date
GUAC-1138: Add filtering/sorting on displayed date.
This commit is contained in:
@@ -35,6 +35,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
// Required services
|
// Required services
|
||||||
var $location = $injector.get('$location');
|
var $location = $injector.get('$location');
|
||||||
var $routeParams = $injector.get('$routeParams');
|
var $routeParams = $injector.get('$routeParams');
|
||||||
|
var $translate = $injector.get('$translate');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var connectionService = $injector.get('connectionService');
|
var connectionService = $injector.get('connectionService');
|
||||||
@@ -100,6 +101,13 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
*/
|
*/
|
||||||
$scope.parameters = null;
|
$scope.parameters = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date format for use within the connection history.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
$scope.historyDateFormat = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The usage history of the connection being modified.
|
* The usage history of the connection being modified.
|
||||||
*
|
*
|
||||||
@@ -150,6 +158,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
&& $scope.rootGroup !== null
|
&& $scope.rootGroup !== null
|
||||||
&& $scope.connection !== null
|
&& $scope.connection !== null
|
||||||
&& $scope.parameters !== null
|
&& $scope.parameters !== null
|
||||||
|
&& $scope.historyDateFormat !== null
|
||||||
&& $scope.historyEntryWrappers !== null
|
&& $scope.historyEntryWrappers !== null
|
||||||
&& $scope.permissions !== null
|
&& $scope.permissions !== null
|
||||||
&& $scope.canSaveConnection !== null
|
&& $scope.canSaveConnection !== null
|
||||||
@@ -199,7 +208,12 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
protocolService.getProtocols().success(function protocolsReceived(protocols) {
|
protocolService.getProtocols().success(function protocolsReceived(protocols) {
|
||||||
$scope.protocols = protocols;
|
$scope.protocols = protocols;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get history date format
|
||||||
|
$translate('MANAGE_CONNECTION.FORMAT_HISTORY_START').then(function historyDateFormatReceived(historyDateFormat) {
|
||||||
|
$scope.historyDateFormat = historyDateFormat;
|
||||||
|
});
|
||||||
|
|
||||||
// If we are editing an existing connection, pull its data
|
// If we are editing an existing connection, pull its data
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
var SortOrder = $injector.get('SortOrder');
|
var SortOrder = $injector.get('SortOrder');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
|
var $filter = $injector.get('$filter');
|
||||||
|
var $translate = $injector.get('$translate');
|
||||||
var activeConnectionService = $injector.get('activeConnectionService');
|
var activeConnectionService = $injector.get('activeConnectionService');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
@@ -62,7 +64,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
*/
|
*/
|
||||||
$scope.wrapperOrder = new SortOrder([
|
$scope.wrapperOrder = new SortOrder([
|
||||||
'activeConnection.username',
|
'activeConnection.username',
|
||||||
'activeConnection.startDate',
|
'startDate',
|
||||||
'activeConnection.remoteHost',
|
'activeConnection.remoteHost',
|
||||||
'name'
|
'name'
|
||||||
]);
|
]);
|
||||||
@@ -74,6 +76,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
*/
|
*/
|
||||||
$scope.filteredWrapperProperties = [
|
$scope.filteredWrapperProperties = [
|
||||||
'activeConnection.username',
|
'activeConnection.username',
|
||||||
|
'startDate',
|
||||||
'activeConnection.remoteHost',
|
'activeConnection.remoteHost',
|
||||||
'name'
|
'name'
|
||||||
];
|
];
|
||||||
@@ -94,6 +97,13 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
*/
|
*/
|
||||||
var connections = null;
|
var connections = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date format for use for session-related dates.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
var sessionDateFormat = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of all currently-selected active connection wrappers by identifier.
|
* Map of all currently-selected active connection wrappers by identifier.
|
||||||
*
|
*
|
||||||
@@ -143,7 +153,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
var wrapActiveConnections = function wrapActiveConnections() {
|
var wrapActiveConnections = function wrapActiveConnections() {
|
||||||
|
|
||||||
// Abort if not all required data is available
|
// Abort if not all required data is available
|
||||||
if (!activeConnections || !connections)
|
if (!activeConnections || !connections || !sessionDateFormat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Wrap all active connections for sake of display
|
// Wrap all active connections for sake of display
|
||||||
@@ -155,6 +165,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
|
|
||||||
$scope.wrappers.push(new ActiveConnectionWrapper(
|
$scope.wrappers.push(new ActiveConnectionWrapper(
|
||||||
connection.name,
|
connection.name,
|
||||||
|
$filter('date')(activeConnection.startDate, sessionDateFormat),
|
||||||
activeConnection
|
activeConnection
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -192,6 +203,17 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get session date format
|
||||||
|
$translate('MANAGE_SESSION.FORMAT_STARTDATE').then(function sessionDateFormatReceived(retrievedSessionDateFormat) {
|
||||||
|
|
||||||
|
// Store received date format
|
||||||
|
sessionDateFormat = retrievedSessionDateFormat;
|
||||||
|
|
||||||
|
// Attempt to produce wrapped list of active connections
|
||||||
|
wrapActiveConnections();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether critical data has completed being loaded.
|
* Returns whether critical data has completed being loaded.
|
||||||
*
|
*
|
||||||
@@ -201,8 +223,9 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
*/
|
*/
|
||||||
$scope.isLoaded = function isLoaded() {
|
$scope.isLoaded = function isLoaded() {
|
||||||
|
|
||||||
return $scope.wrappers !== null
|
return $scope.wrappers !== null
|
||||||
&& $scope.permissions !== null;
|
&& $scope.sessionDateFormat !== null
|
||||||
|
&& $scope.permissions !== null;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ THE SOFTWARE.
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="wrapper in wrapperPage">
|
<tr ng-repeat="wrapper in wrapperPage">
|
||||||
<td class="username">{{wrapper.entry.username}}</td>
|
<td class="username">{{wrapper.entry.username}}</td>
|
||||||
<td class="start">{{wrapper.entry.startDate | date:'short'}}</td>
|
<td class="start">{{wrapper.entry.startDate | date:historyDateFormat}}</td>
|
||||||
<td class="duration">{{wrapper.durationText | translate:"{VALUE: wrapper.duration.value, UNIT: wrapper.duration.unit}"}}</td>
|
<td class="duration">{{wrapper.durationText | translate:"{VALUE: wrapper.duration.value, UNIT: wrapper.duration.unit}"}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@@ -49,7 +49,7 @@ THE SOFTWARE.
|
|||||||
<th guac-sort-order="wrapperOrder" guac-sort-property="'activeConnection.username'">
|
<th guac-sort-order="wrapperOrder" guac-sort-property="'activeConnection.username'">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_USERNAME' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_USERNAME' | translate}}
|
||||||
</th>
|
</th>
|
||||||
<th guac-sort-order="wrapperOrder" guac-sort-property="'activeConnection.startDate'">
|
<th guac-sort-order="wrapperOrder" guac-sort-property="'startDate'">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_STARTDATE' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_STARTDATE' | translate}}
|
||||||
</th>
|
</th>
|
||||||
<th guac-sort-order="wrapperOrder" guac-sort-property="'activeConnection.remoteHost'">
|
<th guac-sort-order="wrapperOrder" guac-sort-property="'activeConnection.remoteHost'">
|
||||||
@@ -66,7 +66,7 @@ THE SOFTWARE.
|
|||||||
<input ng-change="wrapperSelectionChange(wrapper)" type="checkbox" ng-model="wrapper.checked" />
|
<input ng-change="wrapperSelectionChange(wrapper)" type="checkbox" ng-model="wrapper.checked" />
|
||||||
</td>
|
</td>
|
||||||
<td>{{wrapper.activeConnection.username}}</td>
|
<td>{{wrapper.activeConnection.username}}</td>
|
||||||
<td>{{wrapper.activeConnection.startDate | date:'short'}}</td>
|
<td>{{wrapper.startDate}}</td>
|
||||||
<td>{{wrapper.activeConnection.remoteHost}}</td>
|
<td>{{wrapper.activeConnection.remoteHost}}</td>
|
||||||
<td>{{wrapper.name}}</td>
|
<td>{{wrapper.name}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -33,11 +33,14 @@ angular.module('manage').factory('ActiveConnectionWrapper', [
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* The display name of the active connection.
|
* The display name of the active connection.
|
||||||
|
*
|
||||||
|
* @param {String} startDate
|
||||||
|
* The date and time this session began, pre-formatted for display.
|
||||||
*
|
*
|
||||||
* @param {ActiveConnection} activeConnection
|
* @param {ActiveConnection} activeConnection
|
||||||
* The ActiveConnection to wrap.
|
* The ActiveConnection to wrap.
|
||||||
*/
|
*/
|
||||||
var ActiveConnectionWrapper = function ActiveConnectionWrapper(name, activeConnection) {
|
var ActiveConnectionWrapper = function ActiveConnectionWrapper(name, startDate, activeConnection) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The display name of this connection.
|
* The display name of this connection.
|
||||||
@@ -46,6 +49,13 @@ angular.module('manage').factory('ActiveConnectionWrapper', [
|
|||||||
*/
|
*/
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date and time this session began, pre-formatted for display.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
this.startDate = startDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The wrapped ActiveConnection.
|
* The wrapped ActiveConnection.
|
||||||
*
|
*
|
||||||
|
@@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
"FIELD_HEADER_PASSWORD" : "Password:",
|
"FIELD_HEADER_PASSWORD" : "Password:",
|
||||||
"FIELD_HEADER_PASSWORD_AGAIN" : "Re-enter Password:",
|
"FIELD_HEADER_PASSWORD_AGAIN" : "Re-enter Password:",
|
||||||
|
|
||||||
|
"FORMAT_DATE_TIME_PRECISE" : "yyyy-MM-dd HH:mm:ss",
|
||||||
|
|
||||||
"INFO_ACTIVE_USER_COUNT" : "Currently in use by {USERS} {USERS, plural, one{user} other{users}}.",
|
"INFO_ACTIVE_USER_COUNT" : "Currently in use by {USERS} {USERS, plural, one{user} other{users}}.",
|
||||||
|
|
||||||
"NAME" : "Guacamole ${project.version}"
|
"NAME" : "Guacamole ${project.version}"
|
||||||
@@ -155,7 +157,9 @@
|
|||||||
"FIELD_HEADER_LOCATION" : "Location:",
|
"FIELD_HEADER_LOCATION" : "Location:",
|
||||||
"FIELD_HEADER_NAME" : "Name:",
|
"FIELD_HEADER_NAME" : "Name:",
|
||||||
"FIELD_HEADER_PROTOCOL" : "Protocol:",
|
"FIELD_HEADER_PROTOCOL" : "Protocol:",
|
||||||
|
|
||||||
|
"FORMAT_HISTORY_START" : "@:APP.FORMAT_DATE_TIME_PRECISE",
|
||||||
|
|
||||||
"HELP_CONNECTIONS" : "Click or tap on a connection below to manage that connection. Depending on your access level, connections can be added and deleted, and their properties (protocol, hostname, port, etc.) can be changed.",
|
"HELP_CONNECTIONS" : "Click or tap on a connection below to manage that connection. Depending on your access level, connections can be added and deleted, and their properties (protocol, hostname, port, etc.) can be changed.",
|
||||||
"HELP_SHOW_PASSWORD" : "Click to show password",
|
"HELP_SHOW_PASSWORD" : "Click to show password",
|
||||||
"HELP_HIDE_PASSWORD" : "Click to hide password",
|
"HELP_HIDE_PASSWORD" : "Click to hide password",
|
||||||
@@ -245,6 +249,8 @@
|
|||||||
|
|
||||||
"FIELD_PLACEHOLDER_FILTER" : "Filter",
|
"FIELD_PLACEHOLDER_FILTER" : "Filter",
|
||||||
|
|
||||||
|
"FORMAT_STARTDATE" : "@:APP.FORMAT_DATE_TIME_PRECISE",
|
||||||
|
|
||||||
"HELP_SESSIONS" : "All currently-active Guacamole sessions are listed here. If you wish to kill one or more sessions, check the box next to those sessions and click \"Kill Sessions\". Killing a session will immediately disconnect the user from the associated connection.",
|
"HELP_SESSIONS" : "All currently-active Guacamole sessions are listed here. If you wish to kill one or more sessions, check the box next to those sessions and click \"Kill Sessions\". Killing a session will immediately disconnect the user from the associated connection.",
|
||||||
|
|
||||||
"INFO_NO_SESSIONS" : "No active sessions",
|
"INFO_NO_SESSIONS" : "No active sessions",
|
||||||
|
Reference in New Issue
Block a user