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;
} }
@ -372,10 +374,10 @@ class TransportConfigForm extends ConfigForm
'checkbox', 'checkbox',
'force_creation', 'force_creation',
array( array(
'order' => 0, 'order' => 0,
'ignore' => true, 'ignore' => true,
'label' => $this->translate('Force Changes'), 'label' => $this->translate('Force Changes'),
'description' => $this->translate( 'description' => $this->translate(
'Check this box to enforce changes without connectivity validation' 'Check this box to enforce changes without connectivity validation'
) )
) )

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,17 +384,19 @@ 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') {
$page->addElement( if ($page->getSubForm('transport_form')->getSubForm('transport_form') instanceof ApiTransportForm) {
'submit', $page->addElement(
'transport_validation', 'submit',
array( 'transport_validation',
'ignore' => true, array(
'label' => t('Validate Configuration'), 'ignore' => true,
'data-progress-label' => t('Validation In Progress'), 'label' => t('Validate Configuration'),
'decorators' => array('ViewHelper') 'data-progress-label' => t('Validation In Progress'),
) 'decorators' => array('ViewHelper')
); )
$page->getDisplayGroup('buttons')->addElement($page->getElement('transport_validation')); );
$page->getDisplayGroup('buttons')->addElement($page->getElement('transport_validation'));
}
} }
} }