Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monitoring: Introduce `ServiceController'
In the long term, `ServiceController' and the upcmoing `HostController' should replace `ShowController'. refs #6593
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
modules/monitoring/application/controllers/ServiceController.php
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,41 @@ | ||
<?php | ||
// {{{ICINGA_LICENSE_HEADER}}} | ||
// {{{ICINGA_LICENSE_HEADER}}} | ||
|
||
use Icinga\Module\Monitoring\Controller; | ||
use Icinga\Module\Monitoring\Form\Command\CommandForm; | ||
use Icinga\Module\Monitoring\Form\Command\Service\ScheduleServiceDowntimeCommandForm; | ||
use Icinga\Module\Monitoring\Object\Service; | ||
|
||
class Monitoring_ServiceController extends Controller | ||
{ | ||
/** | ||
* @var Service | ||
*/ | ||
protected $service; | ||
|
||
public function init() | ||
{ | ||
$this->service = new Service($this->params); // Use $this->_request->getParams() instead of $this->params | ||
// once #7049 has been fixed | ||
} | ||
|
||
protected function handleCommandForm(CommandForm $form) | ||
{ | ||
$form | ||
->setService($this->service) | ||
->handleRequest(); | ||
$this->view->form = $form; | ||
$this->_helper->viewRenderer('command'); | ||
return $form; | ||
} | ||
|
||
/** | ||
* Schedule a service downtime | ||
*/ | ||
public function scheduleDowntimeAction() | ||
{ | ||
$this->view->title = $this->translate('Schedule Service Downtime'); | ||
$this->handleCommandForm(new ScheduleServiceDowntimeCommandForm()); | ||
} | ||
} |