mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUACAMOLE-462: Store REST API history entry directly in ConnectionHistoryEntryWrapper, rather than duplicating properties.
This commit is contained in:
@@ -82,11 +82,11 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
||||
* @type SortOrder
|
||||
*/
|
||||
$scope.order = new SortOrder([
|
||||
'-startDate',
|
||||
'-entry.startDate',
|
||||
'-duration',
|
||||
'username',
|
||||
'connectionName',
|
||||
'remoteHost'
|
||||
'entry.username',
|
||||
'entry.connectionName',
|
||||
'entry.remoteHost'
|
||||
]);
|
||||
|
||||
// Get session date format
|
||||
@@ -216,11 +216,11 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
||||
),
|
||||
function pushRecord(historyEntryWrapper) {
|
||||
records.push([
|
||||
historyEntryWrapper.username,
|
||||
$filter('date')(historyEntryWrapper.startDate, $scope.dateFormat),
|
||||
historyEntryWrapper.entry.username,
|
||||
$filter('date')(historyEntryWrapper.entry.startDate, $scope.dateFormat),
|
||||
historyEntryWrapper.duration / 1000,
|
||||
historyEntryWrapper.connectionName,
|
||||
historyEntryWrapper.remoteHost
|
||||
historyEntryWrapper.entry.connectionName,
|
||||
historyEntryWrapper.entry.remoteHost
|
||||
]);
|
||||
}
|
||||
);
|
||||
|
@@ -17,31 +17,31 @@
|
||||
<table class="sorted history-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th guac-sort-order="order" guac-sort-property="'username'">
|
||||
<th guac-sort-order="order" guac-sort-property="'entry.username'">
|
||||
{{'SETTINGS_CONNECTION_HISTORY.TABLE_HEADER_SESSION_USERNAME' | translate}}
|
||||
</th>
|
||||
<th guac-sort-order="order" guac-sort-property="'startDate'">
|
||||
<th guac-sort-order="order" guac-sort-property="'entry.startDate'">
|
||||
{{'SETTINGS_CONNECTION_HISTORY.TABLE_HEADER_SESSION_STARTDATE' | translate}}
|
||||
</th>
|
||||
<th guac-sort-order="order" guac-sort-property="'duration'">
|
||||
{{'SETTINGS_CONNECTION_HISTORY.TABLE_HEADER_SESSION_DURATION' | translate}}
|
||||
</th>
|
||||
<th guac-sort-order="order" guac-sort-property="'connectionName'">
|
||||
<th guac-sort-order="order" guac-sort-property="'entry.connectionName'">
|
||||
{{'SETTINGS_CONNECTION_HISTORY.TABLE_HEADER_SESSION_CONNECTION_NAME' | translate}}
|
||||
</th>
|
||||
<th guac-sort-order="order" guac-sort-property="'remoteHost'">
|
||||
<th guac-sort-order="order" guac-sort-property="'entry.remoteHost'">
|
||||
{{'SETTINGS_CONNECTION_HISTORY.TABLE_HEADER_SESSION_REMOTEHOST' | translate}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-class="{loading: !isLoaded()}">
|
||||
<tr ng-repeat="historyEntryWrapper in historyEntryWrapperPage" class="history">
|
||||
<td><guac-user-item username="historyEntryWrapper.username"></guac-user-item></td>
|
||||
<td>{{historyEntryWrapper.startDate | date : dateFormat}}</td>
|
||||
<td><guac-user-item username="historyEntryWrapper.entry.username"></guac-user-item></td>
|
||||
<td>{{historyEntryWrapper.entry.startDate | date : dateFormat}}</td>
|
||||
<td translate="{{historyEntryWrapper.readableDurationText}}"
|
||||
translate-values="{VALUE: historyEntryWrapper.readableDuration.value, UNIT: historyEntryWrapper.readableDuration.unit}"></td>
|
||||
<td>{{historyEntryWrapper.connectionName}}</td>
|
||||
<td>{{historyEntryWrapper.remoteHost}}</td>
|
||||
<td>{{historyEntryWrapper.entry.connectionName}}</td>
|
||||
<td>{{historyEntryWrapper.entry.remoteHost}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@@ -37,52 +37,11 @@ angular.module('settings').factory('ConnectionHistoryEntryWrapper', ['$injector'
|
||||
var ConnectionHistoryEntryWrapper = function ConnectionHistoryEntryWrapper(historyEntry) {
|
||||
|
||||
/**
|
||||
* The identifier of the connection associated with this history entry.
|
||||
* The wrapped ConnectionHistoryEntry.
|
||||
*
|
||||
* @type String
|
||||
* @type ConnectionHistoryEntry
|
||||
*/
|
||||
this.connectionIdentifier = historyEntry.connectionIdentifier;
|
||||
|
||||
/**
|
||||
* The name of the connection associated with this history entry.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
this.connectionName = historyEntry.connectionName;
|
||||
|
||||
/**
|
||||
* The remote host associated with this history entry.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
this.remoteHost = historyEntry.remoteHost;
|
||||
|
||||
/**
|
||||
* The username of the user associated with this particular usage of
|
||||
* the connection.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
this.username = historyEntry.username;
|
||||
|
||||
/**
|
||||
* The time that usage began, in seconds since 1970-01-01 00:00:00 UTC.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
this.startDate = historyEntry.startDate;
|
||||
|
||||
/**
|
||||
* The time that usage ended, in seconds since 1970-01-01 00:00:00 UTC.
|
||||
* The absence of an endDate does NOT necessarily indicate that the
|
||||
* connection is still in use, particularly if the server was shutdown
|
||||
* or restarted before the history entry could be updated. To determine
|
||||
* whether a connection is still active, check the active property of
|
||||
* this history entry.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
this.endDate = historyEntry.endDate;
|
||||
this.entry = historyEntry;
|
||||
|
||||
/**
|
||||
* The total amount of time the connection associated with the wrapped
|
||||
@@ -90,7 +49,7 @@ angular.module('settings').factory('ConnectionHistoryEntryWrapper', ['$injector'
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
this.duration = this.endDate - this.startDate;
|
||||
this.duration = historyEntry.endDate - historyEntry.startDate;
|
||||
|
||||
/**
|
||||
* An object providing value and unit properties, denoting the duration
|
||||
@@ -101,7 +60,7 @@ angular.module('settings').factory('ConnectionHistoryEntryWrapper', ['$injector'
|
||||
this.readableDuration = null;
|
||||
|
||||
// Set the duration if the necessary information is present
|
||||
if (this.endDate && this.startDate)
|
||||
if (historyEntry.endDate && historyEntry.startDate)
|
||||
this.readableDuration = new ConnectionHistoryEntry.Duration(this.duration);
|
||||
|
||||
/**
|
||||
@@ -115,7 +74,7 @@ angular.module('settings').factory('ConnectionHistoryEntryWrapper', ['$injector'
|
||||
this.readableDurationText = 'SETTINGS_CONNECTION_HISTORY.TEXT_HISTORY_DURATION';
|
||||
|
||||
// Inform user if end date is not known
|
||||
if (!this.endDate)
|
||||
if (!historyEntry.endDate)
|
||||
this.readableDurationText = 'SETTINGS_CONNECTION_HISTORY.INFO_CONNECTION_DURATION_UNKNOWN';
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user