(Cleanup/Move)NodeForm extend BpConfigBaseForm

This commit is contained in:
Sukhwinder Dhillon 2023-08-09 10:13:36 +02:00 committed by Johannes Meyer
parent 78ad4491d2
commit 4d7ea853c1
2 changed files with 4 additions and 56 deletions

View file

@ -4,14 +4,13 @@ namespace Icinga\Module\Businessprocess\Forms;
use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Icinga\Module\Businessprocess\Web\Form\BpConfigBaseForm;
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
use Icinga\Web\Session\SessionNamespace;
use ipl\Html\FormattedString;
use ipl\Html\Html;
use ipl\Sql\Connection as IcingaDbConnection;
class CleanupNodeForm extends QuickForm
class CleanupNodeForm extends BpConfigBaseForm
{
/** @var MonitoringBackend|IcingaDbConnection */
protected $backend;
@ -42,37 +41,6 @@ class CleanupNodeForm extends QuickForm
}
}
/**
* @param MonitoringBackend|IcingaDbConnection $backend
* @return $this
*/
public function setBackend($backend)
{
$this->backend = $backend;
return $this;
}
/**
* @param BpConfig $process
* @return $this
*/
public function setProcess(BpConfig $process)
{
$this->bp = $process;
$this->setBackend($process->getBackend());
return $this;
}
/**
* @param SessionNamespace $session
* @return $this
*/
public function setSession(SessionNamespace $session)
{
$this->session = $session;
return $this;
}
public function onSuccess()
{
$changes = ProcessChanges::construct($this->bp, $this->session);

View file

@ -9,12 +9,12 @@ use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\Exception\ModificationError;
use Icinga\Module\Businessprocess\Modification\ProcessChanges;
use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\Web\Form\BpConfigBaseForm;
use Icinga\Module\Businessprocess\Web\Form\CsrfToken;
use Icinga\Module\Businessprocess\Web\Form\QuickForm;
use Icinga\Web\Session;
use Icinga\Web\Session\SessionNamespace;
class MoveNodeForm extends QuickForm
class MoveNodeForm extends BpConfigBaseForm
{
/** @var BpConfig */
protected $bp;
@ -95,16 +95,6 @@ class MoveNodeForm extends QuickForm
$this->setSubmitLabel('movenode');
}
/**
* @param BpConfig $process
* @return $this
*/
public function setProcess(BpConfig $process)
{
$this->bp = $process;
return $this;
}
/**
* @param Node $node
* @return $this
@ -125,16 +115,6 @@ class MoveNodeForm extends QuickForm
return $this;
}
/**
* @param SessionNamespace $session
* @return $this
*/
public function setSession(SessionNamespace $session)
{
$this->session = $session;
return $this;
}
public function onSuccess()
{
if (! CsrfToken::isValid($this->getValue('csrfToken'))) {