mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-1138: Rename StableSort to SortOrder.
This commit is contained in:
		| @@ -22,7 +22,7 @@ | |||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Updates the priority of the sorting property given by "guac-sort-property" |  * Updates the priority of the sorting property given by "guac-sort-property" | ||||||
|  * within the StableSort object given by "guac-sort-order". The CSS classes |  * within the SortOrder object given by "guac-sort-order". The CSS classes | ||||||
|  * "sort-primary" and "sort-descending" will be applied to the associated |  * "sort-primary" and "sort-descending" will be applied to the associated | ||||||
|  * element depending on the priority and sort direction of the given property. |  * element depending on the priority and sort direction of the given property. | ||||||
|  *  |  *  | ||||||
| @@ -39,7 +39,7 @@ angular.module('list').directive('guacSortOrder', [function guacFocus() { | |||||||
|             /** |             /** | ||||||
|              * The object defining the sorting order. |              * The object defining the sorting order. | ||||||
|              * |              * | ||||||
|              * @type StableSort |              * @type SortOrder | ||||||
|              */ |              */ | ||||||
|             var sortOrder = $scope.$eval($attrs.guacSortOrder); |             var sortOrder = $scope.$eval($attrs.guacSortOrder); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,10 +21,10 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * A service for defining the StableSort class. |  * A service for defining the SortOrder class. | ||||||
|  */ |  */ | ||||||
| angular.module('list').factory('StableSort', [ | angular.module('list').factory('SortOrder', [ | ||||||
|     function defineStableSort() { |     function defineSortOrder() { | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Maintains a sorting predicate as required by the Angular orderBy filter. |      * Maintains a sorting predicate as required by the Angular orderBy filter. | ||||||
| @@ -35,14 +35,14 @@ angular.module('list').factory('StableSort', [ | |||||||
|      * @param {String[]} predicate |      * @param {String[]} predicate | ||||||
|      *     The properties to sort by, in order of precidence. |      *     The properties to sort by, in order of precidence. | ||||||
|      */ |      */ | ||||||
|     var StableSort = function StableSort(predicate) { |     var SortOrder = function SortOrder(predicate) { | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|          * Reference to this instance. |          * Reference to this instance. | ||||||
|          * |          * | ||||||
|          * @type StableSort |          * @type SortOrder | ||||||
|          */ |          */ | ||||||
|         var stableSort = this; |         var sortOrder = this; | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|          * The current sorting predicate. |          * The current sorting predicate. | ||||||
| @@ -91,20 +91,20 @@ angular.module('list').factory('StableSort', [ | |||||||
|             var descendingName = '-' + name; |             var descendingName = '-' + name; | ||||||
| 
 | 
 | ||||||
|             // Remove requested property from current predicate
 |             // Remove requested property from current predicate
 | ||||||
|             stableSort.predicate = stableSort.predicate.filter(function notRequestedProperty(current) { |             sortOrder.predicate = sortOrder.predicate.filter(function notRequestedProperty(current) { | ||||||
|                 return current !== ascendingName |                 return current !== ascendingName | ||||||
|                     && current !== descendingName; |                     && current !== descendingName; | ||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
|             // Add property to beginning of predicate
 |             // Add property to beginning of predicate
 | ||||||
|             if (descending) |             if (descending) | ||||||
|                 stableSort.predicate.unshift(descendingName); |                 sortOrder.predicate.unshift(descendingName); | ||||||
|             else |             else | ||||||
|                 stableSort.predicate.unshift(ascendingName); |                 sortOrder.predicate.unshift(ascendingName); | ||||||
| 
 | 
 | ||||||
|             // Update sorted state
 |             // Update sorted state
 | ||||||
|             stableSort.primary    = name; |             sortOrder.primary    = name; | ||||||
|             stableSort.descending = !!descending; |             sortOrder.descending = !!descending; | ||||||
| 
 | 
 | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
| @@ -120,7 +120,7 @@ angular.module('list').factory('StableSort', [ | |||||||
|          *     property, false otherwise. |          *     property, false otherwise. | ||||||
|          */ |          */ | ||||||
|         this.isSortedBy = function isSortedBy(property) { |         this.isSortedBy = function isSortedBy(property) { | ||||||
|             return stableSort.primary === property; |             return sortOrder.primary === property; | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
| @@ -133,17 +133,17 @@ angular.module('list').factory('StableSort', [ | |||||||
|         this.togglePrimary = function togglePrimary(property) { |         this.togglePrimary = function togglePrimary(property) { | ||||||
| 
 | 
 | ||||||
|             // Sort in ascending order by new property, if different
 |             // Sort in ascending order by new property, if different
 | ||||||
|             if (!stableSort.isSortedBy(property)) |             if (!sortOrder.isSortedBy(property)) | ||||||
|                 stableSort.reorder(property, false); |                 sortOrder.reorder(property, false); | ||||||
| 
 | 
 | ||||||
|             // Otherwise, toggle sort order
 |             // Otherwise, toggle sort order
 | ||||||
|             else |             else | ||||||
|                 stableSort.reorder(property, !stableSort.descending); |                 sortOrder.reorder(property, !sortOrder.descending); | ||||||
| 
 | 
 | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     return StableSort; |     return SortOrder; | ||||||
| 
 | 
 | ||||||
| }]); | }]); | ||||||
| @@ -29,7 +29,7 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj | |||||||
|     // Required types |     // Required types | ||||||
|     var ActiveConnectionWrapper = $injector.get('ActiveConnectionWrapper'); |     var ActiveConnectionWrapper = $injector.get('ActiveConnectionWrapper'); | ||||||
|     var ConnectionGroup         = $injector.get('ConnectionGroup'); |     var ConnectionGroup         = $injector.get('ConnectionGroup'); | ||||||
|     var StableSort              = $injector.get('StableSort'); |     var SortOrder               = $injector.get('SortOrder'); | ||||||
|  |  | ||||||
|     // Required services |     // Required services | ||||||
|     var activeConnectionService = $injector.get('activeConnectionService'); |     var activeConnectionService = $injector.get('activeConnectionService'); | ||||||
| @@ -55,12 +55,12 @@ angular.module('manage').controller('manageSessionsController', ['$scope', '$inj | |||||||
|     $scope.wrappers = null; |     $scope.wrappers = null; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * StableSort instance which maintains the sort order of the visible |      * SortOrder instance which maintains the sort order of the visible | ||||||
|      * connection wrappers. |      * connection wrappers. | ||||||
|      * |      * | ||||||
|      * @type StableSort |      * @type SortOrder | ||||||
|      */ |      */ | ||||||
|     $scope.wrapperOrder = new StableSort([ |     $scope.wrapperOrder = new SortOrder([ | ||||||
|         'activeConnection.username', |         'activeConnection.username', | ||||||
|         'activeConnection.startDate', |         'activeConnection.startDate', | ||||||
|         'activeConnection.remoteHost', |         'activeConnection.remoteHost', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user