diff --git a/module/Job/src/Job/Controller/JobController.php b/module/Job/src/Job/Controller/JobController.php index 27445044..803cc084 100644 --- a/module/Job/src/Job/Controller/JobController.php +++ b/module/Job/src/Job/Controller/JobController.php @@ -215,8 +215,61 @@ public function cancelAction() } } + public function runAction() + { + if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) { + return new ViewModel( + array( + 'jobs' => $this->getJobs() + ) + ); + } + else { + return $this->redirect()->toRoute('auth', array('action' => 'login')); + } + } + + public function queueAction() + { + if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) { + if($this->params()->fromQuery('job')) { + $jobname = $this->params()->fromQuery('job'); + } + else { + $jobname = null; + } + + return new ViewModel( + array( + 'result' => $this->queueJob($jobname) + ) + ); + } + else { + return $this->redirect()->toRoute('auth', array('action' => 'login')); + } + } + + private function getJobs() + { + $director = $this->getServiceLocator()->get('director'); + $result = $director->send_command(".jobs type=B", 2, null); + $jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); + return $jobs['result']['jobs']; + } + + private function queueJob($jobname=null) + { + $result = ""; + if($jobname != null) { + $director = $this->getServiceLocator()->get('director'); + $result = $director->send_command('run job="'.$jobname.'" yes'); + } + return $result; + } + public function getJobTable() - { + { if(!$this->jobTable) { $sm = $this->getServiceLocator(); diff --git a/module/Job/view/job/job/index.phtml b/module/Job/view/job/job/index.phtml index 1df74296..d7400110 100644 --- a/module/Job/view/job/job/index.phtml +++ b/module/Job/view/job/job/index.phtml @@ -59,6 +59,7 @@ elseif($order_by == 'duration') {
+
+result; ?>
+
+
diff --git a/module/Job/view/job/job/run.phtml b/module/Job/view/job/job/run.phtml
new file mode 100644
index 00000000..bd997787
--- /dev/null
+++ b/module/Job/view/job/job/run.phtml
@@ -0,0 +1,69 @@
+.
+ *
+ */
+
+$title = 'Jobs';
+$this->headTitle($title);
+
+?>
+
+
+translate("Name"); ?> | ++ |
---|---|
escapeHtml($job['name']); ?> | ++translate('Run now'); ?> | +