Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing up various queue filters, added pending

  • Loading branch information...
commit fa6ce1db4b8ca7501580d0a3195aeae58008abf1 1 parent 8da0482
@dogmatic69 authored
View
20 Controller/InfinitasJobsController.php
@@ -53,8 +53,20 @@ public function index() {
*
* @return void
*/
+ public function pending() {
+ $this->Paginator->settings = array('pending');
+ $infinitasJobs = $this->Paginator->paginate();
+ $this->set(compact('infinitasJobs'));
+ }
+
+/**
+ * @brief display a list of locked jobs
+ *
+ * @return void
+ */
public function locked() {
- $infinitasJobs = $this->Paginator->paginate('locked');
+ $this->Paginator->settings = array('locked');
+ $infinitasJobs = $this->Paginator->paginate();
$this->set(compact('infinitasJobs'));
}
@@ -64,7 +76,8 @@ public function locked() {
* @return void
*/
public function failed() {
- $infinitasJobs = $this->Paginator->paginate('failed');
+ $this->Paginator->settings = array('failed');
+ $infinitasJobs = $this->Paginator->paginate();
$this->set(compact('infinitasJobs'));
}
@@ -74,7 +87,8 @@ public function failed() {
* @return void
*/
public function completed() {
- $infinitasJobs = $this->Paginator->paginate('completed');
+ $this->Paginator->settings = array('completed');
+ $infinitasJobs = $this->Paginator->paginate();
$this->set(compact('infinitasJobs'));
}
View
25 View/Elements/links.ctp
@@ -0,0 +1,25 @@
+<?php
+$links = array(
+ 'All' => array('action' => 'index'),
+ 'Pending' => array('action' => 'pending'),
+ 'Locked' => array('action' => 'locked'),
+ 'Failed' => array('action' => 'failed'),
+ 'Completed' => array('action' => 'completed')
+);
+foreach ($links as $name => &$link) {
+ $class = null;
+ if (Router::url($link) == $this->here) {
+ $class = 'disabled';
+ }
+ $link = $this->Html->link($name, $link, array(
+ 'class' => array(
+ $class,
+ 'btn',
+ 'btn-small'
+ )
+ ));
+}
+
+echo $this->Html->tag('div', implode('', $links), array(
+ 'class' => 'btn-group'
+));
View
88 View/InfinitasJobs/admin_failed.ctp
@@ -1,88 +0,0 @@
-<?php
-/**
- * @brief Add some documentation for this admin_index form.
- *
- * @copyright Copyright (c) 2009 Carl Sutton (dogmatic69)
- *
- * @link http://infinitas-cms.org/InfinitasJobs
- * @package InfinitasJobs.View.admin_index
- * @license http://infinitas-cms.org/mit-license The MIT License
- * @since 0.9b1
- *
- * @author dogmatic69
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- */
-echo $this->Form->create('InfinitasJob', array('action' => 'mass'));
-
-$massActions = $this->Infinitas->massActionButtons(
- array(
- 'add',
- 'edit',
- 'toggle',
- 'copy',
- 'delete',
-
- // other methods available
- // 'unlock',
- )
-);
-
-echo $this->Infinitas->adminIndexHead($filterOptions, $massActions);
-?>
-<div class="table">
- <table class="listing" cellpadding="0" cellspacing="0">
- <?php
- echo $this->Infinitas->adminTableHeader(
- array(
- $this->Form->checkbox('all') => array(
- 'class' => 'first',
- 'style' => 'width:25px;'
- ),
- $this->Paginator->sort('queue'),
- $this->Paginator->sort('attempts'),
- $this->Paginator->sort('created_at'),
- $this->Paginator->sort('failed_at', __d('infinitas_jobs', 'Last Fail')),
- )
- );
-
- foreach ($infinitasJobs as $infinitasJob) { ?>
- <tr class="<?php echo $this->Infinitas->rowClass(); ?> no-bottom-border">
- <td><?php echo $this->Infinitas->massActionCheckBox($infinitasJob); ?>&nbsp;</td>
- <td>
- <?php
- echo $this->Html->link(
- $infinitasJob['InfinitasJobQueue']['name'],
- array(
- 'controller' => 'infinitas_job_queues',
- 'action' => 'edit',
- $infinitasJob['InfinitasJobQueue']['id']
- )
- );
- ?>&nbsp;
- </td>
- <td><?php echo $infinitasJob['InfinitasJob']['attempts']; ?>&nbsp;</td>
- <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['created']); ?>&nbsp;</td>
- <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['failed']); ?>&nbsp;</td>
- </tr><?php
- $i = 0;
- $errorCount = count($infinitasJob['InfinitasJobError']);
- foreach($infinitasJob['InfinitasJobError'] as $error) {
- $errorClass = 'no-bottom-border';
- if($i >= $errorCount) {
- $errorClass = '';
- } ?>
- <tr class="<?php echo $this->Infinitas->rowClass() . ' ' . $errorClass; ?>">
- <td>&nbsp;</td>
- <td colspan="3"><?php echo h($error['error']); ?>&nbsp;</td>
- <td><?php echo CakeTime::niceShort($error['created']); ?>&nbsp;</td>
- </tr> <?php
- $i++;
- }
- }
- ?>
- </table>
- <?php echo $this->Form->end(); ?>
-</div>
-<?php echo $this->element('pagination/admin/navigation'); ?>
View
3  View/InfinitasJobs/completed.ctp
@@ -15,6 +15,7 @@
* Redistributions of files must retain the above copyright notice.
*/
echo $this->Form->create('InfinitasJob');
+echo $this->element('links');
?>
<table class="listing" cellpadding="0" cellspacing="0">
<?php
@@ -22,7 +23,6 @@ echo $this->Form->create('InfinitasJob');
$this->Paginator->sort('queue'),
$this->Paginator->sort('attempts'),
$this->Paginator->sort('locked_at', __d('infintias_jobs', 'Started')),
- $this->Paginator->sort('failed_at', __d('infinitas_jobs', 'Last Fail')),
$this->Paginator->sort('created_at'),
));
@@ -39,7 +39,6 @@ echo $this->Form->create('InfinitasJob');
</td>
<td><?php echo $infinitasJob['InfinitasJob']['attempts']; ?>&nbsp;</td>
<td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['locked']); ?>&nbsp;</td>
- <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['failed']); ?>&nbsp;</td>
<td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['created']); ?>&nbsp;</td>
</tr><?php
}
View
63 View/InfinitasJobs/failed.ctp
@@ -0,0 +1,63 @@
+<?php
+/**
+ * @brief Add some documentation for this admin_index form.
+ *
+ * @copyright Copyright (c) 2009 Carl Sutton (dogmatic69)
+ *
+ * @link http://infinitas-cms.org/InfinitasJobs
+ * @package InfinitasJobs.View.admin_index
+ * @license http://infinitas-cms.org/mit-license The MIT License
+ * @since 0.9b1
+ *
+ * @author dogmatic69
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ */
+echo $this->Form->create('InfinitasJob');
+echo $this->element('links');
+?>
+<table class="listing" cellpadding="0" cellspacing="0">
+ <?php
+ echo $this->Html->tableHeaders(array(
+ $this->Paginator->sort('queue'),
+ $this->Paginator->sort('attempts'),
+ $this->Paginator->sort('created_at'),
+ $this->Paginator->sort('failed_at', __d('infinitas_jobs', 'Last Fail')),
+ ));
+
+ foreach ($infinitasJobs as $infinitasJob) { ?>
+ <tr>
+ <td>
+ <?php
+ echo $this->Html->link($infinitasJob['InfinitasJobQueue']['name'], array(
+ 'controller' => 'infinitas_job_queues',
+ 'action' => 'edit',
+ $infinitasJob['InfinitasJobQueue']['id']
+ ));
+ ?>
+ </td>
+ <td><?php echo $infinitasJob['InfinitasJob']['attempts']; ?>&nbsp;</td>
+ <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['created']); ?>&nbsp;</td>
+ <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['failed']); ?>&nbsp;</td>
+ </tr><?php
+ $i = 0;
+ $errorCount = count($infinitasJob['InfinitasJobError']);
+ foreach($infinitasJob['InfinitasJobError'] as $error) {
+ $errorClass = 'no-bottom-border';
+ if($i >= $errorCount) {
+ $errorClass = '';
+ } ?>
+ <tr>
+ <td>&nbsp;</td>
+ <td colspan="3"><?php echo h($error['error']); ?>&nbsp;</td>
+ <td><?php echo CakeTime::niceShort($error['created']); ?>&nbsp;</td>
+ </tr> <?php
+ $i++;
+ }
+ }
+ ?>
+</table>
+<?php
+ echo $this->Form->end();
+ echo $this->element('pagination/navigation');
View
1  View/InfinitasJobs/index.ctp
@@ -15,6 +15,7 @@
* Redistributions of files must retain the above copyright notice.
*/
echo $this->Form->create('InfinitasJob');
+echo $this->element('links');
?>
<table class="listing" cellpadding="0" cellspacing="0">
<?php
View
1  View/InfinitasJobs/locked.ctp
@@ -15,6 +15,7 @@
* Redistributions of files must retain the above copyright notice.
*/
echo $this->Form->create('InfinitasJob');
+echo $this->element('links');
?>
<table class="listing" cellpadding="0" cellspacing="0">
<?php
View
48 View/InfinitasJobs/pending.ctp
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @brief Add some documentation for this admin_index form.
+ *
+ * @copyright Copyright (c) 2009 Carl Sutton (dogmatic69)
+ *
+ * @link http://infinitas-cms.org/InfinitasJobs
+ * @package InfinitasJobs.View.admin_index
+ * @license http://infinitas-cms.org/mit-license The MIT License
+ * @since 0.9b1
+ *
+ * @author dogmatic69
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ */
+echo $this->Form->create('InfinitasJob');
+echo $this->element('links');
+?>
+ <table class="listing" cellpadding="0" cellspacing="0">
+ <?php
+ echo $this->Html->tableHeaders(array(
+ $this->Paginator->sort('queue'),
+ $this->Paginator->sort('created_at'),
+ ));
+
+ foreach ($infinitasJobs as $infinitasJob) { ?>
+ <tr>
+ <td>
+ <?php
+ echo $this->Html->link(
+ $infinitasJob['InfinitasJobQueue']['name'],
+ array(
+ 'controller' => 'infinitas_job_queues',
+ 'action' => 'edit',
+ $infinitasJob['InfinitasJobQueue']['id']
+ )
+ );
+ ?>&nbsp;
+ </td>
+ <td><?php echo CakeTime::niceShort($infinitasJob['InfinitasJob']['created']); ?>&nbsp;</td>
+ </tr><?php
+ }
+ ?>
+ </table>
+<?php
+ echo $this->Form->end();
+ echo $this->element('pagination/navigation');
Please sign in to comment.
Something went wrong with that request. Please try again.