diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-18 16:40:40 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-18 16:40:40 +0100 |
commit | 34546b9c5b5a9be2180e8b4801b72a48feb94d1d (patch) | |
tree | b0cc7cb6fadaf640f6bb5dd7b062192100c6a944 /src/main/resources/webapp/apps/frontPageApp/frontPageApp.js | |
parent | 2baff5fc9a0564c5e150cf10a1cfd2edd5b3d868 (diff) | |
download | esper-testing-34546b9c5b5a9be2180e8b4801b72a48feb94d1d.tar.gz esper-testing-34546b9c5b5a9be2180e8b4801b72a48feb94d1d.tar.bz2 esper-testing-34546b9c5b5a9be2180e8b4801b72a48feb94d1d.tar.xz esper-testing-34546b9c5b5a9be2180e8b4801b72a48feb94d1d.zip |
o timestamp => createdDate in the JSON to be consistent.
o Better builds list.
o Renaming person-avatar to avatar-xl.
Diffstat (limited to 'src/main/resources/webapp/apps/frontPageApp/frontPageApp.js')
-rwxr-xr-x | src/main/resources/webapp/apps/frontPageApp/frontPageApp.js | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js index fb3c22c..be048d4 100755 --- a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js +++ b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js @@ -34,25 +34,26 @@ function groupBy(array, size) { return groups; } -function BadgeListCtrl($scope, Badge, PagingTableService) { - var personsWatcher = function () { - var withDay = _.map($scope.badges.rows, function(badge) { - badge.day = new Date(badge.badge.createdDate).clearTime().getTime(); -// badge.day.clearTime(); - return badge; - }); +function groupByDay(array, accessor) { + var withDay = _.map(array, function(item) { + item.day = new Date(accessor(item)).clearTime().getTime(); + return item; + }); - var byDay = _.groupBy(withDay, 'day'); -// console.log("byDay", byDay); + var byDay = _.groupBy(withDay, 'day'); - byDay = _.map(byDay, function(value, key) { - var o = {}; - o[key] = value; - return o; - }); + byDay = _.map(byDay, function(value, key) { + var o = {}; + o[key] = value; + return o; + }); -// byDay = _.toArray(byDay).reverse(); -// console.log("byDay", byDay); + return byDay; +} + +function BadgeListCtrl($scope, Badge, PagingTableService) { + var personsWatcher = function () { + var byDay = groupByDay($scope.badges.rows, function(badge) { return badge.badge.createdDate}); $scope.badgeGroups = byDay; }; @@ -121,7 +122,14 @@ function PersonCtrl($scope, $routeParams, Person, Build, JenkinsUser, PagingTabl } function BuildListCtrl($scope, Build, PagingTableService) { - $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"})); + var watcher = function () { + $scope.buildGroups = groupByDay($scope.builds.rows, function(build) { return build.build.createdDate}); + }; + + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"}), + { count: 100, watcher: watcher }); + + $scope.buildGroups = []; } function BuildCtrl($scope, $routeParams, Build, PagingTableService) { |