[Bps-public-commit] r15174 - in Pushmi/trunk: . Pushmi-Admin/lib/Pushmi/Admin Pushmi-Admin/lib/Pushmi/Admin/Event Pushmi-Admin/lib/Pushmi/Admin/Model Pushmi-Admin/share/web/static/css Pushmi-Admin/share/web/static/images/silk
alexmv at bestpractical.com
alexmv at bestpractical.com
Thu Aug 14 16:18:37 EDT 2008
Author: alexmv
Date: Thu Aug 14 16:18:35 2008
New Revision: 15174
Added:
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Event/Heartbeat.pm
Pushmi/trunk/Pushmi-Admin/share/web/static/images/silk/database_error.png (contents, props changed)
Modified:
Pushmi/trunk/ (props changed)
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Watcher.pm
Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css
Log:
r35954 at kohr-ah: chmrr | 2008-08-14 16:18:13 -0400
* Add a heartbeat event to update "updated n seconds ago" messages
* Improve messages for remote and local replica errors
* Improve UI for second half of create process
* Don't claim "new status" or "inactivity" right after startup
* Swap icon for "delete and remirror" onto "sync"
Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm (original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm Thu Aug 14 16:18:35 2008
@@ -40,7 +40,7 @@
$for = 2 if $for < 2;
} else {
$props = '';
- $for = 5;
+ $for = 3;
}
$for *= 60 unless $url =~ /^file:/;
$memcached->set( $url => $props, $for );
Added: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Event/Heartbeat.pm
==============================================================================
--- (empty file)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Event/Heartbeat.pm Thu Aug 14 16:18:35 2008
@@ -0,0 +1,19 @@
+package Pushmi::Admin::Event::Heartbeat;
+use strict;
+use warnings;
+use base 'Pushmi::Admin::Event';
+
+sub match {
+ my $self = shift;
+ my $query = shift;
+
+ return if $query->{id} and $self->data->{id} != $query->{id};
+ return 1;
+}
+
+sub render_arguments {
+ my $self = shift;
+ return ( id => $self->data->{id} );
+}
+
+1;
Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm (original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm Thu Aug 14 16:18:35 2008
@@ -244,22 +244,21 @@
sub remote_revision {
my $self = shift;
- return $self->cache->{remote_revision};
+ return defined $self->cache->{remote_revision} ? $self->cache->{remote_revision} : "???";
}
sub latency {
my $self = shift;
- return sprintf( "%.2fs", $self->cache->{latency} );
+ return defined $self->cache->{latency} ? sprintf( "%.2fs", $self->cache->{latency} ) : "???";
}
sub time_delta {
my $self = shift;
my ($time) = @_;
- return "???" unless defined $time;
- my $d = Time::Duration::duration(
- time - $time );
- return $d if $d eq "just now";
- return "$d ago";
+ return "" unless defined $time;
+ my $ago = time - $time;
+ $ago -= ($ago % 60) unless $ago < 60;
+ return Time::Duration::ago( $ago );
}
sub last_remote {
@@ -303,8 +302,7 @@
} elsif ( $status eq "offline" ) {
return "Remote master offline! Mirrored "
. $self->local_revision
- . " revisions locally, last is "
- . $self->last_local;
+ . " revisions locally."
} elsif ( $status eq "locked" ) {
return "Local repository is locked, but no mirror process is running!";
} elsif ( $status eq "failed" ) {
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 Thu Aug 14 16:18:35 2008
@@ -70,31 +70,37 @@
moniker => "create",
);
Jifty->web->redirect('/') unless $new->argument_value("url");
+ $new->argument_value(
+ dav_root => Pushmi::Admin::Model::Replica->_clean_name(
+ $new->argument_value("name")
+ )
+ );
+
my $data = Pushmi::Admin->svn_info_for( $new->argument_value("url") );
- my $changed
- = DateTime->from_epoch( epoch => $data->{date} );
- $changed->set_time_zone( Jifty->config->app("time_zone") || "UTC" );
div {
- { id is 'new_replica', class is 'roundbox' };
+ { class is 'roundbox' };
h2 {"Add a new replica"};
+ div { { class is 'status-light ok' }; };
div {
- { id is 'replica-status', class is 'roundbox' };
- h3 { $new->argument_value("url") }
- p { $data->{rev} . " revisions" } p {
- "Last modified on " . $changed->ymd . ", at " . $changed->hms;
- }
+ { class is 'replica' };
+ h3 { $new->argument_value("name") };
+ hyperlink( url => $new->argument_value("url"), label => $new->argument_value("url") );
};
+ div { { class is 'create master health'};
+ div { { class is 'title'}; "Remote repository status" };
+ div { { class is 'commit' }; "r".$data->{rev} };
+ div { { class is 'at' }; Pushmi::Admin::Model::Replica->time_delta($data->{date}) };
+ div { { class is 'latency' }; sprintf( "%.2fs latency", $data->{latency} ) };
+ };
+ };
+
+ div {
+ { class is 'roundbox' };
form {
- $new->argument_value(
- dav_root => Pushmi::Admin::Model::Replica->_clean_name(
- $new->argument_value("name")
- )
- );
+ p { {class is 'dav_prompt'}; "Host this locally at:" };
+ render_param( $new => "dav_root", label => Jifty->config->app("apache")->{root}, mandatory => 1 );
- render_param( $new => "name", default_value => $new->argument_value("name") );
- outs_raw( $new->form_value("url", default_value => $new->argument_value("url")) );
- render_param( $new => "dav_root" );
div {
{class is "submit_button"};
outs_raw(
@@ -106,7 +112,7 @@
);
}
};
- }
+ };
};
template 'fragments/status-light' => sub {
@@ -137,7 +143,7 @@
}
};
- if ($replica->remote_revision) {
+ if ($replica->remote_revision ne "???") {
my $progress = int(($replica->local_revision / $replica->remote_revision) * 100);
outs_raw( qq{<script>if (jQuery("#progress-$id")) jQuery("#progress-$id").progressBar($progress)</script>} );
}
@@ -175,7 +181,7 @@
render_param(
$sync => "bootstrap" );
- form_submit( label => "Start mirroring", onclick => {submit => $sync} );
+ form_submit( label => "Start mirroring", onclick => {submit => $sync}, class => "replica sync" );
}
} elsif ( $replica->status eq "locked" ) {
h2 {"Replica health"};
@@ -201,7 +207,9 @@
div { { class is 'title'}; "Last remote commit" };
div { { class is 'commit' }; "r".$replica->remote_revision };
div { { class is 'at' }; $replica->last_remote };
- div { { class is 'latency' }; $replica->latency." latency" };
+ if ($replica->status ne "offline") {
+ div { { class is 'latency' }; $replica->latency." latency" }
+ }
};
}
@@ -210,11 +218,20 @@
my $sync = Jifty->web->new_action( class => "Sync", );
render_param(
$sync => "replica" => default_value => $replica->id );
- form_submit( label => "Force an update now", onclick => {submit => $sync} );
+ form_submit( label => "Force an update now", onclick => {submit => $sync}, class => "replica sync" );
}
}
+ Jifty->subs->update_on(
+ class => 'Heartbeat',
+ );
} else {
h2 {"Local replica failure"};
+
+ p { "Your local replica is corrupted or inaccessible in some way. "
+ . "This is very unexpected -- you should look at " }
+ pre { $replica->svn_root };
+ p { " and see if you can determine what failed. "
+ . "After that, deleting and remirroring the replica is probably your best bet." };
}
Jifty->subs->update_on(
class => 'ReplicaStatus',
Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Watcher.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Watcher.pm (original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Watcher.pm Thu Aug 14 16:18:35 2008
@@ -17,7 +17,7 @@
my ($class, $id) = @_;
my $previous = "";
my $short = "";
- my $inactive = 0;
+ my $inactive = 60;
my $pool = SVN::Pool->new_default;
@@ -32,8 +32,8 @@
while (1) {
$replica = Pushmi::Admin::Model::Replica->load($id);
last unless $replica->id;
- if ($replica->long_status ne $previous) {
- print STDERR "@{[$replica->clean_name]}: NEW STATUS: @{[$replica->long_status]}\n";
+ if ($replica->long_status ne $previous and $previous ne "") {
+ print STDERR "@{[$replica->clean_name]}: New status: @{[$replica->long_status]}\n";
Pushmi::Admin::Event::ReplicaStatus->new(
{ id => $id, old => $short, new => $replica->status }
)->publish;
@@ -44,6 +44,12 @@
{ id => $id, status => $replica->status }
)->publish;
}
+ if ($inactive < 60 or $inactive % 60 == 0) {
+ print STDERR "@{[$replica->clean_name]}: Heartbeat\n";
+ Pushmi::Admin::Event::Heartbeat->new(
+ { id => $id }
+ )->publish;
+ }
$short = $replica->status;
$previous = $replica->long_status;
$pool->clear;
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 Thu Aug 14 16:18:35 2008
@@ -116,6 +116,18 @@
clear: left;
}
+/* Create page */
+p.dav_prompt {
+ margin-bottom: 0;
+ padding-bottom: 0;
+}
+
+div.form_field label.label.argument-dav_root {
+ float: none;
+ padding: 0;
+ margin-right: -0.1em;
+ margin-left: 3em;
+}
/* Replica summaries, lists, and status lights */
@@ -161,7 +173,11 @@
.health {
clear: left;
background-repeat: no-repeat;
- background-position: 0 3px;
+ background-position: 10px 3px;
+}
+
+.health.create {
+ margin-top: 1.5em;
}
.health + .health {
@@ -173,20 +189,22 @@
.health.local { background-image: url(/static/images/silk/monitor.png); }
.health .title {
- padding-left: 1.5em;
+ padding-left: 2em;
border-bottom: 1px solid #334;
font-size: 110%;
+ margin-bottom: 0.2em;
}
.health .commit {
width: 50%;
text-align: center;
float: right;
- margin-top: -1.3em;
+ margin-top: -1.5em;
}
.health .at {
- text-align: right;
+ text-align: center;
+ width: 50%;
float: right;
}
@@ -228,11 +246,12 @@
background-position: 10px 7px;
}
-input.replica.create { background-image: url(/static/images/silk/database_add.png); }
-input.replica.unlock { background-image: url(/static/images/silk/database_lightning.png); }
-input.replica.delete { background-image: url(/static/images/silk/database_delete.png); }
-input.replica.remirror { background-image: url(/static/images/silk/database_refresh.png); }
-input.replica.backup { background-image: url(/static/images/silk/database_save.png); }
+input.replica.create { background-image: url(/static/images/silk/database_add.png); }
+input.replica.sync { background-image: url(/static/images/silk/database_refresh.png); }
+input.replica.unlock { background-image: url(/static/images/silk/database_lightning.png); }
+input.replica.delete { background-image: url(/static/images/silk/database_delete.png); }
+input.replica.remirror { background-image: url(/static/images/silk/database_error.png); }
+input.replica.backup { background-image: url(/static/images/silk/database_save.png); }
.advanced_options .option p {
margin: 0;
Added: Pushmi/trunk/Pushmi-Admin/share/web/static/images/silk/database_error.png
==============================================================================
Binary file. No diff available.
More information about the Bps-public-commit
mailing list