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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 [constants.KEY__VALUES_AND_COUNTS]); | 157 [constants.KEY__VALUES_AND_COUNTS]); |
158 | 158 |
159 // Associative array of partial string matches per category. | 159 // Associative array of partial string matches per category. |
160 $scope.categoryValueMatch = {}; | 160 $scope.categoryValueMatch = {}; |
161 $scope.categoryValueMatch.builder = ""; | 161 $scope.categoryValueMatch.builder = ""; |
162 $scope.categoryValueMatch.test = ""; | 162 $scope.categoryValueMatch.test = ""; |
163 | 163 |
164 // If any defaults were overridden in the URL, get them now. | 164 // If any defaults were overridden in the URL, get them now. |
165 $scope.queryParameters.load(); | 165 $scope.queryParameters.load(); |
166 | 166 |
| 167 // Any image URLs which are relative should be relative to the JSON |
| 168 // file's source directory; absolute URLs should be left alone. |
| 169 var baseUrlKey = constants.KEY__IMAGESETS__FIELD__BASE_URL; |
| 170 angular.forEach( |
| 171 $scope.imageSets, |
| 172 function(imageSet) { |
| 173 var baseUrl = imageSet[baseUrlKey]; |
| 174 if ((baseUrl.substring(0, 1) != '/') && |
| 175 (baseUrl.indexOf('://') == -1)) { |
| 176 imageSet[baseUrlKey] = $scope.resultsToLoad + '/../' + baseUrl; |
| 177 } |
| 178 } |
| 179 ); |
| 180 |
167 $scope.updateResults(); | 181 $scope.updateResults(); |
168 $scope.loadingMessage = ""; | 182 $scope.loadingMessage = ""; |
169 $scope.windowTitle = "Current GM Results"; | 183 $scope.windowTitle = "Current GM Results"; |
170 } | 184 } |
171 } | 185 } |
172 ).error( | 186 ).error( |
173 function(data, status, header, config) { | 187 function(data, status, header, config) { |
174 $scope.loadingMessage = "FAILED to load."; | 188 $scope.loadingMessage = "FAILED to load."; |
175 $scope.windowTitle = "Failed to Load GM Results"; | 189 $scope.windowTitle = "Failed to Load GM Results"; |
176 } | 190 } |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 */ | 803 */ |
790 $scope.getImageDiffRelativeUrl = function(imagePair) { | 804 $scope.getImageDiffRelativeUrl = function(imagePair) { |
791 var before = | 805 var before = |
792 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + | 806 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + |
793 imagePair[constants.KEY__IMAGE_B_URL]; | 807 imagePair[constants.KEY__IMAGE_B_URL]; |
794 return before.replace(/[^\w\-]/g, "_") + ".png"; | 808 return before.replace(/[^\w\-]/g, "_") + ".png"; |
795 } | 809 } |
796 | 810 |
797 } | 811 } |
798 ); | 812 ); |
OLD | NEW |