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

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

Issue 25555003: More improvements to HTTP baseline viewer (for GM results) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: delete_commented_out_HTML Created 7 years, 2 months 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
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
11 // TODO(epoger): Combine ALL of our filtering operations (including
12 // truncation) into this one filter, so that runs most efficiently?
13 // (We would have to make sure truncation still took place after
14 // sorting, though.)
15 Loader.filter(
16 'removeHiddenItems',
17 function() {
18 return function(unfilteredItems, hiddenResultTypes, hiddenConfigs) {
19 var filteredItems = [];
20 for (var i = 0; i < unfilteredItems.length; i++) {
21 var item = unfilteredItems[i];
22 if ((hiddenResultTypes.indexOf(item.resultType) < 0) &&
23 (hiddenConfigs.indexOf(item.config) < 0)) {
24 filteredItems.push(item);
25 }
26 }
27 return filteredItems;
28 };
29 }
30 );
31
10 Loader.controller( 32 Loader.controller(
11 'Loader.Controller', 33 'Loader.Controller',
12 function($scope, $http) { 34 function($scope, $http, $filter) {
13 $http.get("/results/all").then( 35 $http.get("/results/all").then(
14 function(response) { 36 function(response) {
15 $scope.categories = response.data.categories; 37 $scope.categories = response.data.categories;
16 $scope.testData = response.data.testData; 38 $scope.testData = response.data.testData;
17 $scope.sortColumn = 'test'; 39 $scope.sortColumn = 'test';
18 » $scope.showResultsOfType = 'failed'; 40
41 » $scope.hiddenResultTypes = ['no-comparison', 'succeeded'];
42 » $scope.hiddenConfigs = [];
43
44 » $scope.updateResults();
19 } 45 }
20 ); 46 );
47
48 $scope.isHiddenResultType = function(thisResultType) {
49 return ($scope.hiddenResultTypes.indexOf(thisResultType) >= 0);
50 }
51 $scope.toggleHiddenResultType = function(thisResultType) {
52 var i = $scope.hiddenResultTypes.indexOf(thisResultType);
53 if (i >= 0) {
54 $scope.hiddenResultTypes.splice(i, 1);
55 } else {
56 $scope.hiddenResultTypes.push(thisResultType);
57 }
58 $scope.areUpdatesPending = true;
59 }
60
61 // TODO(epoger): Rather than maintaining these as hard-coded
62 // variants of isHiddenResultType and toggleHiddenResultType, we
63 // should create general-purpose functions that can work with ANY
64 // category.
65 // But for now, I wanted to see this working. :-)
66 $scope.isHiddenConfig = function(thisConfig) {
67 return ($scope.hiddenConfigs.indexOf(thisConfig) >= 0);
68 }
69 $scope.toggleHiddenConfig = function(thisConfig) {
70 var i = $scope.hiddenConfigs.indexOf(thisConfig);
71 if (i >= 0) {
72 $scope.hiddenConfigs.splice(i, 1);
73 } else {
74 $scope.hiddenConfigs.push(thisConfig);
75 }
76 $scope.areUpdatesPending = true;
77 }
78
79 $scope.updateResults = function() {
80 $scope.displayLimit = $scope.displayLimitPending;
81 $scope.filteredTestData =
82 $filter("orderBy")(
83 $filter("removeHiddenItems")(
84 $scope.testData,
85 $scope.hiddenResultTypes,
86 $scope.hiddenConfigs
87 ),
88 $scope.sortColumn);
89 $scope.limitedTestData = $filter("limitTo")(
90 $scope.filteredTestData, $scope.displayLimit);
91 $scope.imageSize = $scope.imageSizePending;
92 $scope.areUpdatesPending = false;
93 }
94
95 $scope.sortResultsBy = function(sortColumn) {
96 $scope.sortColumn = sortColumn;
97 $scope.updateResults();
98 }
21 } 99 }
22 ); 100 );
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698