parent
c35f0976c2
commit
8207579e13
|
@ -90,4 +90,33 @@ class Monitoring_ActionsController extends Controller
|
||||||
->setObjects($serviceList->fetch())
|
->setObjects($serviceList->fetch())
|
||||||
->handleRequest($this->getRequest());
|
->handleRequest($this->getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove service downtimes
|
||||||
|
*/
|
||||||
|
public function removeServiceDowntimeAction()
|
||||||
|
{
|
||||||
|
// @TODO(el): Require a filter
|
||||||
|
$downtimes = $this->backend
|
||||||
|
->select()
|
||||||
|
->from('downtime', array('host_name', 'service_description', 'id' => 'downtime_internal_id'))
|
||||||
|
->where('object_type', 'service')
|
||||||
|
->applyFilter($this->getRestriction('monitoring/filter/objects'))
|
||||||
|
->handleRequest($this->getRequest())
|
||||||
|
->fetchAll();
|
||||||
|
if (empty($downtimes)) {
|
||||||
|
// @TODO(el): Use ApiResponse class for unified response handling.
|
||||||
|
$this->getResponse()->sendJson(array(
|
||||||
|
'status' => 'fail',
|
||||||
|
'message' => 'No downtimes found matching the given filter'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$form = new DeleteDowntimesCommandForm();
|
||||||
|
$form
|
||||||
|
->setIsApiTarget(true)
|
||||||
|
->setDowntimes($downtimes)
|
||||||
|
->handleRequest($this->getRequest());
|
||||||
|
// @TODO(el): Respond w/ the downtimes deleted instead of the notifiaction added by
|
||||||
|
// DeleteDowntimesCommandForm::onSuccess().
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue