mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Merge changes from staging/1.5.0 back to master.
This commit is contained in:
@@ -71,6 +71,35 @@ public class HistoryConnectionRecord extends DelegatingConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
private final File recording;
|
private final File recording;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the file or directory providing recording storage for the given
|
||||||
|
* history record. If no such file or directory exists, or the file cannot
|
||||||
|
* be read, null is returned.
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* The ConnectionRecord whose associated recording storage file
|
||||||
|
* or directory should be returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* A File pointing to the file or directory providing recording storage
|
||||||
|
* for the given history record, or null if no such file exists.
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If the configured path for stored recordings cannot be read.
|
||||||
|
*/
|
||||||
|
private static File getRecordingFile(ConnectionRecord record) throws GuacamoleException {
|
||||||
|
|
||||||
|
UUID uuid = record.getUUID();
|
||||||
|
if (uuid != null) {
|
||||||
|
File recordingFile = new File(HistoryAuthenticationProvider.getRecordingSearchPath(), uuid.toString());
|
||||||
|
if (recordingFile.canRead())
|
||||||
|
return recordingFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new HistoryConnectionRecord that wraps the given
|
* Creates a new HistoryConnectionRecord that wraps the given
|
||||||
* ConnectionRecord, automatically associating ActivityLogs based on
|
* ConnectionRecord, automatically associating ActivityLogs based on
|
||||||
@@ -84,11 +113,7 @@ public class HistoryConnectionRecord extends DelegatingConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
public HistoryConnectionRecord(ConnectionRecord record) throws GuacamoleException {
|
public HistoryConnectionRecord(ConnectionRecord record) throws GuacamoleException {
|
||||||
super(record);
|
super(record);
|
||||||
|
this.recording = getRecordingFile(record);
|
||||||
String uuid = record.getUUID().toString();
|
|
||||||
File recordingFile = new File(HistoryAuthenticationProvider.getRecordingSearchPath(), uuid);
|
|
||||||
this.recording = recordingFile.canRead() ? recordingFile : null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -89,6 +89,37 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
'entry.remoteHost'
|
'entry.remoteHost'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The names of sortable properties supported by the REST API that
|
||||||
|
* correspond to the properties that may be stored within
|
||||||
|
* $scope.order.
|
||||||
|
*
|
||||||
|
* @type {!Object.<string, string>}
|
||||||
|
*/
|
||||||
|
const apiSortProperties = {
|
||||||
|
'entry.startDate' : 'startDate',
|
||||||
|
'-entry.startDate' : '-startDate'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given sort predicate to a correponding array of
|
||||||
|
* sortable properties supported by the REST API. Any properties
|
||||||
|
* within the predicate that are not supported will be dropped.
|
||||||
|
*
|
||||||
|
* @param {!string[]} predicate
|
||||||
|
* The sort predicate to convert, as exposed by the predicate
|
||||||
|
* property of SortOrder.
|
||||||
|
*
|
||||||
|
* @returns {!string[]}
|
||||||
|
* A corresponding array of sortable properties, omitting any
|
||||||
|
* properties not supported by the REST API.
|
||||||
|
*/
|
||||||
|
var toAPISortPredicate = function toAPISortPredicate(predicate) {
|
||||||
|
return predicate
|
||||||
|
.map((name) => apiSortProperties[name])
|
||||||
|
.filter((name) => !!name);
|
||||||
|
};
|
||||||
|
|
||||||
// Get session date format
|
// Get session date format
|
||||||
$translate('SETTINGS_CONNECTION_HISTORY.FORMAT_DATE')
|
$translate('SETTINGS_CONNECTION_HISTORY.FORMAT_DATE')
|
||||||
.then(function dateFormatReceived(retrievedDateFormat) {
|
.then(function dateFormatReceived(retrievedDateFormat) {
|
||||||
@@ -166,9 +197,7 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
historyService.getConnectionHistory(
|
historyService.getConnectionHistory(
|
||||||
$scope.dataSource,
|
$scope.dataSource,
|
||||||
requiredContents,
|
requiredContents,
|
||||||
$scope.order.predicate.filter(function isSupportedPredicate(predicate) {
|
toAPISortPredicate($scope.order.predicate)
|
||||||
return predicate === 'startDate' || predicate === '-startDate';
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
.then(function historyRetrieved(historyEntries) {
|
.then(function historyRetrieved(historyEntries) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user