Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Icinga Dependency Configuration
refs #11332
- Loading branch information
1 parent
37bdbe2
commit cb6f04c
Showing
11 changed files
with
597 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Clicommands; | ||
|
||
use Icinga\Module\Director\Cli\ObjectCommand; | ||
|
||
/** | ||
* Manage Icinga Dependencies | ||
* | ||
* Use this command to show, create, modify or delete Icinga Dependency | ||
* objects | ||
*/ | ||
class DependencyCommand extends ObjectCommand | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Controllers; | ||
|
||
use Icinga\Module\Director\Web\Controller\ObjectsController; | ||
|
||
class DependenciesController extends ObjectsController | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Controllers; | ||
|
||
use Icinga\Module\Director\Web\Controller\ObjectController; | ||
use Icinga\Module\Director\Objects\IcingaDependency; | ||
|
||
class DependencyController extends ObjectController | ||
{ | ||
protected $apply; | ||
|
||
protected function beforeTabs() | ||
{ | ||
} | ||
|
||
public function init() | ||
{ | ||
parent::init(); | ||
|
||
if ($apply = $this->params->get('apply')) { | ||
$this->apply = IcingaDependency::load( | ||
array('object_name' => $apply, 'object_type' => 'template'), | ||
$this->db() | ||
); | ||
} | ||
|
||
} | ||
|
||
protected function loadObject() | ||
{ | ||
if ($this->object === null) { | ||
if ($name = $this->params->get('name')) { | ||
$params = array('object_name' => $name); | ||
$db = $this->db(); | ||
|
||
$this->object = IcingaDependency::load($params, $db); | ||
} else { | ||
parent::loadObject(); | ||
} | ||
} | ||
|
||
return $this->object; | ||
} | ||
|
||
public function addAction() | ||
{ | ||
parent::addAction(); | ||
|
||
if ($this->apply) { | ||
$this->view->title = sprintf( | ||
$this->translate('Apply "%s"'), | ||
$this->apply->object_name | ||
); | ||
} | ||
} | ||
|
||
public function loadForm($name) | ||
{ | ||
$form = parent::loadForm($name); | ||
return $form; | ||
} | ||
|
||
protected function beforeHandlingAddRequest($form) | ||
{ | ||
if ($this->apply) { | ||
$form->createApplyRuleFor($this->apply); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.