From 34546b9c5b5a9be2180e8b4801b72a48feb94d1d Mon Sep 17 00:00:00 2001
From: Trygve Laugstøl <trygvis@inamo.no>
Date: Fri, 18 Jan 2013 16:40:40 +0100
Subject: o timestamp => createdDate in the JSON to be consistent. o Better
 builds list. o Renaming person-avatar to avatar-xl.

---
 src/main/resources/webapp/apps/app.js              |  2 +-
 src/main/resources/webapp/apps/buildApp/build.html |  2 +-
 .../webapp/apps/frontPageApp/badgeList.html        |  2 +-
 .../resources/webapp/apps/frontPageApp/build.html  |  2 +-
 .../webapp/apps/frontPageApp/buildList.html        | 42 ++++++++++++----------
 .../webapp/apps/frontPageApp/frontPageApp.js       | 42 +++++++++++++---------
 .../resources/webapp/apps/frontPageApp/person.html |  6 ++--
 .../webapp/apps/frontPageApp/personList.html       |  2 +-
 .../resources/webapp/apps/jenkinsApp/build.html    |  2 +-
 src/main/resources/webapp/apps/jenkinsApp/job.html |  2 +-
 10 files changed, 59 insertions(+), 45 deletions(-)
 mode change 100644 => 100755 src/main/resources/webapp/apps/jenkinsApp/build.html

(limited to 'src/main/resources')

diff --git a/src/main/resources/webapp/apps/app.js b/src/main/resources/webapp/apps/app.js
index df540f8..a1fd343 100755
--- a/src/main/resources/webapp/apps/app.js
+++ b/src/main/resources/webapp/apps/app.js
@@ -86,7 +86,7 @@ directives.directive('personLink', function () {
   }
 });
 
-directives.directive('personAvatar', function () {
+directives.directive('avatarXl', function () {
   return {
     restrict: 'E',
     scope: {
diff --git a/src/main/resources/webapp/apps/buildApp/build.html b/src/main/resources/webapp/apps/buildApp/build.html
index fec38d2..2a24b16 100755
--- a/src/main/resources/webapp/apps/buildApp/build.html
+++ b/src/main/resources/webapp/apps/buildApp/build.html
@@ -9,7 +9,7 @@
     <table>
       <tr>
         <th>Date</th>
-        <td>{{build.build.timestamp | date:'medium'}}</td>
+        <td>{{build.build.createdDate | date:'medium'}}</td>
       </tr>
       <tr>
         <th>Status</th>
diff --git a/src/main/resources/webapp/apps/frontPageApp/badgeList.html b/src/main/resources/webapp/apps/frontPageApp/badgeList.html
index 6b795bd..c7f1714 100755
--- a/src/main/resources/webapp/apps/frontPageApp/badgeList.html
+++ b/src/main/resources/webapp/apps/frontPageApp/badgeList.html
@@ -27,7 +27,7 @@
           </div>
           <div class="span12">
             <div class="awarded-badge pull-left" ng-repeat="badge in group">
-              <div><person-avatar person="badge.person"></person-avatar></div>
+              <div><avatar-xl person="badge.person"></avatar-xl></div>
 
               <badge-span badge="badge.badge" ></badge-span> <br/>
               <a href="/#/badge/{{badge.badge.uuid}}">More</a>
diff --git a/src/main/resources/webapp/apps/frontPageApp/build.html b/src/main/resources/webapp/apps/frontPageApp/build.html
index 0972758..cbf8f8e 100755
--- a/src/main/resources/webapp/apps/frontPageApp/build.html
+++ b/src/main/resources/webapp/apps/frontPageApp/build.html
@@ -16,7 +16,7 @@
         </tr>
         <tr>
           <th>Duration</th>
-          <td>{{build.build.timestamp | date:'medium'}}</td>
+          <td>{{build.build.createdDate | date:'medium'}}</td>
         </tr>
         </tbody>
       </table>
diff --git a/src/main/resources/webapp/apps/frontPageApp/buildList.html b/src/main/resources/webapp/apps/frontPageApp/buildList.html
index 8fb4a60..ddbffe2 100755
--- a/src/main/resources/webapp/apps/frontPageApp/buildList.html
+++ b/src/main/resources/webapp/apps/frontPageApp/buildList.html
@@ -16,26 +16,32 @@
     }
   </style>
 
-  <div class="row" ng-repeat="build in builds.rows">
-    <div class="span12">
-      <h3>
-        {{build.build.timestamp | date:'medium'}}:
-        <span class="success" ng-show="build.build.success">SUCCESS</span>
-        <span class="error" ng-hide="build.build.success">FAILURE</span>
-        <a class="btn" href="#/build/{{build.build.uuid}}"><i class="icon-chevron-right"></i></a>
-      </h3>
-
-      <!--
-      <h4>Participants</h4>
-      -->
-      <span ng-repeat="p in build.participants">
-        <dogtag-xl person="p"></dogtag-xl>
-      </span>
-    </div>
-  </div>
-
   <div class="row">
     <div class="span12">
+      <div class="row" ng-repeat="g in buildGroups">
+        <x ng-repeat="(date, group) in g">
+          <div class="span12">
+            <h2>{{date | date:'mediumDate'}}</h2>
+          </div>
+          <div class="span12">
+            <table class="table">
+            <tr ng-repeat="build in group" class="{{{true: 'success', false: 'error'}[build.build.success]}}">
+              <td>
+                <h4>
+                  {{build.build.createdDate | date:'shortTime'}}:
+                  {{{true: 'SUCCESS', false: 'FAILURE'}[build.build.success]}}
+                </h4>
+
+                <span ng-repeat="p in build.participants">
+                  <dogtag-xl person="p"></dogtag-xl>
+                </span>
+                <a class="btn pull-right" href="#/build/{{build.build.uuid}}"><i class="icon-chevron-right"></i></a>
+              </td>
+            </tr>
+            </table>
+          </div>
+        </x>
+      </div>
       <ul class="pager">
         <li class="previous" ng-show="builds.startIndex > 0">
           <a ng-click="builds.prev()">&larr; Prev</a>
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) {
diff --git a/src/main/resources/webapp/apps/frontPageApp/person.html b/src/main/resources/webapp/apps/frontPageApp/person.html
index 5da1b20..aef245d 100755
--- a/src/main/resources/webapp/apps/frontPageApp/person.html
+++ b/src/main/resources/webapp/apps/frontPageApp/person.html
@@ -3,7 +3,7 @@
   <navbar/>
 
   <div class="page-header">
-    <h1><person-avatar person="person.person"></person-avatar> {{person.person.name}}</h1>
+    <h1><avatar-xl person="person.person"></avatar-xl> {{person.person.name}}</h1>
   </div>
 
   <ul class="nav nav-tabs">
@@ -49,7 +49,7 @@
       <table class="table">
         <tbody>
         <tr ng-repeat="build in recentBuilds" class="{{{true: 'success', false: 'error'}[build.success]}}">
-          <td>{{build.timestamp | date:'medium'}}</td>
+          <td>{{build.createdDate | date:'medium'}}</td>
           <td>{{{true: 'Success', false: 'Failure'}[build.success]}}</td>
           <td><a href="#/build/{{build.uuid}}">Details</a></td>
         </tr>
@@ -69,7 +69,7 @@
       </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.createdDate | date:'medium'}}</td>
         <td>{{build.success}}</td>
         <td>
           <a class="btn btn-small" href="#/build/{{build.uuid}}"><i class="icon-chevron-right"></i></a>
diff --git a/src/main/resources/webapp/apps/frontPageApp/personList.html b/src/main/resources/webapp/apps/frontPageApp/personList.html
index 9f977ee..d229659 100755
--- a/src/main/resources/webapp/apps/frontPageApp/personList.html
+++ b/src/main/resources/webapp/apps/frontPageApp/personList.html
@@ -44,7 +44,7 @@
       <div class="row" ng-repeat="group in personGroups" ng-show="persons.showResults()">
         <div class="span3" ng-repeat="person in group" style="padding-bottom: 1em">
           <div class="row">
-            <person-avatar person="person.person"></person-avatar>
+            <avatar-xl person="person.person"></avatar-xl>
             <a href="/#/person/{{person.person.uuid}}">{{person.person.name}}</a>
             <br/>
             <span ng-repeat="level in person.badges | countBadgeByLevel | gz">
diff --git a/src/main/resources/webapp/apps/jenkinsApp/build.html b/src/main/resources/webapp/apps/jenkinsApp/build.html
old mode 100644
new mode 100755
index 7239c90..db07f44
--- a/src/main/resources/webapp/apps/jenkinsApp/build.html
+++ b/src/main/resources/webapp/apps/jenkinsApp/build.html
@@ -18,7 +18,7 @@
     <tbody>
     <tr>
       <th>Timestamp</th>
-      <td>{{details.build.timestamp | date:'medium'}}</td>
+      <td>{{details.build.createdDate | date:'medium'}}</td>
     </tr>
     <tr>
       <th>Number</th>
diff --git a/src/main/resources/webapp/apps/jenkinsApp/job.html b/src/main/resources/webapp/apps/jenkinsApp/job.html
index 8942ab7..e0c1a10 100755
--- a/src/main/resources/webapp/apps/jenkinsApp/job.html
+++ b/src/main/resources/webapp/apps/jenkinsApp/job.html
@@ -38,7 +38,7 @@
     </thead>
     <tbody>
     <tr ng-repeat="build in builds.rows" class="{{{true: 'success', false: 'error'}[build.success]}}">
-      <td>{{build.timestamp | date:'medium'}}</td>
+      <td>{{build.createdDate | date:'medium'}}</td>
       <td>{{build.result}}</td>
       <td><a class="btn" ng-click="showBuild(build.uuid)"><i class="icon-chevron-right"></i></a></td>
     </tr>
-- 
cgit v1.2.3