OLD | NEW |
---|---|
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 |
(...skipping 16 matching lines...) Expand all Loading... | |
27 return filteredItems; | 27 return filteredItems; |
28 }; | 28 }; |
29 } | 29 } |
30 ); | 30 ); |
31 | 31 |
32 Loader.controller( | 32 Loader.controller( |
33 'Loader.Controller', | 33 'Loader.Controller', |
34 function($scope, $http, $filter) { | 34 function($scope, $http, $filter) { |
35 $http.get("/results/all").then( | 35 $http.get("/results/all").then( |
36 function(response) { | 36 function(response) { |
37 $scope.header = response.data.header; | |
37 $scope.categories = response.data.categories; | 38 $scope.categories = response.data.categories; |
38 $scope.testData = response.data.testData; | 39 $scope.testData = response.data.testData; |
39 $scope.sortColumn = 'test'; | 40 $scope.sortColumn = 'test'; |
40 | 41 |
41 $scope.hiddenResultTypes = [ | 42 $scope.hiddenResultTypes = [ |
42 'failure-ignored', 'no-comparison', 'succeeded']; | 43 'failure-ignored', 'no-comparison', 'succeeded']; |
43 $scope.hiddenConfigs = []; | 44 $scope.hiddenConfigs = []; |
45 $scope.selectedItems = []; | |
jcgregorio
2013/10/09 14:41:48
Making this an {} would simplify the code since yo
epoger
2013/10/09 15:35:30
Great idea! Done.
| |
44 | 46 |
45 $scope.updateResults(); | 47 $scope.updateResults(); |
46 } | 48 } |
47 ); | 49 ); |
48 | 50 |
51 $scope.isItemSelected = function(index) { | |
52 return ($scope.selectedItems.indexOf(index) >= 0); | |
jcgregorio
2013/10/09 14:41:48
If you don't switch to using a map, then this shou
epoger
2013/10/09 15:35:30
Switched to map.
| |
53 } | |
54 $scope.toggleItemSelected = function(index) { | |
55 var i = $scope.selectedItems.indexOf(index); | |
56 if (i >= 0) { | |
57 $scope.selectedItems.splice(i, 1); | |
58 } else { | |
59 $scope.selectedItems.push(index); | |
60 } | |
61 // unlike other toggle methods below, does not set | |
62 // $scope.areUpdatesPending = true; | |
63 } | |
64 | |
49 $scope.isHiddenResultType = function(thisResultType) { | 65 $scope.isHiddenResultType = function(thisResultType) { |
50 return ($scope.hiddenResultTypes.indexOf(thisResultType) >= 0); | 66 return ($scope.hiddenResultTypes.indexOf(thisResultType) >= 0); |
51 } | 67 } |
52 $scope.toggleHiddenResultType = function(thisResultType) { | 68 $scope.toggleHiddenResultType = function(thisResultType) { |
53 var i = $scope.hiddenResultTypes.indexOf(thisResultType); | 69 var i = $scope.hiddenResultTypes.indexOf(thisResultType); |
54 if (i >= 0) { | 70 if (i >= 0) { |
55 $scope.hiddenResultTypes.splice(i, 1); | 71 $scope.hiddenResultTypes.splice(i, 1); |
56 } else { | 72 } else { |
57 $scope.hiddenResultTypes.push(thisResultType); | 73 $scope.hiddenResultTypes.push(thisResultType); |
58 } | 74 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 $scope.imageSize = $scope.imageSizePending; | 112 $scope.imageSize = $scope.imageSizePending; |
97 $scope.areUpdatesPending = false; | 113 $scope.areUpdatesPending = false; |
98 } | 114 } |
99 | 115 |
100 $scope.sortResultsBy = function(sortColumn) { | 116 $scope.sortResultsBy = function(sortColumn) { |
101 $scope.sortColumn = sortColumn; | 117 $scope.sortColumn = sortColumn; |
102 $scope.updateResults(); | 118 $scope.updateResults(); |
103 } | 119 } |
104 } | 120 } |
105 ); | 121 ); |
OLD | NEW |