parent
7fef9bddde
commit
22c6bf75e7
|
@ -270,6 +270,10 @@ class TransportConfigForm extends ConfigForm
|
||||||
parent::addSubmitButton();
|
parent::addSubmitButton();
|
||||||
|
|
||||||
if ($this->getSubForm('transport_form') instanceof ApiTransportForm) {
|
if ($this->getSubForm('transport_form') instanceof ApiTransportForm) {
|
||||||
|
$btnSubmit = $this->getElement('btn_submit');
|
||||||
|
|
||||||
|
if ($btnSubmit !== null) {
|
||||||
|
// In the setup wizard $this is being used as a subform which doesn't have a submit button.
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
'transport_validation',
|
'transport_validation',
|
||||||
|
@ -293,13 +297,11 @@ class TransportConfigForm extends ConfigForm
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$btnSubmit = $this->getElement('btn_submit');
|
|
||||||
$elements = array('transport_validation', 'transport-progress');
|
$elements = array('transport_validation', 'transport-progress');
|
||||||
if ($btnSubmit !== null) {
|
|
||||||
// In the setup wizard $this is being used as a subform which doesn't have a submit button.
|
|
||||||
$btnSubmit->setDecorators(array('ViewHelper'));
|
$btnSubmit->setDecorators(array('ViewHelper'));
|
||||||
array_unshift($elements, 'btn_submit');
|
array_unshift($elements, 'btn_submit');
|
||||||
}
|
|
||||||
$this->addDisplayGroup(
|
$this->addDisplayGroup(
|
||||||
$elements,
|
$elements,
|
||||||
'submit_validation',
|
'submit_validation',
|
||||||
|
@ -311,6 +313,7 @@ class TransportConfigForm extends ConfigForm
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -351,9 +354,12 @@ class TransportConfigForm extends ConfigForm
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ($this->getElement('transport_validation') === null || (
|
if ($this->getSubForm('transport_form') instanceof ApiTransportForm) {
|
||||||
$this->isSubmitted() && isset($formData['force_creation']) && $formData['force_creation'])
|
if (isset($formData['force_creation']) && $formData['force_creation']) {
|
||||||
)) {
|
// ignore any validation result
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CommandTransport::createTransport(new ConfigObject($this->getValues()))->probe();
|
CommandTransport::createTransport(new ConfigObject($this->getValues()))->probe();
|
||||||
} catch (CommandTransportException $e) {
|
} catch (CommandTransportException $e) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ class TransportPage extends Form
|
||||||
$this->addDescription($this->translate(
|
$this->addDescription($this->translate(
|
||||||
'Please define below how you want to send commands to your monitoring instance.'
|
'Please define below how you want to send commands to your monitoring instance.'
|
||||||
));
|
));
|
||||||
|
$this->setValidatePartial(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createElements(array $formData)
|
public function createElements(array $formData)
|
||||||
|
@ -30,4 +31,25 @@ class TransportPage extends Form
|
||||||
{
|
{
|
||||||
return $this->getSubForm('transport_form')->getValues($suppressArrayNotation);
|
return $this->getSubForm('transport_form')->getValues($suppressArrayNotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the configured backend's inspection checks and show the result, if necessary
|
||||||
|
*
|
||||||
|
* This will only run any validation if the user pushed the 'transport_validation' button.
|
||||||
|
*
|
||||||
|
* @param array $formData
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isValidPartial(array $formData)
|
||||||
|
{
|
||||||
|
if (isset($formData['transport_validation']) && parent::isValid($formData)) {
|
||||||
|
$this->info($this->translate('The configuration has been successfully validated.'));
|
||||||
|
} elseif (! isset($formData['transport_validation'])) {
|
||||||
|
// This is usually done by isValid(Partial), but as we're not calling any of these...
|
||||||
|
$this->populate($formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,9 @@ class MonitoringWizard extends Wizard implements SetupWizard
|
||||||
* Add buttons to the given page based on its position in the page-chain
|
* Add buttons to the given page based on its position in the page-chain
|
||||||
*
|
*
|
||||||
* @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
|
||||||
|
* @see WebWizard::addButtons which does some of the needed work
|
||||||
*/
|
*/
|
||||||
protected function addButtons(Form $page)
|
protected function addButtons(Form $page)
|
||||||
{
|
{
|
||||||
|
|
|
@ -366,7 +366,7 @@ class WebWizard extends Wizard implements SetupWizard
|
||||||
'setup_auth_db_resource',
|
'setup_auth_db_resource',
|
||||||
'setup_config_db_resource',
|
'setup_config_db_resource',
|
||||||
'setup_ldap_resource',
|
'setup_ldap_resource',
|
||||||
'setup_monitoring_ido'
|
'setup_monitoring_ido', // TODO(mf): This should be handled by MonitoringWizard
|
||||||
))) {
|
))) {
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
|
@ -380,6 +380,21 @@ class WebWizard extends Wizard implements SetupWizard
|
||||||
);
|
);
|
||||||
$page->getDisplayGroup('buttons')->addElement($page->getElement('backend_validation'));
|
$page->getDisplayGroup('buttons')->addElement($page->getElement('backend_validation'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(mf): This should be handled by MonitoringWizard
|
||||||
|
if ($page->getName() === 'setup_command_transport') {
|
||||||
|
$page->addElement(
|
||||||
|
'submit',
|
||||||
|
'transport_validation',
|
||||||
|
array(
|
||||||
|
'ignore' => true,
|
||||||
|
'label' => t('Validate Configuration'),
|
||||||
|
'data-progress-label' => t('Validation In Progress'),
|
||||||
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$page->getDisplayGroup('buttons')->addElement($page->getElement('transport_validation'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue