parent
b0221c5e13
commit
fe72973e6e
|
@ -11,6 +11,7 @@
|
|||
} else {
|
||||
echo $this->render('partials/object/service-header.phtml');
|
||||
} ?>
|
||||
<?= $this->render('partials/object/quick-actions.phtml') ?>
|
||||
</div>
|
||||
<div class="content object-command">
|
||||
<?= $form ?>
|
||||
|
|
|
@ -55,25 +55,8 @@ abstract class MonitoredObjectController extends Controller
|
|||
public function showAction()
|
||||
{
|
||||
$this->setAutorefreshInterval(10);
|
||||
$this->setupQuickActionForms();
|
||||
$auth = $this->Auth();
|
||||
if ($auth->hasPermission('monitoring/command/schedule-check')) {
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
$this->view->checkNowForm = $checkNowForm;
|
||||
}
|
||||
if (! in_array((int) $this->object->state, array(0, 99))) {
|
||||
if ((bool) $this->object->acknowledged) {
|
||||
if ($auth->hasPermission('monitoring/command/remove-acknowledgement')) {
|
||||
$removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
$removeAckForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
$this->view->removeAckForm = $removeAckForm;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->object->populate();
|
||||
$this->handleFormatRequest();
|
||||
$toggleFeaturesForm = new ToggleObjectFeaturesCommandForm(array(
|
||||
|
@ -132,6 +115,7 @@ abstract class MonitoredObjectController extends Controller
|
|||
$this->view->tabs->remove('dashboard');
|
||||
$this->view->tabs->remove('menu-entry');
|
||||
$this->_helper->viewRenderer('partials/command/object-command-form', null, true);
|
||||
$this->setupQuickActionForms();
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
@ -256,4 +240,27 @@ abstract class MonitoredObjectController extends Controller
|
|||
}
|
||||
$tabs->extend(new DashboardAction())->extend(new MenuAction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create quick action forms and pass them to the view
|
||||
*/
|
||||
protected function setupQuickActionForms()
|
||||
{
|
||||
$auth = $this->Auth();
|
||||
if ($auth->hasPermission('monitoring/command/schedule-check')) {
|
||||
$this->view->checkNowForm = $checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
}
|
||||
if (! in_array((int) $this->object->state, array(0, 99))
|
||||
&& $this->object->acknowledged
|
||||
&& $auth->hasPermission('monitoring/command/remove-acknowledgement')
|
||||
) {
|
||||
$this->view->removeAckForm = $removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
$removeAckForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue