mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-04-15 22:09:27 -04:00
node: add new url for simulation and editing
This commit is contained in:
parent
f2989790f2
commit
5cea970d8b
3 changed files with 61 additions and 0 deletions
47
application/controllers/NodeController.php
Normal file
47
application/controllers/NodeController.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Module\Bpapp\Controller;
|
||||
use Icinga\Module\Bpapp\Forms\ProcessForm;
|
||||
use Icinga\Module\Bpapp\Forms\SimulationForm;
|
||||
use Icinga\Web\Url;
|
||||
|
||||
class Bpapp_NodeController extends Controller
|
||||
{
|
||||
public function editAction()
|
||||
{
|
||||
$bp = $this->loadBp();
|
||||
$node = $bp->getNode($this->getParam('node'));
|
||||
|
||||
$form = new ProcessForm();
|
||||
$form->setBackend($this->backend)
|
||||
->setProcess($bp)
|
||||
->setNode($node)
|
||||
->handleRequest();
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->node = $node;
|
||||
}
|
||||
|
||||
public function simulateAction()
|
||||
{
|
||||
$bp = $this->loadBp();
|
||||
$nodename = $this->getParam('node');
|
||||
$node = $bp->getNode($nodename);
|
||||
$detail = Url::fromPath(
|
||||
'bpapp/node/simulate',
|
||||
array('node' => $nodename)
|
||||
);
|
||||
$form = new SimulationForm();
|
||||
|
||||
$form->setBackend($this->backend)
|
||||
->setProcess($bp)
|
||||
->setSession($this->session())
|
||||
->setNode($node)
|
||||
// TODO: find a better way to handle redirects
|
||||
->setRedirectUrl('bpapp/process/simulate#!' . $detail->getAbsoluteUrl())
|
||||
->handleRequest();
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->node = $node;
|
||||
}
|
||||
}
|
||||
10
application/views/scripts/node/edit.phtml
Normal file
10
application/views/scripts/node/edit.phtml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Module\Bpapp\HostNode;
|
||||
use Icinga\Module\Bpapp\ServiceNode;
|
||||
use Icinga\Module\Bpapp\BpNode;
|
||||
|
||||
?><div class="content">
|
||||
<h1><?= $this->escape($node) ?></h1>
|
||||
<?= $this->form ?>
|
||||
</div>
|
||||
4
application/views/scripts/node/simulate.phtml
Normal file
4
application/views/scripts/node/simulate.phtml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<div class="content">
|
||||
<h1>BI Simulation: <?= $this->escape(preg_replace('/;/', ' - ', $this->node)) ?></h1>
|
||||
<?= $this->form ?>
|
||||
</div>
|
||||
Loading…
Reference in a new issue