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

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

Issue 28903008: rebaseline_server: add tabs, and ability to submit new baselines to the server (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: tabs_to_spaces 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 10
11 // TODO(epoger): Combine ALL of our filtering operations (including 11 // TODO(epoger): Combine ALL of our filtering operations (including
12 // truncation) into this one filter, so that runs most efficiently? 12 // truncation) into this one filter, so that runs most efficiently?
13 // (We would have to make sure truncation still took place after 13 // (We would have to make sure truncation still took place after
14 // sorting, though.) 14 // sorting, though.)
15 Loader.filter( 15 Loader.filter(
16 'removeHiddenItems', 16 'removeHiddenItems',
17 function() { 17 function() {
18 return function(unfilteredItems, hiddenResultTypes, hiddenConfigs) { 18 return function(unfilteredItems, hiddenResultTypes, hiddenConfigs,
19 viewingTab) {
19 var filteredItems = []; 20 var filteredItems = [];
20 for (var i = 0; i < unfilteredItems.length; i++) { 21 for (var i = 0; i < unfilteredItems.length; i++) {
21 var item = unfilteredItems[i]; 22 var item = unfilteredItems[i];
22 if (!(true == hiddenResultTypes[item.resultType]) && 23 if (!(true == hiddenResultTypes[item.resultType]) &&
23 !(true == hiddenConfigs[item.config])) { 24 !(true == hiddenConfigs[item.config]) &&
25 (viewingTab == item.tab)) {
24 filteredItems.push(item); 26 filteredItems.push(item);
25 } 27 }
26 } 28 }
27 return filteredItems; 29 return filteredItems;
28 }; 30 };
29 } 31 }
30 ); 32 );
31 33
32 Loader.controller( 34 Loader.controller(
33 'Loader.Controller', 35 'Loader.Controller',
34 function($scope, $http, $filter, $location) { 36 function($scope, $http, $filter, $location) {
35 $scope.windowTitle = "Loading GM Results..."; 37 $scope.windowTitle = "Loading GM Results...";
36 var resultsToLoad = $location.search().resultsToLoad; 38 var resultsToLoad = $location.search().resultsToLoad;
37 $scope.loadingMessage = "Loading results of type '" + resultsToLoad + 39 $scope.loadingMessage = "Loading results of type '" + resultsToLoad +
38 "', please wait..."; 40 "', please wait...";
39 41
40 $http.get("/results/" + resultsToLoad).success( 42 $http.get("/results/" + resultsToLoad).success(
41 function(data, status, header, config) { 43 function(data, status, header, config) {
42 $scope.loadingMessage = "Processing data, please wait..."; 44 $scope.loadingMessage = "Processing data, please wait...";
43 45
44 $scope.header = data.header; 46 $scope.header = data.header;
45 $scope.categories = data.categories; 47 $scope.categories = data.categories;
46 $scope.testData = data.testData; 48 $scope.testData = data.testData;
47 $scope.sortColumn = 'test'; 49 $scope.sortColumn = 'test';
48 $scope.showTodos = true; 50 $scope.showTodos = false;
49 51
52 // Create the list of tabs (lists into which the user can file each
53 // test). This may vary, depending on isEditable.
54 $scope.tabs = [
55 'Unfiled', 'Hidden'
56 ];
57 if (data.header.isEditable) {
58 $scope.tabs = $scope.tabs.concat(
59 ['Pending Approval']);
epoger 2013/10/19 01:15:56 So, if run without --editable, you still have two
60 }
61 $scope.defaultTab = $scope.tabs[0];
62 $scope.viewingTab = $scope.defaultTab;
63
64 // Add index and tab fields to all records.
50 for (var i = 0; i < $scope.testData.length; i++) { 65 for (var i = 0; i < $scope.testData.length; i++) {
51 $scope.testData[i].index = i; 66 $scope.testData[i].index = i;
67 $scope.testData[i].tab = $scope.defaultTab;
epoger 2013/10/19 01:15:56 Each test result belongs to a single tab.
52 } 68 }
53 69
54 $scope.hiddenResultTypes = { 70 $scope.hiddenResultTypes = {
55 'failure-ignored': true, 71 'failure-ignored': true,
56 'no-comparison': true, 72 'no-comparison': true,
57 'succeeded': true, 73 'succeeded': true,
58 }; 74 };
59 $scope.hiddenConfigs = {}; 75 $scope.hiddenConfigs = {};
60 $scope.selectedItems = {}; 76 $scope.selectedItems = [];
61 77
62 $scope.updateResults(); 78 $scope.updateResults();
63 $scope.loadingMessage = ""; 79 $scope.loadingMessage = "";
64 $scope.windowTitle = "Current GM Results"; 80 $scope.windowTitle = "Current GM Results";
65 } 81 }
66 ).error( 82 ).error(
67 function(data, status, header, config) { 83 function(data, status, header, config) {
68 $scope.loadingMessage = "Failed to load results of type '" 84 $scope.loadingMessage = "Failed to load results of type '"
69 + resultsToLoad + "'"; 85 + resultsToLoad + "'";
70 $scope.windowTitle = "Failed to Load GM Results"; 86 $scope.windowTitle = "Failed to Load GM Results";
71 } 87 }
72 ); 88 );
73 89
74 $scope.isItemSelected = function(index) { 90 $scope.isItemSelected = function(index) {
75 return (true == $scope.selectedItems[index]); 91 return (-1 != $scope.selectedItems.indexOf(index));
epoger 2013/10/19 01:15:56 Maintaining $scope.isItemSelected as an array made
76 } 92 }
77 $scope.toggleItemSelected = function(index) { 93 $scope.toggleItemSelected = function(index) {
78 if (true == $scope.selectedItems[index]) { 94 var i = $scope.selectedItems.indexOf(index);
79 delete $scope.selectedItems[index]; 95 if (-1 == i) {
96 $scope.selectedItems.push(index);
80 } else { 97 } else {
81 $scope.selectedItems[index] = true; 98 $scope.selectedItems.splice(i, 1);
82 } 99 }
83 // unlike other toggle methods below, does not set 100 // unlike other toggle methods below, does not set
84 // $scope.areUpdatesPending = true; 101 // $scope.areUpdatesPending = true;
85 } 102 }
86 103
87 $scope.isHiddenResultType = function(thisResultType) { 104 $scope.isHiddenResultType = function(thisResultType) {
88 return (true == $scope.hiddenResultTypes[thisResultType]); 105 return (true == $scope.hiddenResultTypes[thisResultType]);
89 } 106 }
90 $scope.toggleHiddenResultType = function(thisResultType) { 107 $scope.toggleHiddenResultType = function(thisResultType) {
91 if (true == $scope.hiddenResultTypes[thisResultType]) { 108 if (true == $scope.hiddenResultTypes[thisResultType]) {
(...skipping 14 matching lines...) Expand all
106 } 123 }
107 $scope.toggleHiddenConfig = function(thisConfig) { 124 $scope.toggleHiddenConfig = function(thisConfig) {
108 if (true == $scope.hiddenConfigs[thisConfig]) { 125 if (true == $scope.hiddenConfigs[thisConfig]) {
109 delete $scope.hiddenConfigs[thisConfig]; 126 delete $scope.hiddenConfigs[thisConfig];
110 } else { 127 } else {
111 $scope.hiddenConfigs[thisConfig] = true; 128 $scope.hiddenConfigs[thisConfig] = true;
112 } 129 }
113 $scope.areUpdatesPending = true; 130 $scope.areUpdatesPending = true;
114 } 131 }
115 132
133 $scope.setViewingTab = function(tab) {
134 $scope.viewingTab = tab;
135 $scope.updateResults();
136 }
137
116 $scope.localTimeString = function(secondsPastEpoch) { 138 $scope.localTimeString = function(secondsPastEpoch) {
117 var d = new Date(secondsPastEpoch * 1000); 139 var d = new Date(secondsPastEpoch * 1000);
118 return d.toString(); 140 return d.toString();
119 } 141 }
120 142
143 $scope.moveSelectedItems = function() {
144 var itemIndex;
145 var selectedItemsLength = $scope.selectedItems.length;
146 for (var i = 0; i < selectedItemsLength; i++) {
147 itemIndex = $scope.selectedItems[i];
148 $scope.testData[itemIndex].tab = $scope.newTab;
149 }
150 $scope.selectedItems = [];
151 $scope.updateResults();
152 }
153
121 $scope.updateResults = function() { 154 $scope.updateResults = function() {
122 $scope.displayLimit = $scope.displayLimitPending; 155 $scope.displayLimit = $scope.displayLimitPending;
123 // TODO(epoger): Every time we apply a filter, AngularJS creates 156 // TODO(epoger): Every time we apply a filter, AngularJS creates
124 // another copy of the array. Is there a way we can filter out 157 // another copy of the array. Is there a way we can filter out
125 // the items as they are displayed, rather than storing multiple 158 // the items as they are displayed, rather than storing multiple
126 // array copies? (For better performance.) 159 // array copies? (For better performance.)
127 $scope.filteredTestData = 160
128 $filter("orderBy")( 161 if ($scope.viewingTab == $scope.defaultTab) {
129 $filter("removeHiddenItems")( 162 $scope.filteredTestData =
130 $scope.testData, 163 $filter("orderBy")(
131 $scope.hiddenResultTypes, 164 $filter("removeHiddenItems")(
132 $scope.hiddenConfigs 165 $scope.testData,
133 ), 166 $scope.hiddenResultTypes,
134 $scope.sortColumn); 167 $scope.hiddenConfigs,
135 $scope.limitedTestData = $filter("limitTo")( 168 $scope.viewingTab
136 $scope.filteredTestData, $scope.displayLimit); 169 ),
170 $scope.sortColumn);
171 $scope.limitedTestData = $filter("limitTo")(
172 $scope.filteredTestData, $scope.displayLimit);
173 } else {
174 $scope.filteredTestData =
175 $filter("orderBy")(
176 $filter("filter")(
epoger 2013/10/19 01:15:56 In the tabs other than "Unfiled", we don't allow t
177 $scope.testData,
178 {tab: $scope.viewingTab},
179 true
180 ),
181 $scope.sortColumn);
182 $scope.limitedTestData = $filter("limitTo")(
183 $scope.filteredTestData, $scope.displayLimit);
184 }
137 $scope.imageSize = $scope.imageSizePending; 185 $scope.imageSize = $scope.imageSizePending;
138 $scope.areUpdatesPending = false; 186 $scope.areUpdatesPending = false;
139 } 187 }
140 188
141 $scope.sortResultsBy = function(sortColumn) { 189 $scope.sortResultsBy = function(sortColumn) {
142 $scope.sortColumn = sortColumn; 190 $scope.sortColumn = sortColumn;
143 $scope.updateResults(); 191 $scope.updateResults();
144 } 192 }
145 } 193 }
146 ); 194 );
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/static/view.css » ('j') | gm/rebaseline_server/static/view.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698