Update to the status page, displays details for a fixed time period

This commit is contained in:
2011-12-22 11:20:23 +00:00
parent 51617a7acf
commit c0791a4166
3 changed files with 95 additions and 86 deletions

View File

@@ -36,7 +36,8 @@ class StatusBoard_Main extends SihnonFramework_Main {
$this->smarty->registerPlugin('modifier', 'formatDuration', array('StatusBoard_Main', 'formatDuration')); $this->smarty->registerPlugin('modifier', 'formatDuration', array('StatusBoard_Main', 'formatDuration'));
$this->smarty->registerPlugin('modifier', 'formatFilesize', array('StatusBoard_Main', 'formatFilesize')); $this->smarty->registerPlugin('modifier', 'formatFilesize', array('StatusBoard_Main', 'formatFilesize'));
$this->smarty->registerPlugin('modifier', 'fuzzyTime', array('StatusBoard_DateTime', 'fuzzyTime'));
$this->smarty->assign('version', '0.1.0'); $this->smarty->assign('version', '0.1.0');
$this->smarty->assign('version_codename', 'Acai'); $this->smarty->assign('version_codename', 'Acai');
$this->smarty->assign('messages', array()); $this->smarty->assign('messages', array());

View File

@@ -1,8 +1,12 @@
<?php <?php
$main = StatusBoard_Main::instance(); $main = StatusBoard_Main::instance();
$request = $main->request(); $request = $main->request();
$service_id = $request->get('service', 'Sihnon_Exception_InvalidParameters'); $service_id = $request->get('service', 'Sihnon_Exception_InvalidParameters');
$site_id = $request->get('id', 'Sihnon_Exception_InvalidParameters'); $site_id = $request->get('id', 'Sihnon_Exception_InvalidParameters');
$start = $request->get('start');
$end = $request->get('end');
$service = null; $service = null;
$site = null; $site = null;
@@ -13,7 +17,12 @@ try {
} catch (Sihnon_Exception_ResultCountMismatch $e) { } catch (Sihnon_Exception_ResultCountMismatch $e) {
throw new StatusBoard_Exception_FileNotFound(); throw new StatusBoard_Exception_FileNotFound();
} }
$services = StatusBoard_Service::all(); $services = StatusBoard_Service::all();
$this->smarty->assign('service', $service); $this->smarty->assign('service', $service);
$this->smarty->assign('site', $site); $this->smarty->assign('site', $site);
$this->smarty->assign('start', $start);
$this->smarty->assign('end', $end);
?> ?>

View File

@@ -1,92 +1,91 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="span16" name="name"><!--name content container --> <div class="span16"><!--name content container -->
<h1>Site Status History: {$service->name|escape:html} - {$site->name|escape:html}</h1> <h1>Site Status History: {$service->name|escape:html} - {$site->name|escape:html}</h1>
<p>This page details the incident history for a site</p> <p>This page details the incident history for a site</p>
{foreach from=array(0,1,2,3,4,5,6) item=day} {if $start && $end}
{if $day == 0} {$incidentsDuring=$site->openIncidentsDuring($start, $end)}
<div class="row" name="edit service"> {$incidentCount=count($incidentsDuring)}
<div class="span4 column"><!--New description--> <h2>{$start|date_format:'d-M H:i'} to {$end|date_format:'d-M H:i'}</h2>
<h3 class="status">Today {mktime(0,0,0,date("n"),date("j"))|date_format:"d M Y"}</h3> {foreach from=$incidentsDuring item=incident}
<p>x incidents</p> {$statuses=$incident->statusChanges()}
</div> <div class="row">
<div class="span12 column"> <div class="span4 column">
{$start=mktime(0,0,0,date("n"),date("j")-$day)} <h3 class="status">{$incident->reference|escape:html}</h3>
{$end=mktime(0,0,0,date("n"),date("j")-$day+1)} <p>Opened: {$incident->start_time|date:"r"}<p>
{$incidentsDuring=$site->openIncidentsDuring($start, $end)} {if $incident->estimated_end_time}
{if $incidentsDuring} {$time_difference=time()-$incident->estimated_end_time}
<table class="bordered-table" name="sites_list_table"><!--Services table --> <p>Estimated End Time: {$time_difference|fuzzyTime}</p>
<thead> {/if}
<th>Incident</th>
<th>Description</th>
<th>Time Opened</th>
<th>Status</th>
<th>Time Closed</th>
</thead>
<tbody>
{foreach from=$incidentsDuring item=incident}
<tr>
<td>{$incident->reference|escape:html}</td>
<td>{$incident->description|truncate|escape:html}</td>
<td>{date('d-M H:i', $incident->start_time)}</td>
<td>{StatusBoard_Status::name($incident->currentStatus())}</td>
<td>{if $incident->actual_end_time}
{date('d-M H:i', $incident->actual_end_time)}
{else}
Still Open
{/if}
</td>
</tr>
{/foreach}
{else}
<h4>There were no recorded incidents on this day</h4>
{/if}
</tbody>
</table><!--/name table -->
</div>
</div>
{else}
<div class="row" name="edit service">
<div class="span4 column"><!--New description-->
<h3 class="status">{mktime(0,0,0,date("n"),date("j")-$day)|date_format:"d M Y"}</h3>
<p>x incidents</p>
</div> </div>
<div class="span12 column"> <div class="span12 column">
{$start=mktime(0,0,0,date("n"),date("j")-$day)} <table class="bordered-table">
{$end=mktime(0,0,0,date("n"),date("j")-$day+1)} <thead>
{$incidentsDuring=$site->openIncidentsDuring($start, $end)} <th>Status</th>
{if $incidentsDuring} <th>Time</th>
<table class="bordered-table" name="sites_list_table"><!--Services table --> <th>Description</th>
<thead> </thead>
<th>Incident</th> <tbody>
<th>Description</th> {foreach from=$statuses item=status}
<th>Time Opened</th> <tr>
<th>Status</th> <td>{$status->status|escape:html}</td>
<th>Time Closed</th> <td>{$status->ctime|date_format:'d-M H:i'}</td>
</thead> <td>{$status->description|escape:html}</td>
<tbody> </tr>
{foreach from=$incidentsDuring item=incident} {/foreach}
<tr> </tbody>
<td>{$incident->reference|escape:html}</td> </table>
<td>{$incident->description|truncate|escape:html}</td> </div>
<td>{date('d-M H:i', $incident->start_time)}</td> </div>
<td>{StatusBoard_Status::name($incident->currentStatus())}</td> {foreachelse}
<td>{if $incident->actual_end_time} <p>There were no recorded incidents during this time period.</p>
{date('d-M H:i', $incident->actual_end_time)} {/foreach}
{else} {else}
Still Open {foreach from=array(0,1,2,3,4,5,6) item=day}
{/if} {$start=mktime(0,0,0,date("n"),date("j")-$day)}
</tr> {$end=mktime(0,0,0,date("n"),date("j")-$day+1)}
{/foreach} {$incidentsDuring=$site->openIncidentsDuring($start, $end)}
{else} {$incidentCount=count($incidentsDuring)}
<h4>There were no recorded incidents on this day</h4> <div class="row">
{/if} <div class="span4 column"><!--New description-->
</tbody> <h3 class="status">{if $day == 0}Today {/if}{$start|date_format:"d M Y"}</h3>
</table><!--/name table --> <p>{$incidentCount} {StatusBoard_Formatting::pluralise('incident','incidents',$incidentCount)}</p>
</div> </div>
</div> <div class="span12 column">
{/if} {if $incidentsDuring}
{/foreach} <table class="bordered-table"><!--Services table -->
<thead>
<th>Incident</th>
<th>Description</th>
<th>Time Opened</th>
<th>Status</th>
<th>Time Closed</th>
</thead>
<tbody>
{foreach from=$incidentsDuring item=incident}
<tr>
<td>{$incident->reference|escape:html}</td>
<td>{$incident->description|truncate|escape:html}</td>
<td>{date('d-M H:i', $incident->start_time)}</td>
<td>{StatusBoard_Status::name($incident->currentStatus())}</td>
<td>
{if $incident->actual_end_time}
{date('d-M H:i', $incident->actual_end_time)}
{else}
Still Open
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table><!--/name table -->
{else}
<p>There were no recorded incidents on this day</p>
{/if}
</div>
</div>
{/foreach}
{/if}
</div> </div>
</div> </div>
</div> </div>