OLD | NEW |
1 /* | 1 /* |
2 * Loader: | 2 * Loader: |
3 * Reads GM result reports written out by results.py, and imports | 3 * Reads GM result reports written out by results.py, and imports |
4 * them into $scope.extraColumnHeaders and $scope.imagePairs . | 4 * them into $scope.extraColumnHeaders and $scope.imagePairs . |
5 */ | 5 */ |
6 var Loader = angular.module( | 6 var Loader = angular.module( |
7 'Loader', | 7 'Loader', |
8 ['ConstantsModule'] | 8 ['ConstantsModule'] |
9 ); | 9 ); |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 function($scope, $http, $filter, $location, $log, $timeout, constants) { | 126 function($scope, $http, $filter, $location, $log, $timeout, constants) { |
127 $scope.readyToDisplay = false; | 127 $scope.readyToDisplay = false; |
128 $scope.constants = constants; | 128 $scope.constants = constants; |
129 $scope.windowTitle = "Loading GM Results..."; | 129 $scope.windowTitle = "Loading GM Results..."; |
130 $scope.setADir = $location.search().setADir; | 130 $scope.setADir = $location.search().setADir; |
131 $scope.setASection = $location.search().setASection; | 131 $scope.setASection = $location.search().setASection; |
132 $scope.setBDir = $location.search().setBDir; | 132 $scope.setBDir = $location.search().setBDir; |
133 $scope.setBSection = $location.search().setBSection; | 133 $scope.setBSection = $location.search().setBSection; |
134 $scope.loadingMessage = "please wait..."; | 134 $scope.loadingMessage = "please wait..."; |
135 | 135 |
| 136 var currSortAsc = true; |
| 137 |
| 138 |
136 /** | 139 /** |
137 * On initial page load, load a full dictionary of results. | 140 * On initial page load, load a full dictionary of results. |
138 * Once the dictionary is loaded, unhide the page elements so they can | 141 * Once the dictionary is loaded, unhide the page elements so they can |
139 * render the data. | 142 * render the data. |
140 */ | 143 */ |
141 var liveQueryUrl = | 144 var liveQueryUrl = |
142 "/live-results/setADir=" + encodeURIComponent($scope.setADir) + | 145 "/live-results/setADir=" + encodeURIComponent($scope.setADir) + |
143 "&setASection=" + encodeURIComponent($scope.setASection) + | 146 "&setASection=" + encodeURIComponent($scope.setASection) + |
144 "&setBDir=" + encodeURIComponent($scope.setBDir) + | 147 "&setBDir=" + encodeURIComponent($scope.setBDir) + |
145 "&setBSection=" + encodeURIComponent($scope.setBSection); | 148 "&setBSection=" + encodeURIComponent($scope.setBSection); |
(...skipping 22 matching lines...) Expand all Loading... |
168 function(){location.reload();}, | 171 function(){location.reload();}, |
169 timeToReload - timeNow); | 172 timeToReload - timeNow); |
170 } else { | 173 } else { |
171 $scope.loadingMessage = "processing data, please wait..."; | 174 $scope.loadingMessage = "processing data, please wait..."; |
172 | 175 |
173 $scope.header = dataHeader; | 176 $scope.header = dataHeader; |
174 $scope.extraColumnHeaders = data[constants.KEY__ROOT__EXTRACOLUMNHEADE
RS]; | 177 $scope.extraColumnHeaders = data[constants.KEY__ROOT__EXTRACOLUMNHEADE
RS]; |
175 $scope.orderedColumnNames = data[constants.KEY__ROOT__EXTRACOLUMNORDER
]; | 178 $scope.orderedColumnNames = data[constants.KEY__ROOT__EXTRACOLUMNORDER
]; |
176 $scope.imagePairs = data[constants.KEY__ROOT__IMAGEPAIRS]; | 179 $scope.imagePairs = data[constants.KEY__ROOT__IMAGEPAIRS]; |
177 $scope.imageSets = data[constants.KEY__ROOT__IMAGESETS]; | 180 $scope.imageSets = data[constants.KEY__ROOT__IMAGESETS]; |
| 181 |
| 182 // set the default sort column and make it ascending. |
178 $scope.sortColumnSubdict = constants.KEY__IMAGEPAIRS__DIFFERENCES; | 183 $scope.sortColumnSubdict = constants.KEY__IMAGEPAIRS__DIFFERENCES; |
179 $scope.sortColumnKey = constants.KEY__DIFFERENCES__PERCEPTUAL_DIFF; | 184 $scope.sortColumnKey = constants.KEY__DIFFERENCES__PERCEPTUAL_DIFF; |
| 185 currSortAsc = true; |
180 | 186 |
181 $scope.showSubmitAdvancedSettings = false; | 187 $scope.showSubmitAdvancedSettings = false; |
182 $scope.submitAdvancedSettings = {}; | 188 $scope.submitAdvancedSettings = {}; |
183 $scope.submitAdvancedSettings[ | 189 $scope.submitAdvancedSettings[ |
184 constants.KEY__EXPECTATIONS__REVIEWED] = true; | 190 constants.KEY__EXPECTATIONS__REVIEWED] = true; |
185 $scope.submitAdvancedSettings[ | 191 $scope.submitAdvancedSettings[ |
186 constants.KEY__EXPECTATIONS__IGNOREFAILURE] = false; | 192 constants.KEY__EXPECTATIONS__IGNOREFAILURE] = false; |
187 $scope.submitAdvancedSettings['bug'] = ''; | 193 $scope.submitAdvancedSettings['bug'] = ''; |
188 | 194 |
189 // Create the list of tabs (lists into which the user can file each | 195 // Create the list of tabs (lists into which the user can file each |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 609 } |
604 } | 610 } |
605 ); | 611 ); |
606 | 612 |
607 // TODO(epoger): Every time we apply a filter, AngularJS creates | 613 // TODO(epoger): Every time we apply a filter, AngularJS creates |
608 // another copy of the array. Is there a way we can filter out | 614 // another copy of the array. Is there a way we can filter out |
609 // the imagePairs as they are displayed, rather than storing multiple | 615 // the imagePairs as they are displayed, rather than storing multiple |
610 // array copies? (For better performance.) | 616 // array copies? (For better performance.) |
611 | 617 |
612 if ($scope.viewingTab == $scope.defaultTab) { | 618 if ($scope.viewingTab == $scope.defaultTab) { |
613 | 619 var doReverse = !currSortAsc; |
614 // TODO(epoger): Until we allow the user to reverse sort order, | |
615 // there are certain columns we want to sort in a different order. | |
616 var doReverse = ( | |
617 ($scope.sortColumnKey == | |
618 constants.KEY__DIFFERENCES__PERCENT_DIFF_PIXELS) || | |
619 ($scope.sortColumnKey == | |
620 constants.KEY__DIFFERENCES__PERCEPTUAL_DIFF)); | |
621 | 620 |
622 $scope.filteredImagePairs = | 621 $scope.filteredImagePairs = |
623 $filter("orderBy")( | 622 $filter("orderBy")( |
624 $filter("removeHiddenImagePairs")( | 623 $filter("removeHiddenImagePairs")( |
625 $scope.imagePairs, | 624 $scope.imagePairs, |
626 $scope.filterableColumnNames, | 625 $scope.filterableColumnNames, |
627 $scope.showingColumnValues, | 626 $scope.showingColumnValues, |
628 $scope.viewingTab | 627 $scope.viewingTab |
629 ), | 628 ), |
630 [$scope.getSortColumnValue, $scope.getSecondOrderSortValue], | 629 [$scope.getSortColumnValue, $scope.getSecondOrderSortValue], |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 */ | 1031 */ |
1033 $scope.getImageDiffRelativeUrl = function(imagePair) { | 1032 $scope.getImageDiffRelativeUrl = function(imagePair) { |
1034 var before = | 1033 var before = |
1035 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_A_URL] + "-vs-" + | 1034 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_A_URL] + "-vs-" + |
1036 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_B_URL]; | 1035 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_B_URL]; |
1037 return before.replace(/[^\w\-]/g, "_") + ".png"; | 1036 return before.replace(/[^\w\-]/g, "_") + ".png"; |
1038 } | 1037 } |
1039 | 1038 |
1040 } | 1039 } |
1041 ); | 1040 ); |
OLD | NEW |