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

Unified Diff: gm/rebaseline_server/static/loader.js

Issue 26659002: rebaseline_server: extend returned JSON dict to allow for result-editing in coming CL (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: oppa_python_style 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/server.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 11659)
+++ gm/rebaseline_server/static/loader.js (working copy)
@@ -18,11 +18,11 @@
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);
- }
+ var item = unfilteredItems[i];
+ if (!(true == hiddenResultTypes[item.resultType]) &&
+ !(true == hiddenConfigs[item.config])) {
+ filteredItems.push(item);
+ }
}
return filteredItems;
};
@@ -34,27 +34,44 @@
function($scope, $http, $filter) {
$http.get("/results/all").then(
function(response) {
+ $scope.header = response.data.header;
$scope.categories = response.data.categories;
$scope.testData = response.data.testData;
$scope.sortColumn = 'test';
- $scope.hiddenResultTypes = [
- 'failure-ignored', 'no-comparison', 'succeeded'];
- $scope.hiddenConfigs = [];
+ $scope.hiddenResultTypes = {
+ 'failure-ignored': true,
+ 'no-comparison': true,
+ 'succeeded': true,
+ };
+ $scope.hiddenConfigs = {};
+ $scope.selectedItems = {};
$scope.updateResults();
}
);
+ $scope.isItemSelected = function(index) {
+ return (true == $scope.selectedItems[index]);
+ }
+ $scope.toggleItemSelected = function(index) {
+ if (true == $scope.selectedItems[index]) {
+ delete $scope.selectedItems[index];
+ } else {
+ $scope.selectedItems[index] = true;
+ }
+ // unlike other toggle methods below, does not set
+ // $scope.areUpdatesPending = true;
+ }
+
$scope.isHiddenResultType = function(thisResultType) {
- return ($scope.hiddenResultTypes.indexOf(thisResultType) >= 0);
+ return (true == $scope.hiddenResultTypes[thisResultType]);
}
$scope.toggleHiddenResultType = function(thisResultType) {
- var i = $scope.hiddenResultTypes.indexOf(thisResultType);
- if (i >= 0) {
- $scope.hiddenResultTypes.splice(i, 1);
+ if (true == $scope.hiddenResultTypes[thisResultType]) {
+ delete $scope.hiddenResultTypes[thisResultType];
} else {
- $scope.hiddenResultTypes.push(thisResultType);
+ $scope.hiddenResultTypes[thisResultType] = true;
}
$scope.areUpdatesPending = true;
}
@@ -65,14 +82,13 @@
// category.
// But for now, I wanted to see this working. :-)
$scope.isHiddenConfig = function(thisConfig) {
- return ($scope.hiddenConfigs.indexOf(thisConfig) >= 0);
+ return (true == $scope.hiddenConfigs[thisConfig]);
}
$scope.toggleHiddenConfig = function(thisConfig) {
- var i = $scope.hiddenConfigs.indexOf(thisConfig);
- if (i >= 0) {
- $scope.hiddenConfigs.splice(i, 1);
+ if (true == $scope.hiddenConfigs[thisConfig]) {
+ delete $scope.hiddenConfigs[thisConfig];
} else {
- $scope.hiddenConfigs.push(thisConfig);
+ $scope.hiddenConfigs[thisConfig] = true;
}
$scope.areUpdatesPending = true;
}
@@ -84,15 +100,15 @@
// 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);
+ $filter("orderBy")(
+ $filter("removeHiddenItems")(
+ $scope.testData,
+ $scope.hiddenResultTypes,
+ $scope.hiddenConfigs
+ ),
+ $scope.sortColumn);
$scope.limitedTestData = $filter("limitTo")(
- $scope.filteredTestData, $scope.displayLimit);
+ $scope.filteredTestData, $scope.displayLimit);
$scope.imageSize = $scope.imageSizePending;
$scope.areUpdatesPending = false;
}
« no previous file with comments | « gm/rebaseline_server/server.py ('k') | gm/rebaseline_server/static/view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698