From 22a3d94dc3999d5e0f303918886e9f2922f6e3e0 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 22 Aug 2011 22:51:46 +0100 Subject: [PATCH 1/6] Move job details page and update references --- webui/source/pages/{job-details.php => jobs/details.php} | 0 webui/source/templates/home.tpl | 8 ++++---- webui/source/templates/jobs.tpl | 2 +- .../templates/{job-details.tpl => jobs/details.tpl} | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename webui/source/pages/{job-details.php => jobs/details.php} (100%) rename webui/source/templates/{job-details.tpl => jobs/details.tpl} (100%) diff --git a/webui/source/pages/job-details.php b/webui/source/pages/jobs/details.php similarity index 100% rename from webui/source/pages/job-details.php rename to webui/source/pages/jobs/details.php diff --git a/webui/source/templates/home.tpl b/webui/source/templates/home.tpl index c7289c5..8e3b714 100644 --- a/webui/source/templates/home.tpl +++ b/webui/source/templates/home.tpl @@ -4,7 +4,7 @@ {if $running_jobs} {foreach from=$running_jobs item=job} -
  • {$job->name()} ({$job->currentStatus()->ripProgress()}%)
  • +
  • {$job->name()} ({$job->currentStatus()->ripProgress()}%)
  • {/foreach} {else} There are no currently running jobs. @@ -14,7 +14,7 @@ {if $queued_jobs} {foreach from=$queued_jobs item=job} -
  • {$job->name()}
  • +
  • {$job->name()}
  • {/foreach} {else} There are no currently running jobs. @@ -25,7 +25,7 @@ {if $completed_jobs} {else} @@ -37,7 +37,7 @@ {if $failed_jobs} {else} diff --git a/webui/source/templates/jobs.tpl b/webui/source/templates/jobs.tpl index 3f0e337..bf421b3 100644 --- a/webui/source/templates/jobs.tpl +++ b/webui/source/templates/jobs.tpl @@ -42,7 +42,7 @@ {foreach from=$jobs item=job} {assign var=current_status value=$job->currentStatus()} - {$job->name()} + {$job->name()} {$job->destinationFilename()} {if $job->isFinished()} diff --git a/webui/source/templates/job-details.tpl b/webui/source/templates/jobs/details.tpl similarity index 100% rename from webui/source/templates/job-details.tpl rename to webui/source/templates/jobs/details.tpl From 5f786d16d7d2cc2466862281c6e1a35cc7f1d684 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 22 Aug 2011 23:18:57 +0100 Subject: [PATCH 2/6] Add control of job log message count and sort order via URL --- webui/source/pages/jobs/details.php | 30 +++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/webui/source/pages/jobs/details.php b/webui/source/pages/jobs/details.php index 86df585..62abd08 100644 --- a/webui/source/pages/jobs/details.php +++ b/webui/source/pages/jobs/details.php @@ -1,13 +1,35 @@ request->get('id'); +$main = RippingCluster_Main::instance(); +$req = $main->request(); +$log = $main->log(); +$config = $main->config(); + +$job_id = $req->get('id'); $job = RippingCluster_Job::fromId($job_id); $this->smarty->assign('job', $job); -$log = RippingCluster_Main::instance()->log(); +// Fetch log entries for this job +$log_count = $req->get('logs', $config->get('job.logs.default_display_count')); + +$default_log_order = $config->get('job.logs.default_order'); +$log_order = $req->get('order', $default_log_order); +if ( ! in_array($log_order, array(SihnonFramework_Log::ORDER_ASC, SihnonFramework_Log::ORDER_DESC))) { + $log_order = $default_log_order; +} + +$client_log_entries = array(); +$worker_log_entries = array(); + +if ($log_count == 'all') { + $log_count = '18446744073709551615'; // see mysql man page for LIMIT +} else if(!is_int($log_count)) { + $log_count = $config->get('job.logs.default_display_count'); +} + +$client_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'webui', 'job_id', $job_id, 'ctime', $log_order, $log_count); +$worker_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'worker', 'job_id', $job_id, 'ctime', $log_order, $log_count); -$client_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'webui', 'job_id', $job_id, 'ctime', SihnonFramework_Log::ORDER_DESC, 30); -$worker_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'worker', 'job_id', $job_id, 'ctime', SihnonFramework_Log::ORDER_DESC, 30); $this->smarty->assign('client_log_entries', $client_log_entries); $this->smarty->assign('worker_log_entries', $worker_log_entries); From 8739f6c516eda724770049225b7a0f630cfc9a24 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 23 Aug 2011 00:05:21 +0100 Subject: [PATCH 3/6] Expose job log display options in the UI --- webui/source/pages/jobs/details.php | 10 +++++++++- webui/source/templates/jobs/details.tpl | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/webui/source/pages/jobs/details.php b/webui/source/pages/jobs/details.php index 62abd08..ff03013 100644 --- a/webui/source/pages/jobs/details.php +++ b/webui/source/pages/jobs/details.php @@ -17,19 +17,27 @@ $log_order = $req->get('order', $default_log_order); if ( ! in_array($log_order, array(SihnonFramework_Log::ORDER_ASC, SihnonFramework_Log::ORDER_DESC))) { $log_order = $default_log_order; } +$this->smarty->assign('log_order', $log_order); +$this->smarty->assign('log_order_reverse', ($log_order == SihnonFramework_Log::ORDER_ASC ? SihnonFramework_Log::ORDER_DESC : SihnonFramework_Log::ORDER_ASC)); $client_log_entries = array(); $worker_log_entries = array(); +$log_count_display = null; if ($log_count == 'all') { + $log_count_display = 'all'; $log_count = '18446744073709551615'; // see mysql man page for LIMIT } else if(!is_int($log_count)) { $log_count = $config->get('job.logs.default_display_count'); -} + $log_count_display = $log_count; +} else { + $log_count_display = $log_count; +} $client_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'webui', 'job_id', $job_id, 'ctime', $log_order, $log_count); $worker_log_entries = RippingCluster_LogEntry::recentEntriesByField($log, 'worker', 'job_id', $job_id, 'ctime', $log_order, $log_count); +$this->smarty->assign('log_count_display', $log_count_display); $this->smarty->assign('client_log_entries', $client_log_entries); $this->smarty->assign('worker_log_entries', $worker_log_entries); diff --git a/webui/source/templates/jobs/details.tpl b/webui/source/templates/jobs/details.tpl index d760c02..ec02b2b 100644 --- a/webui/source/templates/jobs/details.tpl +++ b/webui/source/templates/jobs/details.tpl @@ -4,8 +4,18 @@ Summary details here -

    Recent Client Logs

    +

    Log messages

    +

    Options

    + +

    Recent Client Logs

    {if $client_log_entries} @@ -30,8 +40,7 @@ {/if} -

    Recent Worker Logs

    - +

    Recent Worker Logs

    {if $worker_log_entries}
    From 49e5635a71575ec4004095750433dad688413223 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 23 Aug 2011 01:28:37 +0100 Subject: [PATCH 4/6] Bug fix: save plugin information in job record --- source/lib/RippingCluster/Job.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/lib/RippingCluster/Job.class.php b/source/lib/RippingCluster/Job.class.php index 37de6f2..80bc428 100644 --- a/source/lib/RippingCluster/Job.class.php +++ b/source/lib/RippingCluster/Job.class.php @@ -183,10 +183,12 @@ class RippingCluster_Job { $database = RippingCluster_Main::instance()->database(); $database->insert( 'INSERT INTO jobs - (id,name,source,destination,title,format,video_codec,video_width,video_height,quantizer,deinterlace,audio_tracks,audio_codecs,audio_names,subtitle_tracks) + (id,name,source_plugin,rip_plugin,source,destination,title,format,video_codec,video_width,video_height,quantizer,deinterlace,audio_tracks,audio_codecs,audio_names,subtitle_tracks) VALUES(NULL,:name,:source,:destination,:title,:format,:video_codec,:video_width,:video_height,:quantizer,:deinterlace,:audio_tracks,:audio_codecs,:audio_names,:subtitle_tracks)', array( array('name' => 'name', 'value' => $this->name, 'type' => PDO::PARAM_STR), + array('name' => 'source_plugin', 'value' => $this->source_plugin, 'type' => PDO::PARAM_STR), + array('name' => 'rip_plugin', 'value' => $this->rip_plugin, 'type' => PDO::PARAM_STR), array('name' => 'source', 'value' => $this->source_filename, 'type' => PDO::PARAM_STR), array('name' => 'destination', 'value' => $this->destination_filename, 'type' => PDO::PARAM_STR), array('name' => 'title', 'value' => $this->title, 'type' => PDO::PARAM_INT), @@ -332,6 +334,14 @@ class RippingCluster_Job { public function name() { return $this->name; } + + public function sourcePlugin() { + return $this->source_plugin; + } + + public function ripPlugin() { + return $this->rip_plugin; + } public function sourceFilename() { return $this->source_filename; From fbc6f7da4836a10903305cb4120c69052fe3c367 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 23 Aug 2011 01:29:54 +0100 Subject: [PATCH 5/6] Add date to job details page. --- webui/source/templates/jobs/details.tpl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/webui/source/templates/jobs/details.tpl b/webui/source/templates/jobs/details.tpl index ec02b2b..d291c9c 100644 --- a/webui/source/templates/jobs/details.tpl +++ b/webui/source/templates/jobs/details.tpl @@ -2,7 +2,30 @@

    Summary

    -Summary details here +
    +
    Source Plugin
    +
    {$job->sourcePlugin()}
    + +
    Rip Plugin
    +
    {$job->ripPlugin()}
    + +
    Source Filename
    +
    {$job->sourceFilename()}
    + +
    Source Title
    +
    {$job->title()}
    + +
    Status
    +
    {$job->currentStatus()->statusName()} ({$job->currentStatus()->mtime()|date_format:'%Y-%m-%d %H:%M:%S'})
    + +
    Destination Filename
    +
    {$job->destinationFilename()}
    + + {if $job->isFinished()} +
    Destination Filesize
    +
    {$job->outputFilesize()|formatFilesize}
    + {/if} +

    Log messages

    Options

    From c5eb93dd46b12d030ead20ad073d695dc0719392 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 23 Aug 2011 01:35:51 +0100 Subject: [PATCH 6/6] Add hostname to job details worker logs --- webui/source/templates/jobs/details.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webui/source/templates/jobs/details.tpl b/webui/source/templates/jobs/details.tpl index d291c9c..50fc74d 100644 --- a/webui/source/templates/jobs/details.tpl +++ b/webui/source/templates/jobs/details.tpl @@ -70,6 +70,7 @@
    + @@ -78,6 +79,7 @@ + {/foreach}
    Level TimeHostname Message
    {$log_entry->level()} {$log_entry->ctime()|date_format:"%Y-%m-%d %H:%M:%S"}{$log_entry->hostname()} {$log_entry->message()}