diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js b/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js index 46680fb6b..7874771fa 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageSessionsController.js @@ -32,6 +32,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj var SortOrder = $injector.get('SortOrder'); // Required services + var $filter = $injector.get('$filter'); var $translate = $injector.get('$translate'); var activeConnectionService = $injector.get('activeConnectionService'); var authenticationService = $injector.get('authenticationService'); @@ -55,13 +56,6 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj */ $scope.wrappers = null; - /** - * The date format for use for session-related dates. - * - * @type String - */ - $scope.sessionDateFormat = null; - /** * SortOrder instance which maintains the sort order of the visible * connection wrappers. @@ -102,6 +96,13 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj */ 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. * @@ -151,7 +152,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj var wrapActiveConnections = function wrapActiveConnections() { // Abort if not all required data is available - if (!activeConnections || !connections) + if (!activeConnections || !connections || !sessionDateFormat) return; // Wrap all active connections for sake of display @@ -163,6 +164,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj $scope.wrappers.push(new ActiveConnectionWrapper( connection.name, + $filter('date')(activeConnection.startDate, sessionDateFormat), activeConnection )); @@ -201,8 +203,14 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj }); // Get session date format - $translate('MANAGE_SESSION.FORMAT_STARTDATE').then(function sessionDateFormatReceived(sessionDateFormat) { - $scope.sessionDateFormat = sessionDateFormat; + $translate('MANAGE_SESSION.FORMAT_STARTDATE').then(function sessionDateFormatReceived(retrievedSessionDateFormat) { + + // Store received date format + sessionDateFormat = retrievedSessionDateFormat; + + // Attempt to produce wrapped list of active connections + wrapActiveConnections(); + }); /** diff --git a/guacamole/src/main/webapp/app/manage/templates/manageSessions.html b/guacamole/src/main/webapp/app/manage/templates/manageSessions.html index b558f4076..c1c1095b1 100644 --- a/guacamole/src/main/webapp/app/manage/templates/manageSessions.html +++ b/guacamole/src/main/webapp/app/manage/templates/manageSessions.html @@ -66,7 +66,7 @@ THE SOFTWARE. {{wrapper.activeConnection.username}} - {{wrapper.activeConnection.startDate | date:sessionDateFormat}} + {{wrapper.startDate}} {{wrapper.activeConnection.remoteHost}} {{wrapper.name}} diff --git a/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js b/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js index 92130c270..cb2c43e3d 100644 --- a/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js +++ b/guacamole/src/main/webapp/app/manage/types/ActiveConnectionWrapper.js @@ -33,11 +33,14 @@ angular.module('manage').factory('ActiveConnectionWrapper', [ * @constructor * @param {String} name * The display name of the active connection. + * + * @param {String} startDate + * The date and time this session began, pre-formatted for display. * * @param {ActiveConnection} activeConnection * The ActiveConnection to wrap. */ - var ActiveConnectionWrapper = function ActiveConnectionWrapper(name, activeConnection) { + var ActiveConnectionWrapper = function ActiveConnectionWrapper(name, startDate, activeConnection) { /** * The display name of this connection. @@ -46,6 +49,13 @@ angular.module('manage').factory('ActiveConnectionWrapper', [ */ this.name = name; + /** + * The date and time this session began, pre-formatted for display. + * + * @type String + */ + this.startDate = startDate; + /** * The wrapped ActiveConnection. *