mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-1138: Store formatted start date within session wrapper.
This commit is contained in:
		| @@ -32,6 +32,7 @@ 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 $translate              = $injector.get('$translate'); | ||||||
|     var activeConnectionService = $injector.get('activeConnectionService'); |     var activeConnectionService = $injector.get('activeConnectionService'); | ||||||
|     var authenticationService   = $injector.get('authenticationService'); |     var authenticationService   = $injector.get('authenticationService'); | ||||||
| @@ -55,13 +56,6 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj | |||||||
|      */ |      */ | ||||||
|     $scope.wrappers = null; |     $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 |      * SortOrder instance which maintains the sort order of the visible | ||||||
|      * connection wrappers. |      * connection wrappers. | ||||||
| @@ -102,6 +96,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. | ||||||
|      *  |      *  | ||||||
| @@ -151,7 +152,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 | ||||||
| @@ -163,6 +164,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 | ||||||
|             ));  |             ));  | ||||||
|  |  | ||||||
| @@ -201,8 +203,14 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj | |||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     // Get session date format |     // Get session date format | ||||||
|     $translate('MANAGE_SESSION.FORMAT_STARTDATE').then(function sessionDateFormatReceived(sessionDateFormat) { |     $translate('MANAGE_SESSION.FORMAT_STARTDATE').then(function sessionDateFormatReceived(retrievedSessionDateFormat) { | ||||||
|         $scope.sessionDateFormat = sessionDateFormat; |  | ||||||
|  |         // Store received date format | ||||||
|  |         sessionDateFormat = retrievedSessionDateFormat; | ||||||
|  |  | ||||||
|  |         // Attempt to produce wrapped list of active connections | ||||||
|  |         wrapActiveConnections(); | ||||||
|  |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -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:sessionDateFormat}}</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> | ||||||
|   | |||||||
| @@ -34,10 +34,13 @@ angular.module('manage').factory('ActiveConnectionWrapper', [ | |||||||
|      * @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. | ||||||
|          * |          * | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user