Skip to content

Commit

Permalink
Jobs: Run jobs action
Browse files Browse the repository at this point in the history
Allow to run the following jobs as well.

JT_BACKUP                     'B' /* Backup Job */
JT_ADMIN                      'D' /* admin job */
JT_ARCHIVE                    'A' /* Archive Job */
JT_COPY                       'c' /* Copy Job */
JT_MIGRATE                    'g' /* Migration Job */               
JT_CONSOLIDATE                'O' /* Always Incremental Consolidate Job */
  • Loading branch information
fbergkemper committed Aug 2, 2016
1 parent 8d8693f commit 03c291f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
14 changes: 12 additions & 2 deletions module/Job/src/Job/Controller/JobController.php
Expand Up @@ -304,9 +304,19 @@ public function getDataAction()
echo $e->getMessage();
}
}
elseif($data == "backupjobs") {
elseif($data == "runjobs") {
try {
$result = $this->getJobModel()->getBackupJobs($this->bsock);
// Get the different kind of jobs and merge them. Jobs of the following types
// cannot nor wanted to be run. M,V,R,U,I,C and S.
$jobs_B = $this->getJobModel()->getJobsByType($this->bsock, 'B'); // Backup Job
$jobs_D = $this->getJobModel()->getJobsByType($this->bsock, 'D'); // Admin Job
$jobs_A = $this->getJobModel()->getJobsByType($this->bsock, 'A'); // Archive Job
$jobs_c = $this->getJobModel()->getJobsByType($this->bsock, 'c'); // Copy Job
$jobs_g = $this->getJobModel()->getJobsByType($this->bsock, 'g'); // Migration Job
$jobs_O = $this->getJobModel()->getJobsByType($this->bsock, 'O'); // Always Incremental Consolidate Job
$result = array_merge(
$jobs_B,$jobs_D,$jobs_A,$jobs_c,$jobs_g,$jobs_O
);
}
catch(Exception $e) {
echo $e->getMessage();
Expand Down
9 changes: 7 additions & 2 deletions module/Job/src/Job/Model/JobModel.php
Expand Up @@ -110,10 +110,15 @@ public function getJobLog(&$bsock=null, $id=null)
}
}

public function getBackupJobs(&$bsock=null)
public function getJobsByType(&$bsock=null, $type=null)
{
if(isset($bsock)) {
$cmd = '.jobs type=B';
if($type == null) {
$cmd = '.jobs';
}
else {
$cmd = '.jobs type="'.$type.'"';
}
$result = $bsock->send_command($cmd, 2, null);
$jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
return $jobs['result']['jobs'];
Expand Down
2 changes: 1 addition & 1 deletion module/Job/view/job/job/actions.phtml
Expand Up @@ -99,7 +99,7 @@ $this->headTitle($title);

var table= $('#backupjobs').DataTable( {
"ajax": {
"url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=backupjobs'; ?>",
"url": "<?php echo $this->url('job', array('action' => 'getData'), null) . '?data=runjobs'; ?>",
"dataSrc": ""
},
"language": {
Expand Down

0 comments on commit 03c291f

Please sign in to comment.