[Bps-public-commit] smokingit branch, anna, updated. bde0a2d9e85a0597ed04e072441898cdf82fae29

Thomas Sibley trs at bestpractical.com
Fri Jun 14 16:41:56 EDT 2013


The branch, anna has been updated
       via  bde0a2d9e85a0597ed04e072441898cdf82fae29 (commit)
      from  9c237d295c453d70d7034376560c3e0a63a99bcb (commit)

Summary of changes:
 lib/Smokingit/View.pm             | 107 +++++++++++++++++++++++++++++++++-----
 lib/Smokingit/View/Project.pm     |  50 +-----------------
 share/web/static/css/app-late.css |  15 ++++++
 3 files changed, 110 insertions(+), 62 deletions(-)

- Log -----------------------------------------------------------------
commit bde0a2d9e85a0597ed04e072441898cdf82fae29
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jun 14 13:41:43 2013 -0700

    Show the global test queue on the front page

diff --git a/lib/Smokingit/View.pm b/lib/Smokingit/View.pm
index 8b30fa0..224781d 100644
--- a/lib/Smokingit/View.pm
+++ b/lib/Smokingit/View.pm
@@ -22,21 +22,33 @@ alias Smokingit::View::GitHub under '/';
 
 template '/index.html' => page {
     page_title is 'Projects';
-    my $projects = Smokingit::Model::ProjectCollection->new;
-    $projects->unlimit;
-    if ($projects->count) {
-        h2 { "Existing projects" };
-        ul {
-            while (my $p = $projects->next) {
-                li {
-                    hyperlink(
-                        label => $p->name,
-                        url => "/project/".$p->name."/",
-                    );
+
+    div {
+        id is "project-list";
+        my $projects = Smokingit::Model::ProjectCollection->new;
+        $projects->unlimit;
+        if ($projects->count) {
+            h2 { "Existing projects" };
+            ul {
+                while (my $p = $projects->next) {
+                    li {
+                        hyperlink(
+                            label => $p->name,
+                            url => "/project/".$p->name."/",
+                        );
+                    }
                 }
-            }
-        };
-    }
+            };
+        }
+    };
+
+    div {
+        id is "right-bar";
+        render_region(
+            name => "planned",
+            path => "/fragments/planned",
+        );
+    };
 
     my $project = Smokingit::Model::Project->new;
     return unless $project->current_user_can("create");
@@ -56,4 +68,71 @@ template '/index.html' => page {
     };
 };
 
+template '/fragments/planned' => sub {
+    my $planned = Smokingit::Model::SmokeResultCollection->queued;
+    div {
+        id is "all-planned-tests";
+        h2 { "Planned tests" };
+        span {
+            class is "commitlist";
+            while (my $test = $planned->next) {
+                test_result($test, show_project => 1);
+            }
+        };
+    };
+    Jifty->subs->update_on( topic => "test_queued" );
+    Jifty->subs->update_on( topic => "test_result" );
+};
+
+sub test_result {
+    my $test = shift;
+    my %opts = ( show_project => 0, @_ );
+    my ($status, $msg, $in) = $test->commit->status($test);
+    div {
+        class is $test->commit->sha." config-".$test->configuration->id." commit $status";
+        if ($status =~ /^(untested|queued|testing|broken)$/) {
+            span {
+                attr { class => "spacer" };
+                outs_raw(" ")
+            } if Jifty->web->current_user->id;
+            span {
+                attr { class => "okbox $status config-".$test->configuration->id, title => $msg };
+                outs_raw($in || " ")
+            };
+            span {
+                attr { class => "sha", title => $msg };
+                $test->commit->short_sha
+            };
+        } else {
+            span {
+                { class is "retestme" };
+                my $sha = $test->commit->sha;
+                my $config = $test->configuration->id;
+                js_handlers {
+                    onclick => "pubsub.send({type:'jifty.action',class:'Test',arguments:{commit:'$sha\[$config]'}})"
+                };
+                outs_raw " ";
+            } if Jifty->web->current_user->id;
+            hyperlink(
+                class   => "okbox $status",
+                label   => " ",
+                escape_label => 0,
+                url     => "/test/".$test->commit->sha."/".$test->configuration->name,
+                tooltip => $msg,
+            );
+            hyperlink(
+                tooltip => $msg,
+                class   => "sha",
+                url     => "/test/".$test->commit->sha."/".$test->configuration->name,
+                label   => $test->commit->short_sha,
+            );
+        }
+        my $branchname = $test->branch_name;
+        $branchname = $test->project->name.":$branchname"
+            if $opts{show_project};
+        outs( " on $branchname using ".$test->configuration->name );
+    }
+};
+
+
 1;
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index 498c262..f95e58f 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -85,7 +85,7 @@ template '/fragments/project/finished' => sub {
         span {
             class is "commitlist";
             while (my $test = $tests->next) {
-                test_result($test);
+                Smokingit::View::test_result($test);
             }
         };
     };
@@ -104,7 +104,7 @@ template '/fragments/project/planned' => sub {
         span {
             class is "commitlist";
             while (my $test = $planned->next) {
-                test_result($test);
+                Smokingit::View::test_result($test);
             }
         };
     };
@@ -112,52 +112,6 @@ template '/fragments/project/planned' => sub {
     Jifty->subs->update_on( topic => "test_result" );
 };
 
-sub test_result {
-    my $test = shift;
-    my ($status, $msg, $in) = $test->commit->status($test);
-    div {
-        class is $test->commit->sha." config-".$test->configuration->id." commit $status";
-        if ($status =~ /^(untested|queued|testing|broken)$/) {
-            span {
-                attr { class => "spacer" };
-                outs_raw(" ")
-            } if Jifty->web->current_user->id;
-            span {
-                attr { class => "okbox $status config-".$test->configuration->id, title => $msg };
-                outs_raw($in || " ")
-            };
-            span {
-                attr { class => "sha", title => $msg };
-                $test->commit->short_sha
-            };
-        } else {
-            span {
-                { class is "retestme" };
-                my $sha = $test->commit->sha;
-                my $config = $test->configuration->id;
-                js_handlers {
-                    onclick => "pubsub.send({type:'jifty.action',class:'Test',arguments:{commit:'$sha\[$config]'}})"
-                };
-                outs_raw " ";
-            } if Jifty->web->current_user->id;
-            hyperlink(
-                class   => "okbox $status",
-                label   => " ",
-                escape_label => 0,
-                url     => "/test/".$test->commit->sha."/".$test->configuration->name,
-                tooltip => $msg,
-            );
-            hyperlink(
-                tooltip => $msg,
-                class   => "sha",
-                url     => "/test/".$test->commit->sha."/".$test->configuration->name,
-                label   => $test->commit->short_sha,
-            );
-        }
-        outs( " on ".$test->branch_name. " using ".$test->configuration->name );
-    }
-};
-
 template '/fragments/project/branch-list' => sub {
     div {
         id is "branch-list";
diff --git a/share/web/static/css/app-late.css b/share/web/static/css/app-late.css
index 3fcffa8..f5e2456 100644
--- a/share/web/static/css/app-late.css
+++ b/share/web/static/css/app-late.css
@@ -95,6 +95,21 @@ li {
 
 
 /* Front page */
+#all-planned-tests h2 {
+    margin-top: 0;
+} 
+
+#project-list {
+    border-right: 1px dotted #779;
+    position: relative;
+    width: 40%;
+    float: left;
+}
+
+#create-project {
+    clear: both;
+}
+
 #create-project input.argument-repository_url {
     width: 30em;
 }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list