Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: gm/rebaseline_server/static/loader.js

Issue 47423002: rebaseline_server: allow substring filtering for builder and test (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: lastbit Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 builderSubstring, testSubstring, 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
25 // than calling $scope.isValueInSet(). 25 // than calling $scope.isValueInSet().
26 // Besides, I don't think we have access to $scope in here... 26 // Besides, I don't think we have access to $scope in here...
27 if (!(true == hiddenResultTypes[item.resultType]) && 27 if (!(true == hiddenResultTypes[item.resultType]) &&
28 !(true == hiddenConfigs[item.config]) && 28 !(true == hiddenConfigs[item.config]) &&
29 !(-1 == item.builder.indexOf(builderSubstring)) &&
30 !(-1 == item.test.indexOf(testSubstring)) &&
29 (viewingTab == item.tab)) { 31 (viewingTab == item.tab)) {
30 filteredItems.push(item); 32 filteredItems.push(item);
31 } 33 }
32 } 34 }
33 return filteredItems; 35 return filteredItems;
34 }; 36 };
35 } 37 }
36 ); 38 );
37 39
38 40
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 94
93 // Arrays within which the user can toggle individual elements. 95 // Arrays within which the user can toggle individual elements.
94 $scope.selectedItems = []; 96 $scope.selectedItems = [];
95 97
96 // Sets within which the user can toggle individual elements. 98 // Sets within which the user can toggle individual elements.
97 $scope.hiddenResultTypes = { 99 $scope.hiddenResultTypes = {
98 'failure-ignored': true, 100 'failure-ignored': true,
99 'no-comparison': true, 101 'no-comparison': true,
100 'succeeded': true, 102 'succeeded': true,
101 }; 103 };
104 $scope.allResultTypes = Object.keys(data.categories['resultType']);
102 $scope.hiddenConfigs = {}; 105 $scope.hiddenConfigs = {};
106 $scope.allConfigs = Object.keys(data.categories['config']);
107
108 // Associative array of partial string matches per category.
109 $scope.categoryValueMatch = {};
110 $scope.categoryValueMatch.builder = "";
111 $scope.categoryValueMatch.test = "";
103 112
104 $scope.updateResults(); 113 $scope.updateResults();
105 $scope.loadingMessage = ""; 114 $scope.loadingMessage = "";
106 $scope.windowTitle = "Current GM Results"; 115 $scope.windowTitle = "Current GM Results";
107 } 116 }
108 ).error( 117 ).error(
109 function(data, status, header, config) { 118 function(data, status, header, config) {
110 $scope.loadingMessage = "Failed to load results of type '" 119 $scope.loadingMessage = "Failed to load results of type '"
111 + resultsToLoad + "'"; 120 + resultsToLoad + "'";
112 $scope.windowTitle = "Failed to Load GM Results"; 121 $scope.windowTitle = "Failed to Load GM Results";
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // the items as they are displayed, rather than storing multiple 241 // the items as they are displayed, rather than storing multiple
233 // array copies? (For better performance.) 242 // array copies? (For better performance.)
234 243
235 if ($scope.viewingTab == $scope.defaultTab) { 244 if ($scope.viewingTab == $scope.defaultTab) {
236 $scope.filteredTestData = 245 $scope.filteredTestData =
237 $filter("orderBy")( 246 $filter("orderBy")(
238 $filter("removeHiddenItems")( 247 $filter("removeHiddenItems")(
239 $scope.testData, 248 $scope.testData,
240 $scope.hiddenResultTypes, 249 $scope.hiddenResultTypes,
241 $scope.hiddenConfigs, 250 $scope.hiddenConfigs,
251 $scope.categoryValueMatch.builder,
252 $scope.categoryValueMatch.test,
242 $scope.viewingTab 253 $scope.viewingTab
243 ), 254 ),
244 $scope.sortColumn); 255 $scope.sortColumn);
245 $scope.limitedTestData = $filter("limitTo")( 256 $scope.limitedTestData = $filter("limitTo")(
246 $scope.filteredTestData, $scope.displayLimit); 257 $scope.filteredTestData, $scope.displayLimit);
247 } else { 258 } else {
248 $scope.filteredTestData = 259 $scope.filteredTestData =
249 $filter("orderBy")( 260 $filter("orderBy")(
250 $filter("filter")( 261 $filter("filter")(
251 $scope.testData, 262 $scope.testData,
(...skipping 10 matching lines...) Expand all
262 /** 273 /**
263 * Re-sort the displayed results. 274 * Re-sort the displayed results.
264 * 275 *
265 * @param sortColumn (string): name of the column to sort on 276 * @param sortColumn (string): name of the column to sort on
266 */ 277 */
267 $scope.sortResultsBy = function(sortColumn) { 278 $scope.sortResultsBy = function(sortColumn) {
268 $scope.sortColumn = sortColumn; 279 $scope.sortColumn = sortColumn;
269 $scope.updateResults(); 280 $scope.updateResults();
270 } 281 }
271 282
283 /**
284 * Set $scope.categoryValueMatch[name] = value, and update results.
285 *
286 * @param name
287 * @param value
288 */
289 $scope.setCategoryValueMatch = function(name, value) {
290 $scope.categoryValueMatch[name] = value;
291 $scope.updateResults();
292 }
293
294 /**
295 * Update $scope.hiddenResultTypes so that ONLY this resultType is showing,
296 * and update the visible results.
297 *
298 * @param resultType
299 */
300 $scope.showOnlyResultType = function(resultType) {
301 $scope.hiddenResultTypes = {};
302 // TODO(epoger): Maybe change $scope.allResultTypes to be a Set like
303 // $scope.hiddenResultTypes (rather than an array), so this operation is
304 // simpler (just assign or add allResultTypes to hiddenResultTypes).
305 $scope.toggleValuesInSet($scope.allResultTypes, $scope.hiddenResultTypes);
306 $scope.toggleValueInSet(resultType, $scope.hiddenResultTypes);
307 $scope.updateResults();
308 }
309
310 /**
311 * Update $scope.hiddenConfigs so that ONLY this config is showing,
312 * and update the visible results.
313 *
314 * @param config
315 */
316 $scope.showOnlyConfig = function(config) {
317 $scope.hiddenConfigs = {};
318 $scope.toggleValuesInSet($scope.allConfigs, $scope.hiddenConfigs);
319 $scope.toggleValueInSet(config, $scope.hiddenConfigs);
320 $scope.updateResults();
321 }
322
272 323
273 // 324 //
274 // Operations for sending info back to the server. 325 // Operations for sending info back to the server.
275 // 326 //
276 327
277 /** 328 /**
278 * Tell the server that the actual results of these particular tests 329 * Tell the server that the actual results of these particular tests
279 * are acceptable. 330 * are acceptable.
280 * 331 *
281 * @param testDataSubset an array of test results, most likely a subset of 332 * @param testDataSubset an array of test results, most likely a subset of
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 * @param set an Object which we use to mimic set semantics 436 * @param set an Object which we use to mimic set semantics
386 */ 437 */
387 $scope.toggleValueInSet = function(value, set) { 438 $scope.toggleValueInSet = function(value, set) {
388 if (true == set[value]) { 439 if (true == set[value]) {
389 delete set[value]; 440 delete set[value];
390 } else { 441 } else {
391 set[value] = true; 442 set[value] = true;
392 } 443 }
393 } 444 }
394 445
446 /**
447 * For each value in valueArray, call toggleValueInSet(value, set).
448 *
449 * @param valueArray
450 * @param set
451 */
452 $scope.toggleValuesInSet = function(valueArray, set) {
453 var arrayLength = valueArray.length;
454 for (var i = 0; i < arrayLength; i++) {
455 $scope.toggleValueInSet(valueArray[i], set);
456 }
457 }
458
395 459
396 // 460 //
397 // Array operations; similar to our Set operations, but operate on a 461 // Array operations; similar to our Set operations, but operate on a
398 // Javascript Array so we *can* easily get a list of all values in the Set. 462 // Javascript Array so we *can* easily get a list of all values in the Set.
399 // TODO(epoger): move into a separate .js file? 463 // TODO(epoger): move into a separate .js file?
400 // 464 //
401 465
402 /** 466 /**
403 * Returns true if value "value" is present within array "array". 467 * Returns true if value "value" is present within array "array".
404 * 468 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 * 501 *
438 * @param secondsPastEpoch (numeric): seconds past epoch in UTC 502 * @param secondsPastEpoch (numeric): seconds past epoch in UTC
439 */ 503 */
440 $scope.localTimeString = function(secondsPastEpoch) { 504 $scope.localTimeString = function(secondsPastEpoch) {
441 var d = new Date(secondsPastEpoch * 1000); 505 var d = new Date(secondsPastEpoch * 1000);
442 return d.toString(); 506 return d.toString();
443 } 507 }
444 508
445 } 509 }
446 ); 510 );
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698