WIP: click on service set title row should not...
...remove the set from the related host
This commit is contained in:
parent
49d9ed7ecd
commit
657d6a958f
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Forms;
|
||||
|
||||
use dipl\Html\Icon;
|
||||
use dipl\Web\Url;
|
||||
use Icinga\Module\Director\Web\Form\DirectorForm;
|
||||
|
||||
class RemoveLinkForm extends DirectorForm
|
||||
{
|
||||
private $label;
|
||||
|
||||
private $title;
|
||||
|
||||
public function __construct($label, $title, $action, $params = [])
|
||||
{
|
||||
parent::__construct([
|
||||
'style' => 'float: right'
|
||||
]);
|
||||
$this->label = $label;
|
||||
$this->title = $title;
|
||||
foreach ($params as $name => $value) {
|
||||
$this->addHidden($name, $value);
|
||||
}
|
||||
$this->setAction($action);
|
||||
}
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$this->setAttrib('class', 'inline');
|
||||
//$this->setDecorators(['Form', 'FormElements']);
|
||||
// 'class' => 'icon-cancel',
|
||||
// 'style' => 'float: right; font-weight: normal',
|
||||
// 'title' => $this->translate('Remove this set from this host')
|
||||
|
||||
$this->addHtml(Icon::create('cancel'));
|
||||
$this->addSubmitButton($this->label, [
|
||||
'class' => 'link-button',
|
||||
'title' => $this->title,
|
||||
'data-base-target' => '_next'
|
||||
]);
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
{
|
||||
// nothing.
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Director\Web\Table;
|
||||
|
||||
use Icinga\Module\Director\Forms\RemoveLinkForm;
|
||||
use Icinga\Module\Director\Objects\IcingaHost;
|
||||
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
||||
use dipl\Html\HtmlElement;
|
||||
|
@ -156,6 +157,7 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
|
|||
]
|
||||
);
|
||||
} else {
|
||||
// !!!
|
||||
$deleteLink = Link::create(
|
||||
$this->translate('Remove'),
|
||||
'director/host/removeset',
|
||||
|
@ -169,6 +171,16 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
|
|||
'title' => $this->translate('Remove this set from this host')
|
||||
]
|
||||
);
|
||||
$deleteLink = new RemoveLinkForm(
|
||||
$this->translate('Remove'),
|
||||
$this->translate('Remove this set from this host'),
|
||||
'director/host/removeset',
|
||||
[
|
||||
'name' => $this->host->getObjectName(),
|
||||
'setId' => $this->set->get('id')
|
||||
]
|
||||
);
|
||||
$deleteLink->handleRequest();
|
||||
}
|
||||
|
||||
$parent->add($this::th([$this->getTitle(), $deleteLink]));
|
||||
|
|
Loading…
Reference in New Issue