From 4c177fc4ea8713e72beefe27eca4c5aa9e39dbe8 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 16 Aug 2017 14:14:30 +0200 Subject: [PATCH] JobsController: refactor, cleanup --- application/controllers/JobsController.php | 23 ++++------- application/views/scripts/job/index.phtml | 44 ---------------------- 2 files changed, 7 insertions(+), 60 deletions(-) delete mode 100644 application/views/scripts/job/index.phtml diff --git a/application/controllers/JobsController.php b/application/controllers/JobsController.php index c1b1ad1f..11e86ed2 100644 --- a/application/controllers/JobsController.php +++ b/application/controllers/JobsController.php @@ -3,27 +3,18 @@ namespace Icinga\Module\Director\Controllers; use Icinga\Module\Director\Web\Controller\ActionController; +use Icinga\Module\Director\Web\Table\JobTable; +use Icinga\Module\Director\Web\Tabs\ImportTabs; class JobsController extends ActionController { public function indexAction() { - $this->setAutoRefreshInterval(10); - $this->view->title = $this->translate('Jobs'); - $this->setImportTabs()->activate('jobs'); + $this->addTitle($this->translate('Jobs')) + ->setAutoRefreshInterval(10) + ->addAddLink($this->translate('Add a new Job'), 'director/job/add') + ->tabs(new ImportTabs())->activate('jobs'); - $this->view->addLink = $this->view->qlink( - $this->translate('Add'), - 'director/job', - null, - array('class' => 'icon-plus') - ); - - $this->view->table = $this->applyPaginationLimits( - $this->loadTable('job') - ->setConnection($this->db()) - ); - - $this->setViewScript('list/table'); + (new JobTable($this->db()))->renderTo($this); } } diff --git a/application/views/scripts/job/index.phtml b/application/views/scripts/job/index.phtml deleted file mode 100644 index 8ef9ec11..00000000 --- a/application/views/scripts/job/index.phtml +++ /dev/null @@ -1,44 +0,0 @@ -
-tabs ?> -

escape($this->title) ?>

- -actionLinks ?> - -
- -
-disabled === 'y'): ?> -

translate( - 'This job would run every %ds. It has been disabled and will therefore not be executed as scheduled' - ), - $job->run_interval -) ?> -

- -

-job(); echo $class::getDescription() ?> -isPending()): ?> -translate('This job runs every %ds and is currently pending'), $job->run_interval) ?> - -translate('This job runs every %ds.'), $job->run_interval) ?> - -

- -ts_last_attempt): ?> -last_attempt_succeeded): ?> -

translate('The last attempt succeeded at %s'), - $job->ts_last_attempt -) ?>

- -

translate('The last attempt failed at %s: %s'), - $job->ts_last_attempt, - $this->escape($job->ts_last_error) -) ?>

- - -translate('This job has not been executed yet') ?> - -