| 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', 'diff_viewer'] | 8 ['ConstantsModule', 'diff_viewer'] |
| 9 ); | 9 ); |
| 10 | 10 |
| 11 Loader.directive( |
| 12 'resultsUpdatedCallbackDirective', |
| 13 ['$timeout', |
| 14 function($timeout) { |
| 15 return function(scope, element, attrs) { |
| 16 if (scope.$last) { |
| 17 $timeout(function() { |
| 18 scope.resultsUpdatedCallback(); |
| 19 }); |
| 20 } |
| 21 }; |
| 22 } |
| 23 ] |
| 24 ); |
| 25 |
| 11 // TODO(epoger): Combine ALL of our filtering operations (including | 26 // TODO(epoger): Combine ALL of our filtering operations (including |
| 12 // truncation) into this one filter, so that runs most efficiently? | 27 // truncation) into this one filter, so that runs most efficiently? |
| 13 // (We would have to make sure truncation still took place after | 28 // (We would have to make sure truncation still took place after |
| 14 // sorting, though.) | 29 // sorting, though.) |
| 15 Loader.filter( | 30 Loader.filter( |
| 16 'removeHiddenImagePairs', | 31 'removeHiddenImagePairs', |
| 17 function(constants) { | 32 function(constants) { |
| 18 return function(unfilteredImagePairs, hiddenResultTypes, hiddenConfigs, | 33 return function(unfilteredImagePairs, hiddenResultTypes, hiddenConfigs, |
| 19 builderSubstring, testSubstring, viewingTab) { | 34 builderSubstring, testSubstring, viewingTab) { |
| 20 var filteredImagePairs = []; | 35 var filteredImagePairs = []; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 } | 52 } |
| 38 } | 53 } |
| 39 return filteredImagePairs; | 54 return filteredImagePairs; |
| 40 }; | 55 }; |
| 41 } | 56 } |
| 42 ); | 57 ); |
| 43 | 58 |
| 44 | 59 |
| 45 Loader.controller( | 60 Loader.controller( |
| 46 'Loader.Controller', | 61 'Loader.Controller', |
| 47 function($scope, $http, $filter, $location, $timeout, constants) { | 62 function($scope, $http, $filter, $location, $log, $timeout, constants) { |
| 48 $scope.constants = constants; | 63 $scope.constants = constants; |
| 49 $scope.windowTitle = "Loading GM Results..."; | 64 $scope.windowTitle = "Loading GM Results..."; |
| 50 $scope.resultsToLoad = $location.search().resultsToLoad; | 65 $scope.resultsToLoad = $location.search().resultsToLoad; |
| 51 $scope.loadingMessage = "Loading results of type '" + $scope.resultsToLoad + | 66 $scope.loadingMessage = "Loading results of type '" + $scope.resultsToLoad + |
| 52 "', please wait..."; | 67 "', please wait..."; |
| 53 | 68 |
| 54 /** | 69 /** |
| 55 * On initial page load, load a full dictionary of results. | 70 * On initial page load, load a full dictionary of results. |
| 56 * Once the dictionary is loaded, unhide the page elements so they can | 71 * Once the dictionary is loaded, unhide the page elements so they can |
| 57 * render the data. | 72 * render the data. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 70 * 1000) - new Date().getTime()); | 85 * 1000) - new Date().getTime()); |
| 71 } else { | 86 } else { |
| 72 $scope.loadingMessage = "Processing data, please wait..."; | 87 $scope.loadingMessage = "Processing data, please wait..."; |
| 73 | 88 |
| 74 $scope.header = dataHeader; | 89 $scope.header = dataHeader; |
| 75 $scope.extraColumnHeaders = data[constants.KEY__EXTRACOLUMNHEADERS]; | 90 $scope.extraColumnHeaders = data[constants.KEY__EXTRACOLUMNHEADERS]; |
| 76 $scope.imagePairs = data[constants.KEY__IMAGEPAIRS]; | 91 $scope.imagePairs = data[constants.KEY__IMAGEPAIRS]; |
| 77 $scope.imageSets = data[constants.KEY__IMAGESETS]; | 92 $scope.imageSets = data[constants.KEY__IMAGESETS]; |
| 78 $scope.sortColumnSubdict = constants.KEY__DIFFERENCE_DATA; | 93 $scope.sortColumnSubdict = constants.KEY__DIFFERENCE_DATA; |
| 79 $scope.sortColumnKey = constants.KEY__DIFFERENCE_DATA__WEIGHTED_DIFF; | 94 $scope.sortColumnKey = constants.KEY__DIFFERENCE_DATA__WEIGHTED_DIFF; |
| 80 $scope.showTodos = false; | |
| 81 | 95 |
| 82 $scope.showSubmitAdvancedSettings = false; | 96 $scope.showSubmitAdvancedSettings = false; |
| 83 $scope.submitAdvancedSettings = {}; | 97 $scope.submitAdvancedSettings = {}; |
| 84 $scope.submitAdvancedSettings[ | 98 $scope.submitAdvancedSettings[ |
| 85 constants.KEY__EXPECTATIONS__REVIEWED] = true; | 99 constants.KEY__EXPECTATIONS__REVIEWED] = true; |
| 86 $scope.submitAdvancedSettings[ | 100 $scope.submitAdvancedSettings[ |
| 87 constants.KEY__EXPECTATIONS__IGNOREFAILURE] = false; | 101 constants.KEY__EXPECTATIONS__IGNOREFAILURE] = false; |
| 88 $scope.submitAdvancedSettings['bug'] = ''; | 102 $scope.submitAdvancedSettings['bug'] = ''; |
| 89 | 103 |
| 90 // Create the list of tabs (lists into which the user can file each | 104 // Create the list of tabs (lists into which the user can file each |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 $scope.setUpdatesPending = function(val) { | 364 $scope.setUpdatesPending = function(val) { |
| 351 $scope.areUpdatesPending = val; | 365 $scope.areUpdatesPending = val; |
| 352 } | 366 } |
| 353 | 367 |
| 354 /** | 368 /** |
| 355 * Update the displayed results, based on filters/settings, | 369 * Update the displayed results, based on filters/settings, |
| 356 * and call $scope.queryParameters.save() so that the new filter results | 370 * and call $scope.queryParameters.save() so that the new filter results |
| 357 * can be bookmarked. | 371 * can be bookmarked. |
| 358 */ | 372 */ |
| 359 $scope.updateResults = function() { | 373 $scope.updateResults = function() { |
| 374 $scope.renderStartTime = window.performance.now(); |
| 375 $log.debug("renderStartTime: " + $scope.renderStartTime); |
| 360 $scope.displayLimit = $scope.displayLimitPending; | 376 $scope.displayLimit = $scope.displayLimitPending; |
| 361 // TODO(epoger): Every time we apply a filter, AngularJS creates | 377 // TODO(epoger): Every time we apply a filter, AngularJS creates |
| 362 // another copy of the array. Is there a way we can filter out | 378 // another copy of the array. Is there a way we can filter out |
| 363 // the imagePairs as they are displayed, rather than storing multiple | 379 // the imagePairs as they are displayed, rather than storing multiple |
| 364 // array copies? (For better performance.) | 380 // array copies? (For better performance.) |
| 365 | 381 |
| 366 if ($scope.viewingTab == $scope.defaultTab) { | 382 if ($scope.viewingTab == $scope.defaultTab) { |
| 367 | 383 |
| 368 // TODO(epoger): Until we allow the user to reverse sort order, | 384 // TODO(epoger): Until we allow the user to reverse sort order, |
| 369 // there are certain columns we want to sort in a different order. | 385 // there are certain columns we want to sort in a different order. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 397 $scope.getSortColumnValue); | 413 $scope.getSortColumnValue); |
| 398 $scope.limitedImagePairs = $scope.filteredImagePairs; | 414 $scope.limitedImagePairs = $scope.filteredImagePairs; |
| 399 } | 415 } |
| 400 $scope.showThumbnails = $scope.showThumbnailsPending; | 416 $scope.showThumbnails = $scope.showThumbnailsPending; |
| 401 $scope.imageSize = $scope.imageSizePending; | 417 $scope.imageSize = $scope.imageSizePending; |
| 402 $scope.setUpdatesPending(false); | 418 $scope.setUpdatesPending(false); |
| 403 $scope.queryParameters.save(); | 419 $scope.queryParameters.save(); |
| 404 } | 420 } |
| 405 | 421 |
| 406 /** | 422 /** |
| 423 * This function is called when the results have been completely rendered |
| 424 * after updateResults(). |
| 425 */ |
| 426 $scope.resultsUpdatedCallback = function() { |
| 427 $scope.renderEndTime = window.performance.now(); |
| 428 $log.debug("renderEndTime: " + $scope.renderEndTime); |
| 429 } |
| 430 |
| 431 /** |
| 407 * Re-sort the displayed results. | 432 * Re-sort the displayed results. |
| 408 * | 433 * |
| 409 * @param subdict (string): which subdictionary | 434 * @param subdict (string): which subdictionary |
| 410 * (constants.KEY__DIFFERENCE_DATA, constants.KEY__EXPECTATIONS_DATA, | 435 * (constants.KEY__DIFFERENCE_DATA, constants.KEY__EXPECTATIONS_DATA, |
| 411 * constants.KEY__EXTRA_COLUMN_VALUES) the sort column key is within | 436 * constants.KEY__EXTRA_COLUMN_VALUES) the sort column key is within |
| 412 * @param key (string): sort by value associated with this key in subdict | 437 * @param key (string): sort by value associated with this key in subdict |
| 413 */ | 438 */ |
| 414 $scope.sortResultsBy = function(subdict, key) { | 439 $scope.sortResultsBy = function(subdict, key) { |
| 415 $scope.sortColumnSubdict = subdict; | 440 $scope.sortColumnSubdict = subdict; |
| 416 $scope.sortColumnKey = key; | 441 $scope.sortColumnKey = key; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 */ | 779 */ |
| 755 $scope.getImageDiffRelativeUrl = function(imagePair) { | 780 $scope.getImageDiffRelativeUrl = function(imagePair) { |
| 756 var before = | 781 var before = |
| 757 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + | 782 imagePair[constants.KEY__IMAGE_A_URL] + "-vs-" + |
| 758 imagePair[constants.KEY__IMAGE_B_URL]; | 783 imagePair[constants.KEY__IMAGE_B_URL]; |
| 759 return before.replace(/[^\w\-]/g, "_") + ".png"; | 784 return before.replace(/[^\w\-]/g, "_") + ".png"; |
| 760 } | 785 } |
| 761 | 786 |
| 762 } | 787 } |
| 763 ); | 788 ); |
| OLD | NEW |