Merge pull request #279 from glyptodon/history-usability

GUAC-1193: Improve history search usability
This commit is contained in:
James Muehlner
2015-10-17 12:24:17 -07:00
3 changed files with 23 additions and 7 deletions

View File

@@ -211,8 +211,9 @@ angular.module('navigation').factory('userPageService', ['$injector',
// Permission to administer users // Permission to administer users
|| PermissionSet.hasUserPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER) || PermissionSet.hasUserPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER)
) ) {
canManageUsers.push(dataSource); canManageUsers.push(dataSource);
}
// Determine whether the current user needs access to the connection management UI // Determine whether the current user needs access to the connection management UI
if ( if (
@@ -232,16 +233,18 @@ angular.module('navigation').factory('userPageService', ['$injector',
// Permission to administer connections or connection groups // Permission to administer connections or connection groups
|| PermissionSet.hasConnectionPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER) || PermissionSet.hasConnectionPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER)
|| PermissionSet.hasConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER) || PermissionSet.hasConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.ADMINISTER)
) ) {
canManageConnections.push(dataSource); canManageConnections.push(dataSource);
}
// Determine whether the current user needs access to the session management UI or view connection history // Determine whether the current user needs access to the session management UI or view connection history
if ( if (
// A user must be a system administrator to manage sessions // A user must be a system administrator to manage sessions
PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER) PermissionSet.hasSystemPermission(permissions, PermissionSet.SystemPermissionType.ADMINISTER)
) ) {
canManageSessions.push(dataSource); canManageSessions.push(dataSource);
canViewConnectionRecords.push(dataSource); canViewConnectionRecords.push(dataSource);
}
}); });

View File

@@ -110,7 +110,20 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
return $scope.historyRecords !== null return $scope.historyRecords !== null
&& $scope.dateFormat !== null; && $scope.dateFormat !== null;
}; };
/**
* Returns whether the search has completed but contains no history
* records. This function will return false if there are history
* records in the results OR if the search has not yet completed.
*
* @returns {Boolean}
* true if the search results have been loaded but no history
* records are present, false otherwise.
*/
$scope.isHistoryEmpty = function isHistoryEmpty() {
return $scope.isLoaded() && $scope.historyRecords.length === 0;
};
/** /**
* Query the API for the connection record history, filtered by * Query the API for the connection record history, filtered by
* searchString, and ordered by order. * searchString, and ordered by order.

View File

@@ -31,7 +31,7 @@
</form> </form>
<!-- Search results --> <!-- Search results -->
<div class="results" ng-class="{loading: !isLoaded()}"> <div class="results">
<!-- List of matching history records --> <!-- List of matching history records -->
<table class="sorted history-list"> <table class="sorted history-list">
@@ -51,7 +51,7 @@
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody ng-class="{loading: !isLoaded()}">
<tr ng-repeat="historyRecord in historyRecordPage" class="history"> <tr ng-repeat="historyRecord in historyRecordPage" class="history">
<td>{{historyRecord.username}}</td> <td>{{historyRecord.username}}</td>
<td>{{historyRecord.startDate | date : dateFormat}}</td> <td>{{historyRecord.startDate | date : dateFormat}}</td>
@@ -62,7 +62,7 @@
</table> </table>
<!-- Text displayed if no history exists --> <!-- Text displayed if no history exists -->
<p class="placeholder" ng-hide="historyRecordPage.length"> <p class="placeholder" ng-show="isHistoryEmpty()">
{{'SETTINGS_CONNECTION_HISTORY.INFO_NO_HISTORY' | translate}} {{'SETTINGS_CONNECTION_HISTORY.INFO_NO_HISTORY' | translate}}
</p> </p>