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

Unified 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: todos_n_tabs 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/rebaseline_server/results.py ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/static/loader.js
===================================================================
--- gm/rebaseline_server/static/loader.js (revision 11573)
+++ gm/rebaseline_server/static/loader.js (working copy)
@@ -7,16 +7,99 @@
'Loader',
[]
);
+
+// TODO(epoger): Combine ALL of our filtering operations (including
+// truncation) into this one filter, so that runs most efficiently?
+// (We would have to make sure truncation still took place after
+// sorting, though.)
+Loader.filter(
+ 'removeHiddenItems',
+ function() {
+ return function(unfilteredItems, hiddenResultTypes, hiddenConfigs) {
+ var filteredItems = [];
+ for (var i = 0; i < unfilteredItems.length; i++) {
+ var item = unfilteredItems[i];
+ if ((hiddenResultTypes.indexOf(item.resultType) < 0) &&
+ (hiddenConfigs.indexOf(item.config) < 0)) {
+ filteredItems.push(item);
+ }
+ }
+ return filteredItems;
+ };
+ }
+);
+
Loader.controller(
'Loader.Controller',
- function($scope, $http) {
+ function($scope, $http, $filter) {
$http.get("/results/all").then(
function(response) {
$scope.categories = response.data.categories;
$scope.testData = response.data.testData;
$scope.sortColumn = 'test';
- $scope.showResultsOfType = 'failed';
+
+ $scope.hiddenResultTypes = [
+ 'failure-ignored', 'no-comparison', 'succeeded'];
+ $scope.hiddenConfigs = [];
+
+ $scope.updateResults();
}
);
+
+ $scope.isHiddenResultType = function(thisResultType) {
+ return ($scope.hiddenResultTypes.indexOf(thisResultType) >= 0);
+ }
+ $scope.toggleHiddenResultType = function(thisResultType) {
+ var i = $scope.hiddenResultTypes.indexOf(thisResultType);
+ if (i >= 0) {
+ $scope.hiddenResultTypes.splice(i, 1);
+ } else {
+ $scope.hiddenResultTypes.push(thisResultType);
+ }
+ $scope.areUpdatesPending = true;
+ }
+
+ // TODO(epoger): Rather than maintaining these as hard-coded
+ // variants of isHiddenResultType and toggleHiddenResultType, we
+ // should create general-purpose functions that can work with ANY
+ // category.
+ // But for now, I wanted to see this working. :-)
+ $scope.isHiddenConfig = function(thisConfig) {
+ return ($scope.hiddenConfigs.indexOf(thisConfig) >= 0);
+ }
+ $scope.toggleHiddenConfig = function(thisConfig) {
+ var i = $scope.hiddenConfigs.indexOf(thisConfig);
+ if (i >= 0) {
+ $scope.hiddenConfigs.splice(i, 1);
+ } else {
+ $scope.hiddenConfigs.push(thisConfig);
+ }
+ $scope.areUpdatesPending = true;
+ }
+
+ $scope.updateResults = function() {
+ $scope.displayLimit = $scope.displayLimitPending;
+ // TODO(epoger): Every time we apply a filter, AngularJS creates
+ // another copy of the array. Is there a way we can filter out
+ // the items as they are displayed, rather than storing multiple
+ // array copies? (For better performance.)
+ $scope.filteredTestData =
+ $filter("orderBy")(
+ $filter("removeHiddenItems")(
+ $scope.testData,
+ $scope.hiddenResultTypes,
+ $scope.hiddenConfigs
+ ),
+ $scope.sortColumn);
+ $scope.limitedTestData = $filter("limitTo")(
+ $scope.filteredTestData, $scope.displayLimit);
+ $scope.imageSize = $scope.imageSizePending;
+ $scope.areUpdatesPending = false;
+ }
+
+ $scope.sortResultsBy = function(sortColumn) {
+ $scope.sortColumn = sortColumn;
+ $scope.updateResults();
+ }
}
);
« no previous file with comments | « gm/rebaseline_server/results.py ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698