Setup: Only allow to validate the API transport configuration

refs #3101
This commit is contained in:
Johannes Meyer 2017-11-21 13:46:29 +01:00
parent 22c6bf75e7
commit e4fd8d5124
3 changed files with 22 additions and 16 deletions

View File

@ -355,7 +355,9 @@ class TransportConfigForm extends ConfigForm
} }
if ($this->getSubForm('transport_form') instanceof ApiTransportForm) { if ($this->getSubForm('transport_form') instanceof ApiTransportForm) {
if (isset($formData['force_creation']) && $formData['force_creation']) { if (! isset($formData['transport_validation'])
&& isset($formData['force_creation']) && $formData['force_creation']
) {
// ignore any validation result // ignore any validation result
return true; return true;
} }

View File

@ -94,6 +94,7 @@ class MonitoringWizard extends Wizard implements SetupWizard
* @param Form $page The page to add the buttons to * @param Form $page The page to add the buttons to
* *
* @todo This is never called, because its a sub-wizard only * @todo This is never called, because its a sub-wizard only
* @todo This is missing the ´transport_validation´ case
* @see WebWizard::addButtons which does some of the needed work * @see WebWizard::addButtons which does some of the needed work
*/ */
protected function addButtons(Form $page) protected function addButtons(Form $page)

View File

@ -36,6 +36,7 @@ use Icinga\Module\Setup\Requirement\PhpConfigRequirement;
use Icinga\Module\Setup\Requirement\PhpModuleRequirement; use Icinga\Module\Setup\Requirement\PhpModuleRequirement;
use Icinga\Module\Setup\Requirement\PhpVersionRequirement; use Icinga\Module\Setup\Requirement\PhpVersionRequirement;
use Icinga\Module\Setup\Requirement\ConfigDirectoryRequirement; use Icinga\Module\Setup\Requirement\ConfigDirectoryRequirement;
use Icinga\Module\Monitoring\Forms\Config\Transport\ApiTransportForm;
/** /**
* Icinga Web 2 Setup Wizard * Icinga Web 2 Setup Wizard
@ -383,6 +384,7 @@ class WebWizard extends Wizard implements SetupWizard
// TODO(mf): This should be handled by MonitoringWizard // TODO(mf): This should be handled by MonitoringWizard
if ($page->getName() === 'setup_command_transport') { if ($page->getName() === 'setup_command_transport') {
if ($page->getSubForm('transport_form')->getSubForm('transport_form') instanceof ApiTransportForm) {
$page->addElement( $page->addElement(
'submit', 'submit',
'transport_validation', 'transport_validation',
@ -396,6 +398,7 @@ class WebWizard extends Wizard implements SetupWizard
$page->getDisplayGroup('buttons')->addElement($page->getElement('transport_validation')); $page->getDisplayGroup('buttons')->addElement($page->getElement('transport_validation'));
} }
} }
}
/** /**
* Clear the session being used by this wizard * Clear the session being used by this wizard