| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 ); | 57 ); |
| 58 | 58 |
| 59 | 59 |
| 60 Loader.controller( | 60 Loader.controller( |
| 61 'Loader.Controller', | 61 'Loader.Controller', |
| 62 function($scope, $http, $filter, $location, $log, $timeout, constants) { | 62 function($scope, $http, $filter, $location, $log, $timeout, constants) { |
| 63 $scope.constants = constants; | 63 $scope.constants = constants; |
| 64 $scope.windowTitle = "Loading GM Results..."; | 64 $scope.windowTitle = "Loading GM Results..."; |
| 65 $scope.resultsToLoad = $location.search().resultsToLoad; | 65 $scope.resultsToLoad = $location.search().resultsToLoad; |
| 66 $scope.loadingMessage = "Loading results from '" + $scope.resultsToLoad + | 66 $scope.loadingMessage = "please wait..."; |
| 67 "', please wait..."; | |
| 68 | 67 |
| 69 /** | 68 /** |
| 70 * On initial page load, load a full dictionary of results. | 69 * On initial page load, load a full dictionary of results. |
| 71 * Once the dictionary is loaded, unhide the page elements so they can | 70 * Once the dictionary is loaded, unhide the page elements so they can |
| 72 * render the data. | 71 * render the data. |
| 73 */ | 72 */ |
| 74 $http.get($scope.resultsToLoad).success( | 73 $http.get($scope.resultsToLoad).success( |
| 75 function(data, status, header, config) { | 74 function(data, status, header, config) { |
| 76 var dataHeader = data[constants.KEY__HEADER]; | 75 var dataHeader = data[constants.KEY__HEADER]; |
| 77 if (dataHeader[constants.KEY__HEADER__IS_STILL_LOADING]) { | 76 if (dataHeader[constants.KEY__HEADER__SCHEMA_VERSION] != |
| 77 constants.REBASELINE_SERVER_SCHEMA_VERSION_NUMBER) { |
| 78 $scope.loadingMessage = "ERROR: Got JSON file with schema version " |
| 79 + dataHeader[constants.KEY__HEADER__SCHEMA_VERSION] |
| 80 + " but expected schema version " |
| 81 + constants.REBASELINE_SERVER_SCHEMA_VERSION_NUMBER; |
| 82 } else if (dataHeader[constants.KEY__HEADER__IS_STILL_LOADING]) { |
| 78 // Apply the server's requested reload delay to local time, | 83 // Apply the server's requested reload delay to local time, |
| 79 // so we will wait the right number of seconds regardless of clock | 84 // so we will wait the right number of seconds regardless of clock |
| 80 // skew between client and server. | 85 // skew between client and server. |
| 81 var reloadDelayInSeconds = | 86 var reloadDelayInSeconds = |
| 82 dataHeader[constants.KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE] - | 87 dataHeader[constants.KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE] - |
| 83 dataHeader[constants.KEY__HEADER__TIME_UPDATED]; | 88 dataHeader[constants.KEY__HEADER__TIME_UPDATED]; |
| 84 var timeNow = new Date().getTime(); | 89 var timeNow = new Date().getTime(); |
| 85 var timeToReload = timeNow + reloadDelayInSeconds * 1000; | 90 var timeToReload = timeNow + reloadDelayInSeconds * 1000; |
| 86 $scope.loadingMessage = | 91 $scope.loadingMessage = |
| 87 "Server is still loading results; will retry at " + | 92 "server is still loading results; will retry at " + |
| 88 $scope.localTimeString(timeToReload / 1000); | 93 $scope.localTimeString(timeToReload / 1000); |
| 89 $timeout( | 94 $timeout( |
| 90 function(){location.reload();}, | 95 function(){location.reload();}, |
| 91 timeToReload - timeNow); | 96 timeToReload - timeNow); |
| 92 } else if (dataHeader[constants.KEY__HEADER__SCHEMA_VERSION] != | |
| 93 constants.REBASELINE_SERVER_SCHEMA_VERSION_NUMBER) { | |
| 94 $scope.loadingMessage = "ERROR: Got JSON file with schema version " | |
| 95 + dataHeader[constants.KEY__HEADER__SCHEMA_VERSION] | |
| 96 + " but expected schema version " | |
| 97 + constants.REBASELINE_SERVER_SCHEMA_VERSION_NUMBER; | |
| 98 } else { | 97 } else { |
| 99 $scope.loadingMessage = "Processing data, please wait..."; | 98 $scope.loadingMessage = "processing data, please wait..."; |
| 100 | 99 |
| 101 $scope.header = dataHeader; | 100 $scope.header = dataHeader; |
| 102 $scope.extraColumnHeaders = data[constants.KEY__EXTRACOLUMNHEADERS]; | 101 $scope.extraColumnHeaders = data[constants.KEY__EXTRACOLUMNHEADERS]; |
| 103 $scope.imagePairs = data[constants.KEY__IMAGEPAIRS]; | 102 $scope.imagePairs = data[constants.KEY__IMAGEPAIRS]; |
| 104 $scope.imageSets = data[constants.KEY__IMAGESETS]; | 103 $scope.imageSets = data[constants.KEY__IMAGESETS]; |
| 105 $scope.sortColumnSubdict = constants.KEY__DIFFERENCE_DATA; | 104 $scope.sortColumnSubdict = constants.KEY__DIFFERENCE_DATA; |
| 106 $scope.sortColumnKey = constants.KEY__DIFFERENCE_DATA__WEIGHTED_DIFF; | 105 $scope.sortColumnKey = constants.KEY__DIFFERENCE_DATA__WEIGHTED_DIFF; |
| 107 | 106 |
| 108 $scope.showSubmitAdvancedSettings = false; | 107 $scope.showSubmitAdvancedSettings = false; |
| 109 $scope.submitAdvancedSettings = {}; | 108 $scope.submitAdvancedSettings = {}; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // If any defaults were overridden in the URL, get them now. | 164 // If any defaults were overridden in the URL, get them now. |
| 166 $scope.queryParameters.load(); | 165 $scope.queryParameters.load(); |
| 167 | 166 |
| 168 $scope.updateResults(); | 167 $scope.updateResults(); |
| 169 $scope.loadingMessage = ""; | 168 $scope.loadingMessage = ""; |
| 170 $scope.windowTitle = "Current GM Results"; | 169 $scope.windowTitle = "Current GM Results"; |
| 171 } | 170 } |
| 172 } | 171 } |
| 173 ).error( | 172 ).error( |
| 174 function(data, status, header, config) { | 173 function(data, status, header, config) { |
| 175 $scope.loadingMessage = "Failed to load results from '" | 174 $scope.loadingMessage = "FAILED to load."; |
| 176 + $scope.resultsToLoad + "'"; | |
| 177 $scope.windowTitle = "Failed to Load GM Results"; | 175 $scope.windowTitle = "Failed to Load GM Results"; |
| 178 } | 176 } |
| 179 ); | 177 ); |
| 180 | 178 |
| 181 | 179 |
| 182 // | 180 // |
| 183 // Select/Clear/Toggle all tests. | 181 // Select/Clear/Toggle all tests. |
| 184 // | 182 // |
| 185 | 183 |
| 186 /** | 184 /** |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 */ | 789 */ |
| 792 $scope.getImageDiffRelativeUrl = function(imagePair) { | 790 $scope.getImageDiffRelativeUrl = function(imagePair) { |
| 793 var before = | 791 var before = |
| 794 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + | 792 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + |
| 795 imagePair[constants.KEY__IMAGE_B_URL]; | 793 imagePair[constants.KEY__IMAGE_B_URL]; |
| 796 return before.replace(/[^\w\-]/g, "_") + ".png"; | 794 return before.replace(/[^\w\-]/g, "_") + ".png"; |
| 797 } | 795 } |
| 798 | 796 |
| 799 } | 797 } |
| 800 ); | 798 ); |
| OLD | NEW |