Start with command form cleanup

This commit is contained in:
Thomas Gelf 2014-03-06 13:47:26 +00:00
parent 1b503fd187
commit 980ddbc8a9
3 changed files with 28 additions and 20 deletions

View File

@ -36,6 +36,7 @@ use Icinga\Module\Monitoring\DataView\ServiceStatus;
use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm; use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm;
use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm; use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Url;
use Icinga\Web\Controller\ActionController; use Icinga\Web\Controller\ActionController;
use Icinga\Protocol\Commandpipe\CommandPipe; use Icinga\Protocol\Commandpipe\CommandPipe;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
@ -94,6 +95,14 @@ class Monitoring_CommandController extends ActionController
return $this->form !== null && ($this->form instanceof Form); return $this->form !== null && ($this->form instanceof Form);
} }
protected function addTitleTab($action)
{
$this->getTabs()->add($action, array(
'title' => ucfirst($action),
'url' => Url::fromRequest()
))->activate($action);
}
/** /**
* Post dispatch method * Post dispatch method
* *
@ -927,6 +936,7 @@ class Monitoring_CommandController extends ActionController
*/ */
public function acknowledgeproblemAction() public function acknowledgeproblemAction()
{ {
$this->addTitleTab('Acknowledge Problem');
$this->setSupportedParameters(array('host', 'service')); $this->setSupportedParameters(array('host', 'service'));
$form = new AcknowledgeForm(); $form = new AcknowledgeForm();
$form->setRequest($this->getRequest()); $form->setRequest($this->getRequest());

View File

@ -1,35 +1,25 @@
<div class="controls">
<?= $this->tabs ?>
</div>
<div class="content">
<?php if (isset($this->objects) && !empty($this->objects) && isset($this->objects[0]->host_name)): ?> <?php if (isset($this->objects) && !empty($this->objects) && isset($this->objects[0]->host_name)): ?>
<table class="table table-bordered table-striped table-condensed"> <table class="objectlist">
<legend>Affected Objects</legend>
<thead> <thead>
<tr> <tr>
<th> <th><?= $this->img('img/icons/host.png') ?> Host</th>
<i class="icinga-icon-host"></i> <th><?= $this->img('img/icons/service.png') ?> Service</th>
Host Name
</th>
<th>
<i class="icinga-icon-service"></i>
Service Name
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($this->objects as $object): ?> <?php foreach ($this->objects as $object): ?>
<tr> <tr>
<td><?= $object->host_name; ?></td> <td><?= $object->host_name; ?></td>
<td><?= (isset($object->service_description) ? $object->service_description : ''); ?></td> <td><?= (isset($object->service_description) ? $object->service_description : '') ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?php endif; ?> <?php endif ?>
<?= $this->form ?>
<?php if ($this->form): ?>
<div>
<?= $this->form; ?>
<div class="clearfix"></div>
</div> </div>
<?php endif; ?>

View File

@ -129,3 +129,11 @@ table.perfdata th {
text-align: left; text-align: left;
padding-right: 0.5em; padding-right: 0.5em;
} }
table.objectlist {
min-width: 28em;
th {
text-align: left;
}
}