summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/jitterbug.pm27
-rw-r--r--public/css/style.css16
-rw-r--r--views/index.tt49
3 files changed, 72 insertions, 20 deletions
diff --git a/lib/jitterbug.pm b/lib/jitterbug.pm
index 8110def..e4ebab2 100644
--- a/lib/jitterbug.pm
+++ b/lib/jitterbug.pm
@@ -12,9 +12,30 @@ load_app 'jitterbug::WebService', prefix => '/api';
 load_app 'jitterbug::Task',       prefix => '/task';
 
 get '/' => sub {
-    my @projects = redis->smembers(key_projects);
-    my @builds = redis->smembers(key_tasks);
-    template 'index', {projects => \@projects, builds => \@builds};
+
+    my @proj_name = redis->smembers(key_projects);
+    my @projects  = ();
+
+    foreach (@proj_name) {
+        my $proj = redis->get(key_project($_));
+        next unless $proj;
+        debug("on a $proj");
+        my $desc = from_json($proj);
+        my @ids  = redis->smembers( key_builds_project($_) );
+        my $res  = redis->get( pop @ids );
+        if ($res) {
+            my $last_build = from_json($res);
+            $desc->{last_build} = $last_build;
+        }
+        push @projects, $desc;
+    }
+
+    @projects =
+      sort { $b->{last_build}->{timestamp} cmp $a->{last_build}->{timestamp} }
+      @projects;
+
+    my @tasks = redis->smembers(key_tasks);
+    template 'index', {projects => \@projects, tasks => \@tasks};
 };
 
 true;
diff --git a/public/css/style.css b/public/css/style.css
index e3a6e97..37e01a5 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -29,7 +29,7 @@ text-decoration: none;
 
 #page {
 background-color: #ddd;
-width: 750px;
+width: 80%;
 margin: auto;
 margin-left: auto;
 padding-left: 0px;
@@ -41,7 +41,7 @@ background-color: white;
 border: 3px solid #aaa;
 border-top: none;
 padding: 25px;
-width: 750px;
+width: 90%;
 }
 
 #sidebar {
@@ -235,3 +235,15 @@ font-family:Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",m
 .commit .builds span {font-size:110%;font-weight: bolder;}
 .commit .builds span .PASS{color:green}
 .commit .builds span .FAILED{color:red}
+
+.repo{border:1px solid #d8d8d8;background-color:#f0f0f0;}
+
+ul.repositories{margin:0;}
+ul.repositories>li{list-style-type:none;margin:0 0 10px 0;padding:8px 10px 0 10px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
+ul.repositories h3{margin:0;font-size:14px;white-space:nowrap;}
+ul.repositories p.desc{margin:0 0 3px 0;font-size:12px;color:#444;}
+ul.repositories p.updated-at{margin:0;font-size:11px;color:#888;}
+
+
+.columns .first{float:left;width:450px;}
+.columns .last{float:right;width:450px;}
diff --git a/views/index.tt b/views/index.tt
index 58b675a..afebb93 100644
--- a/views/index.tt
+++ b/views/index.tt
@@ -1,22 +1,41 @@
 <div id="page">
+  <div id="content">
+    <h2>Dashboard</h2>
 
-<div id="content">
-<h2>Dashboard</h2>
+    <div class="columns">
 
-<h3>Projects</h3>
+      <div class="first"> 
+        <h3>Repositories</h3>
 
-<ul>
-  : for $projects -> $project {
-  <li><a href="<: $uri_base :>project/<: $project :>"><: $project :></a></li>
-  : }
-</ul>
+        <ul class="repositories">
+          : for $projects -> $project {
+          <li class="repo">
+            <h3><a href="<: $uri_base :>project/<: $project.name :>"><: $project.name :></a></h3>
+            <div class="repo-body">
+              <p class="desc"><: $project.description :></p>
+              <p class="updated-at">last updated at <: $project.last_build.timestamp :></p>
+              <div class="last-builds">
+                :for $project.last_build.version.keys() -> $version {
+                  <a href="<: $uri_base :>/api/build/<: $project.name :>/<: $project.last_build.commit :>/<: $version :>"><: $version :></a> <span class="<: $project.last_build.version[$version] :>"><: $project.last_build.version[$version] :></span>
+                :}
+              </div>
+            </div>
+          </li>
+          : }
+        </ul>
+      </div>
 
-<h3>Builds pending</h3>
+      <div class="last">
+        <h3>Builds pending</h3>
 
-<ul>
-  : for $builds -> $build {
-  <li><a href="<: $uri_base :>task/<: $build :>"><: $build :></a></li>
-  : }
-</ul>
-</div>
+        <ul>
+          : for $builds -> $build {
+          <li><a href="<: $uri_base :>task/<: $build :>"><: $build :></a></li>
+          : }
+        </ul>
+      </div>
+
+    </div>
+    <div style="clear:both;"></div>
+  </div>
 </div>