mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1140: Update sorting order when session column headers are clicked.
This commit is contained in:
@@ -202,47 +202,37 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the wrapped session list is sorted by username.
|
* Returns whether the wrapped session list is sorted by the given
|
||||||
|
* property.
|
||||||
|
*
|
||||||
|
* @param {String} property
|
||||||
|
* The name of the property to check.
|
||||||
*
|
*
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
* true if the wrapped session list is sorted by username, false
|
* true if the wrapped session list is sorted by the given property,
|
||||||
* otherwise.
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
$scope.sortedByUsername = function sortedByUsername() {
|
$scope.isSortedBy = function isSortedBy(property) {
|
||||||
return $scope.wrapperOrder.primary === 'activeConnection.username';
|
return $scope.wrapperOrder.primary === property;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the wrapped session list is sorted by start date.
|
* Sets the primary sorting property to the given property, if not already
|
||||||
|
* set. If already set, the ascending/descending sort order is toggled.
|
||||||
*
|
*
|
||||||
* @returns {Boolean}
|
* @param {String} property
|
||||||
* true if the wrapped session list is sorted by start date, false
|
* The name of the property to assign as the primary sorting property.
|
||||||
* otherwise.
|
|
||||||
*/
|
*/
|
||||||
$scope.sortedByStartDate = function sortedByStartDate() {
|
$scope.toggleSort = function toggleSort(property) {
|
||||||
return $scope.wrapperOrder.primary === 'activeConnection.startDate';
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// Sort in ascending order by new property, if different
|
||||||
* Returns whether the wrapped session list is sorted by remote host.
|
if (!$scope.isSortedBy(property))
|
||||||
*
|
$scope.wrapperOrder.reorder(property, false);
|
||||||
* @returns {Boolean}
|
|
||||||
* true if the wrapped session list is sorted by remote host, false
|
// Otherwise, toggle sort order
|
||||||
* otherwise.
|
else
|
||||||
*/
|
$scope.wrapperOrder.reorder(property, !$scope.wrapperOrder.descending);
|
||||||
$scope.sortedByRemoteHost = function sortedByRemoteHost() {
|
|
||||||
return $scope.wrapperOrder.primary === 'activeConnection.remoteHost';
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the wrapped session list is sorted by connection name.
|
|
||||||
*
|
|
||||||
* @returns {Boolean}
|
|
||||||
* true if the wrapped session list is sorted by connection name, false
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
$scope.sortedByConnectionName = function sortedByConnectionName() {
|
|
||||||
return $scope.wrapperOrder.primary === 'name';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -44,6 +44,14 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.manage table.session-list th {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.manage table.session-list th.select-session {
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.manage table.session-list th.sort-primary {
|
.manage table.session-list th.sort-primary {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
@@ -41,16 +41,20 @@ THE SOFTWARE.
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="select-session"></th>
|
<th class="select-session"></th>
|
||||||
<th ng-class="{'sort-primary': sortedByUsername(), 'sort-descending': wrapperOrder.descending}">
|
<th ng-class="{'sort-primary': isSortedBy('activeConnection.username'), 'sort-descending': wrapperOrder.descending}"
|
||||||
|
ng-click="toggleSort('activeConnection.username')">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_USERNAME' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_USERNAME' | translate}}
|
||||||
</th>
|
</th>
|
||||||
<th ng-class="{'sort-primary': sortedByStartDate(), 'sort-descending': wrapperOrder.descending}">
|
<th ng-class="{'sort-primary': isSortedBy('activeConnection.startDate'), 'sort-descending': wrapperOrder.descending}"
|
||||||
|
ng-click="toggleSort('activeConnection.startDate')">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_STARTDATE' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_STARTDATE' | translate}}
|
||||||
</th>
|
</th>
|
||||||
<th ng-class="{'sort-primary': sortedByRemoteHost(), 'sort-descending': wrapperOrder.descending}">
|
<th ng-class="{'sort-primary': isSortedBy('activeConnection.remoteHost'), 'sort-descending': wrapperOrder.descending}"
|
||||||
|
ng-click="toggleSort('activeConnection.remoteHost')">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_REMOTEHOST' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_REMOTEHOST' | translate}}
|
||||||
</th>
|
</th>
|
||||||
<th ng-class="{'sort-primary': sortedByConnectionName(), 'sort-descending': wrapperOrder.descending}">
|
<th ng-class="{'sort-primary': isSortedBy('name'), 'sort-descending': wrapperOrder.descending}"
|
||||||
|
ng-click="toggleSort('name')">
|
||||||
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_CONNECTION_NAME' | translate}}
|
{{'MANAGE_SESSION.TABLE_HEADER_SESSION_CONNECTION_NAME' | translate}}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
Reference in New Issue
Block a user