[Bps-public-commit] r15200 - in Pushmi/trunk: . Pushmi-Admin Pushmi-Admin/bin Pushmi-Admin/lib/Pushmi/Admin Pushmi-Admin/share/web/static/css

alexmv at bestpractical.com alexmv at bestpractical.com
Fri Aug 15 18:50:56 EDT 2008


Author: alexmv
Date: Fri Aug 15 18:50:56 2008
New Revision: 15200

Added:
   Pushmi/trunk/Pushmi-Admin/base.psd   (contents, props changed)
   Pushmi/trunk/Pushmi-Admin/share/web/static/images/status/sweep.gif   (contents, props changed)
   Pushmi/trunk/Pushmi-Admin/sweep.psd   (contents, props changed)
Modified:
   Pushmi/trunk/   (props changed)
   Pushmi/trunk/Pushmi-Admin/bin/generate-lights.pl
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
   Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css

Log:
 r36066 at kohr-ah:  chmrr | 2008-08-15 18:50:51 -0400
  * Minimal navigation on secondary pages
  * Lazy-load the replica information, with a throbber
  * Add the base psd files for status light images


Added: Pushmi/trunk/Pushmi-Admin/base.psd
==============================================================================
Binary file. No diff available.

Modified: Pushmi/trunk/Pushmi-Admin/bin/generate-lights.pl
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/bin/generate-lights.pl	(original)
+++ Pushmi/trunk/Pushmi-Admin/bin/generate-lights.pl	Fri Aug 15 18:50:56 2008
@@ -11,6 +11,25 @@
 light( "green"  =>  113, 0.55, 0.6, 20, 15 );
 light( "orange" =>   40, 0.4,  0.6, 40,  5 );
 light( "red"    =>    0, 0.3,  0.6, 15,  5 );
+sweep( "sweep", => 2, 30 );
+
+
+sub sweep {
+    my ($name, $speed, $steps ) = @_;;
+
+    my $base = Image::Magick->new;
+    $base->Read("sweep.psd");
+    my $output = Image::Magick->new;
+    for my $i ( 0 .. $steps-1 ) {
+        my $dup = $base->clone;
+        $dup->[3]->Distort( type => "ScaleRotateTranslate", points => [-$i * 360 / $steps] );
+        push @{$output}, $dup->Flatten;
+        $output->[-1]->Set(delay => $speed);
+    }
+    $output->Set(loop => 0);
+    $output->Scale("50x50");
+    $output->Write("share/web/static/images/status/$name.gif");
+}
 
 sub light {
     my ($name, $hue, $min, $max, $steps, $speed) = @_;

Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	Fri Aug 15 18:50:56 2008
@@ -10,9 +10,33 @@
 use SVN::Client;
 use Jifty::Event::Log;
 
+
+sub navigation {
+    my (@tokens) = @_;
+    if (@tokens) {
+        div {
+            { id is "pushmi-navigation" };
+            my $seen;
+            for my $t (@tokens) {
+                outs( " \x{27a4} " ) if $seen++;
+                if ($t eq "home") {
+                    hyperlink( url => "/", label => "Replica list" );
+                } elsif ($t->isa("Pushmi::Admin::Model::Replica")) {
+                    hyperlink( url => "/replica/" . $t->clean_name, label => $t->name );
+                }
+            }
+        };
+    } else {
+        div {
+            { id is "pushmi-navigation", class is "empty" };
+        }
+    }
+}
+
 template 'index.html' => page { title => "Pushmi Administration" } content {
     my $replicas = Pushmi::Admin::Model::ReplicaCollection->new;
     $replicas->unlimit;
+    navigation();
     div {
         { id is 'replica-list', class is 'roundbox' };
         h2 {"Current replicas"};
@@ -20,22 +44,12 @@
             div {
                 { class is 'replica-element' };
                 render_region(
-                    name      => "light-" . $replica->id,
-                    path      => "/fragments/status-light",
-                    arguments => { id => $replica->id }
-                );
-                render_region(
-                    name      => "summary-" . $replica->id,
-                    path      => "/fragments/summary",
-                    arguments => { id => $replica->id }
+                    name         => "replica-" . $replica->id,
+                    path         => "/fragments/replica-element",
+                    arguments    => { id => $replica->id },
+                    lazy         => 1,
+                    loading_path => "/fragments/replica-loading",
                 );
-                div {
-                    render_region(
-                        name => "progress-" . $replica->id,
-                        arguments => {id => $replica->id},
-                        path => "/fragments/progressbar",
-                    );
-                };
             };
         }
     };
@@ -64,6 +78,36 @@
     };
 };
 
+
+template 'fragments/replica-element' => sub {
+    my $id = get('id');
+    render_region(
+        name      => "light",
+        path      => "/fragments/status-light",
+        arguments => { id => $id },
+    );
+    render_region(
+        name      => "summary",
+        path      => "/fragments/summary",
+        arguments => { id => $id },
+    );
+    div {
+        render_region(
+            name      => "progress",
+            path      => "/fragments/progressbar",
+            arguments => {id => $id},
+        );
+    };
+};
+
+template 'fragments/replica-loading' => sub {
+    div { { class is "status-light lazy"} };
+    div {
+        { class is "replica"};
+        h3 { "Loading.." }
+    }
+};
+
 template 'create' => page { title => "Create a new replica" } content {
     my $new = Jifty->web->new_action(
         class   => "CreateReplica",
@@ -78,6 +122,7 @@
 
     my $url = $new->argument_value('url'); $url =~ s{/+$}{};
     my $data = Pushmi::Admin->svn_info_for( $url );
+    navigation("home");
     div {
         { class is 'roundbox' };
         h2 {"Add a new replica"};
@@ -304,6 +349,7 @@
 
 template 'replica' => page { title => "About " . get("replica")->name } content {
     my $replica = get 'replica';
+    navigation("home");
     div {
         { class is 'roundbox' };
         h2 {"Replica status"};
@@ -352,7 +398,7 @@
 
 template 'advanced' => page { title => "Advanced configuration for " . get("replica")->name } content {
     my $replica = get 'replica';
-
+    navigation("home",$replica);
     div {
         { class is 'roundbox advanced_options' };
         h2 { "Advanced options for " . $replica->name . " replica" };

Modified: Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css	(original)
+++ Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css	Fri Aug 15 18:50:56 2008
@@ -17,6 +17,25 @@
   display: none;
 }
 
+#pushmi-navigation {
+  border: 1px solid #334;
+  background: #223;
+  -moz-border-radius-bottomleft: 20px;  -webkit-border-bottom-left-radius: 20px;
+  -moz-border-radius-bottomright: 20px; -webkit-border-bottom-right-radius: 20px;
+  padding: 0.5em;
+  text-align: center;
+  height: 1.5em;
+}
+
+#pushmi-navigation.empty {
+  border: 1px solid #112;
+  background: #112;
+}
+
+#pushmi-navigation a {
+  margin: 0 0.5em;
+}
+
 h1 {
   margin: 0;
   padding: 0;
@@ -148,6 +167,7 @@
 }
 
 #replica-list .replica-element {
+  clear: left;
   margin: 1em 0;
 }
 
@@ -179,6 +199,11 @@
 .status-light.offline { background-image: url(/static/images/status/red.gif);    }
 .status-light.failed  { background-image: url(/static/images/status/red.gif);    }
 .status-light.locked  { background-image: url(/static/images/status/red.gif);    }
+.status-light.lazy    {
+  background-image: url(/static/images/status/sweep.gif);
+  background-position: 0 0px;
+  margin-top: -12px;
+}
 
 /* Health information */
 

Added: Pushmi/trunk/Pushmi-Admin/share/web/static/images/status/sweep.gif
==============================================================================
Binary file. No diff available.

Added: Pushmi/trunk/Pushmi-Admin/sweep.psd
==============================================================================
Binary file. No diff available.



More information about the Bps-public-commit mailing list