diff options
Diffstat (limited to 'src/main/resources/webapp/apps/frontPageApp')
7 files changed, 414 insertions, 0 deletions
diff --git a/src/main/resources/webapp/apps/frontPageApp/badge.html b/src/main/resources/webapp/apps/frontPageApp/badge.html new file mode 100755 index 0000000..92fc7ae --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/badge.html @@ -0,0 +1,30 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>Badge</h1> + </div> + + <div class="row"> + <div class="span12"> + The badge <badge-span badge="badge.badge"></badge-span> was awarded to <person-link person="badge.person"></person-link> at + {{badge.badge.createdDate | date:'medium'}}. + </div> + </div> + + <div class="row" ng-switch="badge.badge.name"> + <div class="span12" ng-switch-when="UNBREAKABLE"> + <h2>Details</h2> + <p> + The badge was awarded for having {{badge.personalBadge.builds.length}} successful builds in a row: + </p> + <ul class="unstyled"> + <li ng-repeat="b in badge.personalBadge.builds"> + <a class="btn" href="/build/{{b}}">{{$index + 1}} <i class="icon-chevron-right"></i></a> + </li> + </ul> + </div> + </div> + +</div> diff --git a/src/main/resources/webapp/apps/frontPageApp/badgeList.html b/src/main/resources/webapp/apps/frontPageApp/badgeList.html new file mode 100755 index 0000000..7671a55 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/badgeList.html @@ -0,0 +1,46 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>Badges Awarded</h1> + </div> + + <style> + .awarded-badge { + text-align: center; + margin-bottom: 1em; + margin-right: 1em; + } + + .avatar-image { + margin-bottom: 1em; + } + </style> + + <div class="row"> + <div class="span12"> + <div class="row" ng-repeat="(date, group) in badgeGroups"> + <div class="span12"> + <h2>{{date | date:'mediumDate'}}</h2> + </div> + <div class="span12"> + <div class="awarded-badge pull-left" ng-repeat="badge in group"> + <div><person-avatar person="badge.person"></person-avatar></div> + + <badge-span badge="badge.badge" ></badge-span> <br/> + <!--was awarded to<br/>--> + </div> + </div> + </div> + <ul class="pager"> + <li class="previous" ng-show="persons.startIndex > 0"> + <a ng-click="persons.prev()">← Prev</a> + </li> + <li class="next"> + <a ng-click="persons.next()">Next →</a> + </li> + </ul> + </div> + </div> +</div> diff --git a/src/main/resources/webapp/apps/frontPageApp/buildList.html b/src/main/resources/webapp/apps/frontPageApp/buildList.html new file mode 100755 index 0000000..13a1dc3 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/buildList.html @@ -0,0 +1,50 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>Builds</h1> + </div> + + <style> + .avatar-image { + /* This has to match bootstrap's row margin. */ + margin-left: 30px; + padding-right: 1em; + float: left; + margin-top: 0; + } + </style> + + <div class="row"> + <div class="span12"> + <table class="table"> + <tbody ng-repeat="build in builds.rows"> + <tr class="{{{true: 'success', false: 'error'}[build.build.success]}}"> + <td>{{build.build.timestamp | date:'medium'}}</td> + <td> + <span ng-show="build.build.success">SUCCESS</span> + <span ng-hide="build.build.success">FAILURE</span> + </td> + <td><a class="btn" href="/build/{{build.build.uuid}}"><i class="icon-chevron-right"></i></a></td> + </tr> + <tr> + <td colspan="3"> + <span ng-repeat="p in build.participants"> + <person-avatar person="p"/> + </span> + </td> + </tr> + </tbody> + </table> + <ul class="pager"> + <li class="previous" ng-show="builds.startIndex > 0"> + <a ng-click="builds.prev()">← Prev</a> + </li> + <li class="next"> + <a ng-click="builds.next()">Next →</a> + </li> + </ul> + </div> + </div> +</div> diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPage.html b/src/main/resources/webapp/apps/frontPageApp/frontPage.html new file mode 100755 index 0000000..c3db55c --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/frontPage.html @@ -0,0 +1,31 @@ +<div class="container"> + <navbar/> + + <div class="page-header"> + <h1>Recent</h1> + </div> + + <div class="row"> + <div class="span6"> + <h3>Badges</h3> + + <div> + <ul class="unstyled"> + <li ng-repeat="b in recentBadges"> + <badge badge-detail="b"/> + </li> + </ul> + </div> + </div> + + <div class="span6"> + <h3>Newcomers</h3> + + <ul class="unstyled"> + <li ng-repeat="person in persons"> + <a href="#/person/{{person.person.uuid}}">{{person.person.name}}</a> + </li> + </ul> + </div> + </div> +</div> diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js new file mode 100755 index 0000000..6f80d0f --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js @@ -0,0 +1,110 @@ +'use strict'; + +var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'build', 'pagingTableService', 'core.directives']).config(function ($routeProvider) { + $routeProvider. + when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}). + when('/badge/', {controller: BadgeListCtrl, templateUrl: '/apps/frontPageApp/badgeList.html?noCache=' + noCache}). + when('/badge/:badgeUuid', {controller: BadgeCtrl, templateUrl: '/apps/frontPageApp/badge.html?noCache=' + noCache}). + when('/person/', {controller: PersonListCtrl, templateUrl: '/apps/frontPageApp/personList.html?noCache=' + noCache}). + when('/person/:personUuid', {controller: PersonCtrl, templateUrl: '/apps/frontPageApp/person.html?noCache=' + noCache}). + when('/build/', {controller: BuildListCtrl, templateUrl: '/apps/frontPageApp/buildList.html?noCache=' + noCache}); +}); + +function FrontPageCtrl($scope, Person, Badge) { + $scope.persons = Person.query(); + $scope.recentBadges = Badge.query(); +} + +function groupBy(array, size) { + var group = []; + var groups = []; + angular.forEach(array, function (element) { + group.push(element); + if (group.length == size) { + groups.push(group); + group = []; + } + }); + + if (group.length != 0) { + groups.push(group); + } + return groups; +} + +function BadgeListCtrl($scope, Badge, PagingTableService) { + var groupSize = 6; + + 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; + }); + + var byDay = _.groupBy(withDay, 'day'); + console.log("byDay", byDay); +// var dateGroups = _.map(byDay, function(group, date) { +// return {date: groupBy(group, groupSize)} +// }); + + $scope.badgeGroups = byDay; + }; + + $scope.badges = PagingTableService.create($scope, PagingTableService.defaultCallback(Badge), + {count: groupSize * 6, watcher: personsWatcher}); + + $scope.badgeGroups = []; +} + +function BadgeCtrl($scope, $routeParams, Badge) { + var badgeUuid = $routeParams.badgeUuid; + Badge.get({uuid: badgeUuid}, function (badge) { + $scope.badge = badge; + }); +} + +function PersonListCtrl($scope, Person, PagingTableService) { + var groupSize = 4; + var personsWatcher = function () { + $scope.personGroups = groupBy($scope.persons.rows, groupSize); + }; + + $scope.persons = PagingTableService.create($scope, PagingTableService.defaultCallback(Person, {orderBy: "name"}), + {count: groupSize * 6, watcher: personsWatcher}); + + $scope.personGroups = []; +} + +function PersonCtrl($scope, $routeParams, Person, Build, PagingTableService) { + var personUuid = $routeParams.personUuid; + + $scope.mode = 'overview'; + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {person: personUuid})); + + $scope.setMode = function(mode) { + $scope.mode = mode; + switch(mode) { + case 'builds': + var builds = $scope.builds; + + console.log("$scope.builds.length=" + builds.rows.length); + if (builds.rows.length == 0) { + $scope.builds.first(); + } + break; + } + }; + + Person.get({uuid: personUuid}, function (person) { + $scope.person = person; + }); + + Build.query({person: personUuid}, function (builds) { + $scope.recentBuilds = builds; + }); +} + +function BuildListCtrl($scope, Build, PagingTableService) { + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"})); +} diff --git a/src/main/resources/webapp/apps/frontPageApp/person.html b/src/main/resources/webapp/apps/frontPageApp/person.html new file mode 100755 index 0000000..ba5c18d --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/person.html @@ -0,0 +1,100 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>{{person.person.name}}</h1> + </div> + + <ul class="nav nav-tabs"> + <li ng-class="{active: mode == 'overview'}"><a ng-click="setMode('overview')">Overview</a></li> + <li ng-class="{active: mode == 'builds'}"><a ng-click="setMode('builds')">Builds</a></li> + </ul> + + <div id="overview" ng-show="mode == 'overview'" class="row"> + <div class="span6"> + <h3>Upcoming</h3> + <table> + <tr ng-repeat="badge in person.badgesInProgress"> + <td style="padding-right: 1em">{{badge.name}}</td> + <td style="width: 100%"> + <div class="progress" style="margin-bottom: 0;" title="Progress: {{badge.progress}} of {{badge.goal}}"> + <div class="bar" style="width: {{badge.progress / badge.goal * 100}}%;"></div> + </div> + </td> + </tr> + </table> + + <h3>Badges</h3> + <ul class="unstyled"> + <li ng-repeat="badge in person.badges"> + <!-- + <span class="badge-level-{{badge.level}} badge">{{badge.name}}</span> + --> + <strong>{{badge.name}}</strong> + <!-- + <i class="icon-user ng-class: {{{1: 'badge-level-1', 2: 'badge-level-2', 3: 'badge-level-3'}[badge.level]}}"></i> + --> + <span class="badge-level-{{badge.level}} badge"> + <i class="icon-user"></i> + </span> + + {{badge.createdDate | date:'medium'}} + </li> + </ul> + </div> + <div class="span6"> + <h3>Recent builds</h3> + <table class="table"> + <thead> + <!-- + <tr> + <th>Date</th> + <th>Success</th> + <th></th> + </tr> + --> + </thead> + <tbody> + <tr ng-repeat="build in recentBuilds" class="{{{true: 'success', false: 'error'}[build.success]}}"> + <td>{{build.timestamp | date:'medium'}}</td> + <td>{{{true: 'Success', false: 'Failure'}[build.success]}}</td> + <td><a href="/build/{{build.uuid}}">Details</a></td> + </tr> + </tbody> + </table> + </div> + </div> + + <div id="builds" ng-show="mode == 'builds'"> + <h3>Builds</h3> + <table class="table"> + <thead> + <tr> + <th>Date</th> + <th>Success</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="build in builds.rows" class="{{{true: 'build-success', false: 'build-error'}[build.success]}}"> + <td>{{build.timestamp | date:'medium'}}</td> + <td>{{build.success}}</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"> + <ul class="pager"> + <li class="previous" ng-class="{disabled: builds.startIndex == 0}"> + <a ng-click="builds.prev()">← Older</a> + </li> + <li class="next"> + <a ng-click="builds.next()">Newer →</a> + </li> + </ul> + </td> + </tr> + </tfoot> + </table> + </div> +</div> diff --git a/src/main/resources/webapp/apps/frontPageApp/personList.html b/src/main/resources/webapp/apps/frontPageApp/personList.html new file mode 100755 index 0000000..5d7d8c6 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/personList.html @@ -0,0 +1,47 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>People</h1> + </div> + + <style> + .avatar-image { + /* This has to match bootstrap's row margin. */ + margin-left: 30px; + padding-right: 1em; + float: left; + margin-top: 0; + + /* This has to match the Gravatar image */ + width: 80px; + height: 80px; + } + </style> + + <div class="row"> + <div class="span12"> + <div class="row" ng-repeat="group in personGroups"> + <div class="span3" ng-repeat="person in group" style="padding-bottom: 1em"> + <div class="row"> + <person-avatar person="person.person"></person-avatar> + <a href="/#/person/{{person.person.uuid}}">{{person.person.name}}</a> + <br/> + <span ng-repeat="level in person.badges | countBadgeByLevel | gz"> + <span class="badge-inverse badge-level-{{$index + 1}} badge"><i class="icon-user"></i> x {{level}}</span> + </span> + </div> + </div> + </div> + <ul class="pager"> + <li class="previous" ng-show="persons.startIndex > 0"> + <a ng-click="persons.prev()">← Prev</a> + </li> + <li class="next"> + <a ng-click="persons.next()">Next →</a> + </li> + </ul> + </div> + </div> +</div> |