From 77804b2a9dd3f0b8ac1479497cc40af683a8da4a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 15 Nov 2015 20:19:31 -0800 Subject: [PATCH] GUAC-1373: Define sorting only by start date. --- .../connection/ConnectionRecordMapper.xml | 20 ++++--------------- .../connection/ConnectionRecordMapper.xml | 20 ++++--------------- .../net/auth/ConnectionRecordSet.java | 20 +------------------ .../APIConnectionRecordSortPredicate.java | 20 +------------------ .../app/rest/types/ConnectionHistoryEntry.js | 20 +------------------ .../guacSettingsConnectionHistory.js | 4 +++- 6 files changed, 14 insertions(+), 90 deletions(-) diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml index f6b6698a9..4c75a2b19 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml @@ -86,8 +86,8 @@ guacamole_connection_history.start_date, guacamole_connection_history.end_date FROM guacamole_connection_history - JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id - JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id + LEFT JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id + LEFT JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id - - - - guacamole_connection.connection_name - guacamole_user.username guacamole_connection_history.start_date - guacamole_connection_history.end_date 1 DESC @@ -150,8 +144,8 @@ guacamole_connection_history.start_date, guacamole_connection_history.end_date FROM guacamole_connection_history - JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id - JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id + LEFT JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id + LEFT JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id JOIN guacamole_connection_permission ON @@ -193,19 +187,13 @@ - - - - guacamole_connection.connection_name - guacamole_user.username guacamole_connection_history.start_date - guacamole_connection_history.end_date 1 DESC diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml index b3a23eadc..1e85610de 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/glyptodon/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml @@ -86,8 +86,8 @@ guacamole_connection_history.start_date, guacamole_connection_history.end_date FROM guacamole_connection_history - JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id - JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id + LEFT JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id + LEFT JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id - - - - guacamole_connection.connection_name - guacamole_user.username guacamole_connection_history.start_date - guacamole_connection_history.end_date 1 DESC @@ -150,8 +144,8 @@ guacamole_connection_history.start_date, guacamole_connection_history.end_date FROM guacamole_connection_history - JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id - JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id + LEFT JOIN guacamole_connection ON guacamole_connection_history.connection_id = guacamole_connection.connection_id + LEFT JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id JOIN guacamole_connection_permission ON @@ -193,19 +187,13 @@ - - - - guacamole_connection.connection_name - guacamole_user.username guacamole_connection_history.start_date - guacamole_connection_history.end_date 1 DESC diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecordSet.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecordSet.java index ef6f9c336..691764485 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecordSet.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/ConnectionRecordSet.java @@ -39,29 +39,11 @@ public interface ConnectionRecordSet { */ enum SortableProperty { - /** - * The name (not identifier) of the connection associated with the - * connection record. - */ - CONNECTION_NAME, - - /** - * The identifier (username) of the user that used the connection - * associated with the connection record. - */ - USER_IDENTIFIER, - /** * The date and time when the connection associated with the * connection record began. */ - START_DATE, - - /** - * The date and time when the connection associated with the - * connection record ended. - */ - END_DATE + START_DATE }; diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecordSortPredicate.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecordSortPredicate.java index 17872d77d..df3dec58c 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecordSortPredicate.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/history/APIConnectionRecordSortPredicate.java @@ -46,29 +46,11 @@ public class APIConnectionRecordSortPredicate { */ public enum SortableProperty { - /** - * The name (not identifier) of the connection associated with the - * connection record. - */ - connectionName(ConnectionRecordSet.SortableProperty.CONNECTION_NAME), - - /** - * The username (identifier) of the user associated with the connection - * record. - */ - username(ConnectionRecordSet.SortableProperty.USER_IDENTIFIER), - /** * The date that the connection associated with the connection record * began (connected). */ - startDate(ConnectionRecordSet.SortableProperty.START_DATE), - - /** - * The date that the connection associated with the connection record - * ended (disconnected). - */ - endDate(ConnectionRecordSet.SortableProperty.END_DATE); + startDate(ConnectionRecordSet.SortableProperty.START_DATE); /** * The ConnectionRecordSet.SortableProperty that this property name diff --git a/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js b/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js index 7e892538c..b3b6c7de5 100644 --- a/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js +++ b/guacamole/src/main/webapp/app/rest/types/ConnectionHistoryEntry.js @@ -110,29 +110,11 @@ angular.module('rest').factory('ConnectionHistoryEntry', [function defineConnect */ ConnectionHistoryEntry.SortPredicate = { - /** - * The name of the connection associated with the history entry (not - * the connection identifier). - */ - CONNECTION_NAME : 'connectionName', - - /** - * The username of the user associated with the history entry (the user - * identifier). - */ - USER_IDENTIFIER : 'username', - /** * The date and time that the connection associated with the history * entry began (connected). */ - START_DATE : 'startDate', - - /** - * The date and time that the connection associated with the history - * entry ended (disconnected). - */ - END_DATE : 'endDate' + START_DATE : 'startDate' }; diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnectionHistory.js b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnectionHistory.js index 3e6dbd298..f26f1e6d2 100644 --- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnectionHistory.js +++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnectionHistory.js @@ -164,7 +164,9 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function historyService.getConnectionHistory( $scope.dataSource, requiredContents, - $scope.order.predicate + $scope.order.predicate.filter(function isSupportedPredicate(predicate) { + return predicate === 'startDate' || predicate === '-startDate'; + }) ) .success(function historyRetrieved(historyRecords) {