* src/IDF/Middlewre.php: add a global template variable

"usherConfigured" to denote whether we render links to the usher
control functions in the forge administration
* src/IDF/Scm/Monotone.php: moved IDF_Scm_Monotone_Stdio into
separate file src/IDF/Scm/Monotone/Stdio.php
* src/IDF/Scm/Usher.php: new class to query and modify the state
of a running usher instance
* src/IDF/Views/Admin.php: add actions to query the list of
configured servers, edit their status, view their open connections
and control the state of the usher as a whole
* src/IDF/conf/idf.php-dist: optional usher configuration added;
mail address of monotone-users added; spelling changes
* src/IDF/conf/urls.php: added needed URLs for usher actions
* src/IDF/templates/idf/gadmin/base.html: usher links
This commit is contained in:
Thomas Keller
2010-08-07 23:28:13 +02:00
parent 780267978d
commit de036920a4
12 changed files with 951 additions and 372 deletions

View File

@@ -43,18 +43,21 @@
<div id="main-tabs">
<a href="{url 'IDF_Views_Admin::projects'}"{block tabprojects}{/block}>{trans 'Projects'}</a>
<a href="{url 'IDF_Views_Admin::users'}"{block tabusers}{/block}>{trans 'People'}</a>
{if $usherConfigured}
<a href="{url 'IDF_Views_Admin::usher'}"{block tabusher}{/block}>{trans 'Usher'}</a>
{/if}
</div>
<div id="sub-tabs">{block subtabs}{/block}</div>
</div>
<h1 id="title" class="title">{block title}{$page_title}{/block}</h1>
<h1 id="title" class="title">{block title}{$page_title}{/block}</h1>
</div>
<div id="bd">
<div id="yui-main">
<div id="yui-main">
<div class="yui-b">
<div class="yui-g">
<div class="yui-g">
{if $user and $user.id}{getmsgs $user}{/if}
<div class="content">{block body}{/block}</div>
</div>
<div class="content">{block body}{/block}</div>
</div>
</div>
</div>
<div class="yui-b context">{block context}{/block}</div>

View File

@@ -0,0 +1,6 @@
{extends "idf/gadmin/base.html"}
{block tabprojects} class="active"{/block}
{block subtabs}
<a {if $inUsher}class="active" {/if}href="{url 'IDF_Views_Admin::usher'}">{trans 'Configured servers'}</a> |
<a {if $inUsherControl}class="active" {/if}href="{url 'IDF_Views_Admin::usherControl', array('')}">{trans 'Usher control'}</a>
{/block}

View File

@@ -0,0 +1,19 @@
{extends "idf/gadmin/usher/base.html"}
{block docclass}yui-t3{assign $inUsherServerConnections=true}{/block}
{block body}
<table class="recent-issues">
<tr>
<th>{trans "address"}</th>
<th>{trans "port"}</th>
</tr>
{foreach $connections as $connection}
<tr>
<td>{$connection.address}</td>
<td>{$connection.port}</td>
</tr>
{/foreach}
</table>
{/block}

View File

@@ -0,0 +1,32 @@
{extends "idf/gadmin/usher/base.html"}
{block docclass}yui-t3{assign $inUsherControl=true}{/block}
{block body}
<p>
{trans 'current server status:'} {$status} |
{if $status == "SHUTDOWN"}
<a href="{url 'IDF_Views_Admin::usherControl', array('startup')}">{trans 'startup'}</a>
{else}
<a href="{url 'IDF_Views_Admin::usherControl', array('shutdown')}">{trans 'shutdown'}</a>
{/if}
</p>
<p>{trans 'reload server configuration:'}
<a href="{url 'IDF_Views_Admin::usherControl', array('reload')}">{trans 'reload'}</a>
</p>
{/block}
{block context}
<div class="issue-submit-info">
<p><strong>{trans 'Status explanation'}</strong></p>
<ul>
<li>ACTIVE n: {trans 'active with n total open connections'}</li>
<li>WAITING: {trans 'waiting for new connections'}</li>
<li>SHUTTINGDOWN: {trans 'usher is being shut down, not accepting connections'}</li>
<li>SHUTDOWN: {trans 'usher is shut down, all local servers are stopped and not accepting connections'}</li>
</ul>
</div>
{/block}

View File

@@ -0,0 +1,52 @@
{extends "idf/gadmin/usher/base.html"}
{block docclass}yui-t3{assign $inUsher=true}{/block}
{block body}
<table class="recent-issues">
<tr>
<th>{trans "server name"}</th>
<th>{trans "status"}</th>
<th>{trans "action"}</th>
</tr>
{foreach $servers as $server}
<tr>
<td>{$server.name}</td>
<td>{$server.status}</td>
<td>
{if preg_match("/ACTIVE|RUNNING|SLEEPING/", $server.status)}
<a href="{url 'IDF_Views_Admin::usherServerControl', array($server.name, 'stop')}">
{trans 'stop'}</a>
{elseif $server.status == "STOPPED"}
<a href="{url 'IDF_Views_Admin::usherServerControl', array($server.name, 'start')}">
{trans 'start'}</a>
{/if}
{if preg_match("/ACTIVE|WAITING|SLEEPING|STOPPING/", $server.status)}
| <a href="{url 'IDF_Views_Admin::usherServerControl', array($server.name, 'kill')}">
{trans 'kill'}</a>
{/if}
{if preg_match("/STOPPING|ACTIVE/", $server.status)}
| <a href="{url 'IDF_Views_Admin::usherServerConnections', array($server.name)}">
{trans 'active connections'}</a>
{/if}
</tr>
{/foreach}
</table>
{/block}
{block context}
<div class="issue-submit-info">
<p><strong>{trans 'Status explanation'}</strong></p>
<ul>
<li>REMOTE: {trans 'remote server without open connections'}</li>
<li>ACTIVE n: {trans 'server with n open connections'}</li>
<li>WAITING: {trans 'local server running, without open connections'}</li>
<li>SLEEPING: {trans 'local server not running, waiting for connections'}</li>
<li>STOPPING n: {trans 'local server is about to stop, n connections still open'}</li>
<li>STOPPED: {trans 'local server not running, not accepting connections'}</li>
<li>SHUTDOWN: {trans 'usher is shut down, not running and not accepting connections'}</li>
</ul>
</div>
{/block}