JobController: not in Branches, formatting

This commit is contained in:
Thomas Gelf 2021-10-05 23:02:53 +02:00
parent 2dc83478ae
commit 098f620802

View File

@ -6,10 +6,13 @@ use gipfl\IcingaWeb2\Link;
use Icinga\Module\Director\Forms\DirectorJobForm;
use Icinga\Module\Director\Web\Controller\ActionController;
use Icinga\Module\Director\Objects\DirectorJob;
use Icinga\Module\Director\Web\Controller\BranchHelper;
use Icinga\Module\Director\Web\Widget\JobDetails;
class JobController extends ActionController
{
use BranchHelper;
/**
* @throws \Icinga\Exception\MissingParameterException
* @throws \Icinga\Exception\NotFoundError
@ -29,8 +32,12 @@ class JobController extends ActionController
{
$this
->addSingleTab($this->translate('New Job'))
->addTitle($this->translate('Add a new Job'))
->content()->add(
->addTitle($this->translate('Add a new Job'));
if ($this->showNotInBranch($this->translate('Creating Jobs'))) {
return;
}
$this->content()->add(
DirectorJobForm::load()
->setSuccessUrl('director/job')
->setDb($this->db())
@ -45,16 +52,19 @@ class JobController extends ActionController
public function editAction()
{
$job = $this->requireJob();
$this
->addJobTabs($job, 'edit')
->addTitle($this->translate('Job: %s'), $job->get('job_name'))
->addToBasketLink();
if ($this->showNotInBranch($this->translate('Modifying Jobs'))) {
return;
}
$form = DirectorJobForm::load()
->setListUrl('director/jobs')
->setObject($job)
->handleRequest();
$this
->addJobTabs($job, 'edit')
->addTitle($this->translate('Job: %s'), $job->get('job_name'))
->addToBasketLink()
->content()->add($form);
$this->content()->add($form);
}
/**