Skip to content

Commit

Permalink
monitoring: Introduce `ServiceController'
Browse files Browse the repository at this point in the history
In the long term, `ServiceController' and the upcmoing `HostController' should replace `ShowController'.

refs #6593
  • Loading branch information
lippserd committed Sep 4, 2014
1 parent 1358a5d commit 9cfd74d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions modules/monitoring/application/controllers/ServiceController.php
@@ -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());
}
}

0 comments on commit 9cfd74d

Please sign in to comment.