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 |
11 | 11 |
12 // TODO(epoger): Combine ALL of our filtering operations (including | 12 // TODO(epoger): Combine ALL of our filtering operations (including |
13 // truncation) into this one filter, so that runs most efficiently? | 13 // truncation) into this one filter, so that runs most efficiently? |
14 // (We would have to make sure truncation still took place after | 14 // (We would have to make sure truncation still took place after |
15 // sorting, though.) | 15 // sorting, though.) |
16 Loader.filter( | 16 Loader.filter( |
17 'removeHiddenItems', | 17 'removeHiddenItems', |
18 function() { | 18 function() { |
19 return function(unfilteredItems, hiddenResultTypes, hiddenConfigs, | 19 return function(unfilteredItems, hiddenResultTypes, hiddenConfigs, |
20 viewingTab) { | 20 viewingTab) { |
21 var filteredItems = []; | 21 var filteredItems = []; |
22 for (var i = 0; i < unfilteredItems.length; i++) { | 22 for (var i = 0; i < unfilteredItems.length; i++) { |
23 var item = unfilteredItems[i]; | 23 var item = unfilteredItems[i]; |
24 » // For performance, we examine the "set" objects directly rather | 24 // For performance, we examine the "set" objects directly rather |
epoger
2013/10/25 16:38:26
fixed some tabs -> spaces
| |
25 » // than calling $scope.isValueInSet(). | 25 // than calling $scope.isValueInSet(). |
26 // Besides, I don't think we have access to $scope in here... | |
26 if (!(true == hiddenResultTypes[item.resultType]) && | 27 if (!(true == hiddenResultTypes[item.resultType]) && |
27 !(true == hiddenConfigs[item.config]) && | 28 !(true == hiddenConfigs[item.config]) && |
28 (viewingTab == item.tab)) { | 29 (viewingTab == item.tab)) { |
29 filteredItems.push(item); | 30 filteredItems.push(item); |
30 } | 31 } |
31 } | 32 } |
32 return filteredItems; | 33 return filteredItems; |
33 }; | 34 }; |
34 } | 35 } |
35 ); | 36 ); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 $scope.numResultsPerTab[$scope.tabs[i]] = 0; | 77 $scope.numResultsPerTab[$scope.tabs[i]] = 0; |
77 } | 78 } |
78 $scope.numResultsPerTab[$scope.defaultTab] = $scope.testData.length; | 79 $scope.numResultsPerTab[$scope.defaultTab] = $scope.testData.length; |
79 | 80 |
80 // Add index and tab fields to all records. | 81 // Add index and tab fields to all records. |
81 for (var i = 0; i < $scope.testData.length; i++) { | 82 for (var i = 0; i < $scope.testData.length; i++) { |
82 $scope.testData[i].index = i; | 83 $scope.testData[i].index = i; |
83 $scope.testData[i].tab = $scope.defaultTab; | 84 $scope.testData[i].tab = $scope.defaultTab; |
84 } | 85 } |
85 | 86 |
86 » // Arrays within which the user can toggle individual elements. | 87 // Arrays within which the user can toggle individual elements. |
87 $scope.selectedItems = []; | 88 $scope.selectedItems = []; |
88 | 89 |
89 » // Sets within which the user can toggle individual elements. | 90 // Sets within which the user can toggle individual elements. |
90 $scope.hiddenResultTypes = { | 91 $scope.hiddenResultTypes = { |
91 'failure-ignored': true, | 92 'failure-ignored': true, |
92 'no-comparison': true, | 93 'no-comparison': true, |
93 'succeeded': true, | 94 'succeeded': true, |
94 }; | 95 }; |
95 $scope.hiddenConfigs = {}; | 96 $scope.hiddenConfigs = {}; |
96 | 97 |
97 $scope.updateResults(); | 98 $scope.updateResults(); |
98 $scope.loadingMessage = ""; | 99 $scope.loadingMessage = ""; |
99 $scope.windowTitle = "Current GM Results"; | 100 $scope.windowTitle = "Current GM Results"; |
100 } | 101 } |
101 ).error( | 102 ).error( |
102 function(data, status, header, config) { | 103 function(data, status, header, config) { |
103 $scope.loadingMessage = "Failed to load results of type '" | 104 $scope.loadingMessage = "Failed to load results of type '" |
104 + resultsToLoad + "'"; | 105 + resultsToLoad + "'"; |
105 $scope.windowTitle = "Failed to Load GM Results"; | 106 $scope.windowTitle = "Failed to Load GM Results"; |
106 } | 107 } |
107 ); | 108 ); |
108 | 109 |
109 | 110 |
110 // | 111 // |
112 // Select/Clear/Toggle all tests. | |
113 // | |
114 | |
115 /** | |
116 * Select all currently showing tests. | |
117 */ | |
118 $scope.selectAllItems = function() { | |
119 var numItemsShowing = $scope.limitedTestData.length; | |
120 for (var i=0; i<numItemsShowing; i++) { | |
121 var index = $scope.limitedTestData[i].index; | |
122 if (!$scope.isValueInArray(index, $scope.selectedItems)) { | |
123 $scope.toggleValueInArray(index, $scope.selectedItems); | |
124 } | |
125 } | |
126 } | |
127 | |
128 /** | |
129 * Deselect all currently showing tests. | |
130 */ | |
131 $scope.clearAllItems = function() { | |
132 var numItemsShowing = $scope.limitedTestData.length; | |
133 for (var i=0; i<numItemsShowing; i++) { | |
134 var index = $scope.limitedTestData[i].index; | |
135 if ($scope.isValueInArray(index, $scope.selectedItems)) { | |
136 $scope.toggleValueInArray(index, $scope.selectedItems); | |
137 } | |
138 } | |
139 } | |
140 | |
141 /** | |
142 * Toggle selection of all currently showing tests. | |
143 */ | |
144 $scope.toggleAllItems = function() { | |
145 var numItemsShowing = $scope.limitedTestData.length; | |
146 for (var i=0; i<numItemsShowing; i++) { | |
147 var index = $scope.limitedTestData[i].index; | |
148 $scope.toggleValueInArray(index, $scope.selectedItems); | |
149 } | |
150 } | |
151 | |
152 | |
153 // | |
111 // Tab operations. | 154 // Tab operations. |
112 // | 155 // |
113 | 156 |
114 /** | 157 /** |
115 * Change the selected tab. | 158 * Change the selected tab. |
116 * | 159 * |
117 * @param tab (string): name of the tab to select | 160 * @param tab (string): name of the tab to select |
118 */ | 161 */ |
119 $scope.setViewingTab = function(tab) { | 162 $scope.setViewingTab = function(tab) { |
120 $scope.viewingTab = tab; | 163 $scope.viewingTab = tab; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 $scope.filteredTestData, $scope.displayLimit); | 240 $scope.filteredTestData, $scope.displayLimit); |
198 } else { | 241 } else { |
199 $scope.filteredTestData = | 242 $scope.filteredTestData = |
200 $filter("orderBy")( | 243 $filter("orderBy")( |
201 $filter("filter")( | 244 $filter("filter")( |
202 $scope.testData, | 245 $scope.testData, |
203 {tab: $scope.viewingTab}, | 246 {tab: $scope.viewingTab}, |
204 true | 247 true |
205 ), | 248 ), |
206 $scope.sortColumn); | 249 $scope.sortColumn); |
207 $scope.limitedTestData = $filter("limitTo")( | 250 $scope.limitedTestData = $scope.filteredTestData; |
208 $scope.filteredTestData, $scope.displayLimit); | |
209 } | 251 } |
210 $scope.imageSize = $scope.imageSizePending; | 252 $scope.imageSize = $scope.imageSizePending; |
211 $scope.setUpdatesPending(false); | 253 $scope.setUpdatesPending(false); |
212 } | 254 } |
213 | 255 |
214 /** | 256 /** |
215 * Re-sort the displayed results. | 257 * Re-sort the displayed results. |
216 * | 258 * |
217 * @param sortColumn (string): name of the column to sort on | 259 * @param sortColumn (string): name of the column to sort on |
218 */ | 260 */ |
(...skipping 19 matching lines...) Expand all Loading... | |
238 var newResults = []; | 280 var newResults = []; |
239 for (var i = 0; i < testDataSubset.length; i++) { | 281 for (var i = 0; i < testDataSubset.length; i++) { |
240 var actualResult = testDataSubset[i]; | 282 var actualResult = testDataSubset[i]; |
241 var expectedResult = { | 283 var expectedResult = { |
242 builder: actualResult['builder'], | 284 builder: actualResult['builder'], |
243 test: actualResult['test'], | 285 test: actualResult['test'], |
244 config: actualResult['config'], | 286 config: actualResult['config'], |
245 expectedHashType: actualResult['actualHashType'], | 287 expectedHashType: actualResult['actualHashType'], |
246 expectedHashDigest: actualResult['actualHashDigest'], | 288 expectedHashDigest: actualResult['actualHashDigest'], |
247 }; | 289 }; |
290 // Since these are *approvals*, we make assumptions about these fields: | |
291 expectedResult['reviewed-by-human'] = true; | |
292 // expectedResult['bugs'] is empty | |
293 // expectedResult['ignore-failure'] is empty (defaults to false) | |
248 newResults.push(expectedResult); | 294 newResults.push(expectedResult); |
249 } | 295 } |
250 $http({ | 296 $http({ |
251 method: "POST", | 297 method: "POST", |
252 url: "/edits", | 298 url: "/edits", |
253 data: { | 299 data: { |
254 oldResultsType: $scope.header.type, | 300 oldResultsType: $scope.header.type, |
255 oldResultsHash: $scope.header.dataHash, | 301 oldResultsHash: $scope.header.dataHash, |
256 modifications: newResults | 302 modifications: newResults |
257 } | 303 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 * | 401 * |
356 * @param secondsPastEpoch (numeric): seconds past epoch in UTC | 402 * @param secondsPastEpoch (numeric): seconds past epoch in UTC |
357 */ | 403 */ |
358 $scope.localTimeString = function(secondsPastEpoch) { | 404 $scope.localTimeString = function(secondsPastEpoch) { |
359 var d = new Date(secondsPastEpoch * 1000); | 405 var d = new Date(secondsPastEpoch * 1000); |
360 return d.toString(); | 406 return d.toString(); |
361 } | 407 } |
362 | 408 |
363 } | 409 } |
364 ); | 410 ); |
OLD | NEW |