Skip to content

Commit

Permalink
webui: extend job model (job timeline)
Browse files Browse the repository at this point in the history
- introduce getJobsForPeriodByJobname method
  • Loading branch information
fbergkemper committed Feb 4, 2022
1 parent 64b0517 commit bbf86d3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion webui/module/Job/src/Job/Model/JobModel.php
Expand Up @@ -5,7 +5,7 @@
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos for the canonical source repository
* @copyright Copyright (C) 2013-2021 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @copyright Copyright (C) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -153,6 +153,23 @@ public function getClientJobsForPeriod(&$bsock=null, $client=null, $period=null)
}
}

public function getJobsForPeriodByJobname(&$bsock=null, $jobname=null, $period=null)
{
if(isset($bsock, $jobname, $period)) {
$cmd = 'llist jobs jobname="'.$jobname.'" days='.$period;
$result = $bsock->send_command($cmd, 2);
$jobs = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
if (empty($jobs['result'])) {
return false;
} else {
return $jobs['result']['jobs'];
}
}
else {
throw new \Exception('Missing argument.');
}
}

/**
* Get a single Job
*
Expand Down

0 comments on commit bbf86d3

Please sign in to comment.