| 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.categories and $scope.testData . | 4 * them into $scope.categories and $scope.testData . |
| 5 */ | 5 */ |
| 6 var Loader = angular.module( | 6 var Loader = angular.module( |
| 7 'Loader', | 7 'Loader', |
| 8 [] | 8 [] |
| 9 ); | 9 ); |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 filteredItems.push(item); | 24 filteredItems.push(item); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 return filteredItems; | 27 return filteredItems; |
| 28 }; | 28 }; |
| 29 } | 29 } |
| 30 ); | 30 ); |
| 31 | 31 |
| 32 Loader.controller( | 32 Loader.controller( |
| 33 'Loader.Controller', | 33 'Loader.Controller', |
| 34 function($scope, $http, $filter, $location) { | 34 function($scope, $http, $filter, $location) { |
| 35 $scope.windowTitle = "Loading GM Results..."; |
| 35 var resultsToLoad = $location.search().resultsToLoad; | 36 var resultsToLoad = $location.search().resultsToLoad; |
| 36 $scope.loadingMessage = "Loading results of type '" + resultsToLoad + | 37 $scope.loadingMessage = "Loading results of type '" + resultsToLoad + |
| 37 "', please wait..."; | 38 "', please wait..."; |
| 38 | 39 |
| 39 $http.get("/results/" + resultsToLoad).success( | 40 $http.get("/results/" + resultsToLoad).success( |
| 40 function(data, status, header, config) { | 41 function(data, status, header, config) { |
| 41 $scope.loadingMessage = "Processing data, please wait..."; | 42 $scope.loadingMessage = "Processing data, please wait..."; |
| 42 | 43 |
| 43 $scope.header = data.header; | 44 $scope.header = data.header; |
| 44 $scope.categories = data.categories; | 45 $scope.categories = data.categories; |
| 45 $scope.testData = data.testData; | 46 $scope.testData = data.testData; |
| 46 $scope.sortColumn = 'test'; | 47 $scope.sortColumn = 'test'; |
| 48 $scope.showTodos = true; |
| 47 | 49 |
| 48 for (var i = 0; i < $scope.testData.length; i++) { | 50 for (var i = 0; i < $scope.testData.length; i++) { |
| 49 $scope.testData[i].index = i; | 51 $scope.testData[i].index = i; |
| 50 } | 52 } |
| 51 | 53 |
| 52 $scope.hiddenResultTypes = { | 54 $scope.hiddenResultTypes = { |
| 53 'failure-ignored': true, | 55 'failure-ignored': true, |
| 54 'no-comparison': true, | 56 'no-comparison': true, |
| 55 'succeeded': true, | 57 'succeeded': true, |
| 56 }; | 58 }; |
| 57 $scope.hiddenConfigs = {}; | 59 $scope.hiddenConfigs = {}; |
| 58 $scope.selectedItems = {}; | 60 $scope.selectedItems = {}; |
| 59 | 61 |
| 60 $scope.updateResults(); | 62 $scope.updateResults(); |
| 61 $scope.loadingMessage = ""; | 63 $scope.loadingMessage = ""; |
| 64 $scope.windowTitle = "Current GM Results"; |
| 62 } | 65 } |
| 63 ).error( | 66 ).error( |
| 64 function(data, status, header, config) { | 67 function(data, status, header, config) { |
| 65 $scope.loadingMessage = "Failed to load results of type '" | 68 $scope.loadingMessage = "Failed to load results of type '" |
| 66 + resultsToLoad + "'"; | 69 + resultsToLoad + "'"; |
| 70 $scope.windowTitle = "Failed to Load GM Results"; |
| 67 } | 71 } |
| 68 ); | 72 ); |
| 69 | 73 |
| 70 $scope.isItemSelected = function(index) { | 74 $scope.isItemSelected = function(index) { |
| 71 return (true == $scope.selectedItems[index]); | 75 return (true == $scope.selectedItems[index]); |
| 72 } | 76 } |
| 73 $scope.toggleItemSelected = function(index) { | 77 $scope.toggleItemSelected = function(index) { |
| 74 if (true == $scope.selectedItems[index]) { | 78 if (true == $scope.selectedItems[index]) { |
| 75 delete $scope.selectedItems[index]; | 79 delete $scope.selectedItems[index]; |
| 76 } else { | 80 } else { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 } | 106 } |
| 103 $scope.toggleHiddenConfig = function(thisConfig) { | 107 $scope.toggleHiddenConfig = function(thisConfig) { |
| 104 if (true == $scope.hiddenConfigs[thisConfig]) { | 108 if (true == $scope.hiddenConfigs[thisConfig]) { |
| 105 delete $scope.hiddenConfigs[thisConfig]; | 109 delete $scope.hiddenConfigs[thisConfig]; |
| 106 } else { | 110 } else { |
| 107 $scope.hiddenConfigs[thisConfig] = true; | 111 $scope.hiddenConfigs[thisConfig] = true; |
| 108 } | 112 } |
| 109 $scope.areUpdatesPending = true; | 113 $scope.areUpdatesPending = true; |
| 110 } | 114 } |
| 111 | 115 |
| 116 $scope.localTimeString = function(secondsPastEpoch) { |
| 117 var d = new Date(secondsPastEpoch * 1000); |
| 118 return d.toString(); |
| 119 } |
| 120 |
| 112 $scope.updateResults = function() { | 121 $scope.updateResults = function() { |
| 113 $scope.displayLimit = $scope.displayLimitPending; | 122 $scope.displayLimit = $scope.displayLimitPending; |
| 114 // TODO(epoger): Every time we apply a filter, AngularJS creates | 123 // TODO(epoger): Every time we apply a filter, AngularJS creates |
| 115 // another copy of the array. Is there a way we can filter out | 124 // another copy of the array. Is there a way we can filter out |
| 116 // the items as they are displayed, rather than storing multiple | 125 // the items as they are displayed, rather than storing multiple |
| 117 // array copies? (For better performance.) | 126 // array copies? (For better performance.) |
| 118 $scope.filteredTestData = | 127 $scope.filteredTestData = |
| 119 $filter("orderBy")( | 128 $filter("orderBy")( |
| 120 $filter("removeHiddenItems")( | 129 $filter("removeHiddenItems")( |
| 121 $scope.testData, | 130 $scope.testData, |
| 122 $scope.hiddenResultTypes, | 131 $scope.hiddenResultTypes, |
| 123 $scope.hiddenConfigs | 132 $scope.hiddenConfigs |
| 124 ), | 133 ), |
| 125 $scope.sortColumn); | 134 $scope.sortColumn); |
| 126 $scope.limitedTestData = $filter("limitTo")( | 135 $scope.limitedTestData = $filter("limitTo")( |
| 127 $scope.filteredTestData, $scope.displayLimit); | 136 $scope.filteredTestData, $scope.displayLimit); |
| 128 $scope.imageSize = $scope.imageSizePending; | 137 $scope.imageSize = $scope.imageSizePending; |
| 129 $scope.areUpdatesPending = false; | 138 $scope.areUpdatesPending = false; |
| 130 } | 139 } |
| 131 | 140 |
| 132 $scope.sortResultsBy = function(sortColumn) { | 141 $scope.sortResultsBy = function(sortColumn) { |
| 133 $scope.sortColumn = sortColumn; | 142 $scope.sortColumn = sortColumn; |
| 134 $scope.updateResults(); | 143 $scope.updateResults(); |
| 135 } | 144 } |
| 136 } | 145 } |
| 137 ); | 146 ); |
| OLD | NEW |