Updated all page templates

Log page now displays recent log entries
Job Details page now shows job-specific log entries.
Jobs page lists all jobs in the database, while homepage lists all
running/completed/failed jobs in groups
This commit is contained in:
2010-03-18 02:05:32 +00:00
parent 9af46a1c5d
commit 69cead4ca3
9 changed files with 196 additions and 20 deletions

View File

@@ -1,14 +1,18 @@
<?php
require 'HandBrakeCluster/Main.class.php';
$main = HandBrakeCluster_Main::instance();
$smarty = $main->smarty();
try {
$main = HandBrakeCluster_Main::instance();
$smarty = $main->smarty();
$page = new HandBrakeCluster_Page($smarty, $main->request());
$page->evaluate();
$page = new HandBrakeCluster_Page($smarty, $main->request());
$page->evaluate();
$smarty->assign('page_content', $smarty->fetch($page->template_filename()));
$smarty->assign('page_content', $smarty->fetch($page->template_filename()));
$smarty->display('index.tpl');
$smarty->display('index.tpl');
} catch (HandBrakeCluster_Exception $e) {
die("Uncaught Exception: " . $e->getMessage());
}
?>

View File

@@ -1,11 +1,11 @@
<?php
$running_jobs = array();
$completed_jobs = array();
$running_jobs[] = new HandBrakeCluster_Job(42);
$running_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::RUNNING);
$completed_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::COMPLETE);
$failed_jobs = HandBrakeCluster_Job::allWithStatus(HandBrakeCluster_JobStatus::FAILED);
$this->smarty->assign('running_jobs', $running_jobs);
$this->smarty->assign('completed_jobs;', $completed_jobs);
$this->smarty->assign('completed_jobs', $completed_jobs);
$this->smarty->assign('failed_jobs', $failed_jobs);
?>

View File

@@ -1,8 +1,13 @@
<?php
$job_id = $this->request->get('id');
$job = new HandBrakeCluster_Job($job_id);
$job = HandBrakeCluster_Job::fromId($job_id);
$this->smarty->assign('job', $job);
$client_log_entries = HandBrakeCluster_ClientLogEntry::recentForJob($job_id, 30);
$worker_log_entries = HandBrakeCluster_WorkerLogEntry::recentForJob($job_id, 30);
$this->smarty->assign('client_log_entries', $client_log_entries);
$this->smarty->assign('worker_log_entries', $worker_log_entries);
?>

View File

@@ -0,0 +1,6 @@
<?php
$jobs = HandBrakeCluster_Job::all(HandBrakeCluster_Main::instance()->database());
$this->smarty->assign('jobs', $jobs);
?>

View File

@@ -0,0 +1,9 @@
<?php
$client_log_entries = HandBrakeCluster_ClientLogEntry::recent(30);
$worker_log_entries = HandBrakeCluster_WorkerLogEntry::recent(30);
$this->smarty->assign('client_log_entries', $client_log_entries);
$this->smarty->assign('worker_log_entries', $worker_log_entries);
?>

View File

@@ -10,7 +10,7 @@
<em>There are no currently running jobs.</em>
{/if}
<h3>Completed Jobs</h3>
<h3>Recently Completed Jobs</h3>
{if $completed_jobs}
<ul>
@@ -22,3 +22,15 @@
<em>There are no recently completed jobs.</em>
{/if}
<h3>Recently Failed Jobs</h3>
{if $failed_jobs}
<ul>
{foreach from=$failed_jobs item=job}
<li><a href="{$base_uri}job-details/id/{$job->id()}" title="View job details">Job {$job->id()}</a></li>
{/foreach}
</ul>
{else}
<em>There are no recently failed jobs.</em>
{/if}

View File

@@ -1 +1,57 @@
This is Job {$job->id()}...
<h2>Job Details</h2>
<h3>Summary</h3>
<em>Summary details here</em>
<h3>Recent Client Logs</h3>
{if $client_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$client_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no client log entries.</em>
{/if}
<h3>Recent Worker Logs</h3>
{if $worker_log_entries}
<table>
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$worker_log_entries item=log_entry}
<tr>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no worker log entries.</em>
{/if}

View File

@@ -1 +1,27 @@
Jobs
<h2>Jobs</h2>
{if $jobs}
<table>
<thead>
<tr>
<th>Name</th>
<th>Destination</th>
<th>Title</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{foreach from=$jobs item=job}
{assign var=current_status value=$job->currentStatus()}
<tr>
<td><a href="{$base_uri}/job-details/id/{$job->id()}" title="View job details">{$job->name()}</a></td>
<td>{$job->destination()}</td>
<td>{$job->title()}</td>
<td>{$current_status->statusName()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no jobs</em>
{/if}

View File

@@ -1 +1,59 @@
Logs...
<h2>Recent Client Logs</h2>
{if $client_log_entries}
<table>
<thead>
<tr>
<th>Job</th>
<th>Level</th>
<th>Time</th>
<th>Hostname</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$client_log_entries item=log_entry}
<tr>
<td>{$log_entry->jobId()}</td>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->hostname()}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no client log entries.</em>
{/if}
<h2>Recent Worker Logs</h2>
{if $worker_log_entries}
<table>
<thead>
<tr>
<th>Job</th>
<th>Level</th>
<th>Time</th>
<th>Hostname</th>
<th>Message</th>
</tr>
</thead>
<tbody>
{foreach from=$worker_log_entries item=log_entry}
<tr>
<td>{$log_entry->jobId()}</td>
<td>{$log_entry->level()}</td>
<td>{$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}</td>
<td>{$log_entry->hostname()}</td>
<td>{$log_entry->message()}</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<em>There are no worker log entries.</em>
{/if}