monitoring: Reduce auto-refresh interval after a command has been submitted

This commit is contained in:
Eric Lippmann 2016-01-27 16:55:34 +01:00
parent c1f7b2ed2d
commit 16bd78ac30
1 changed files with 17 additions and 0 deletions

View File

@ -72,4 +72,21 @@ abstract class CommandForm extends Form
return $transport;
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl()
{
$redirectUrl = parent::getRedirectUrl();
// TODO(el): Forms should provide event handling. This is quite hackish
$formData = $this->getRequestData();
if ($this->wasSent($formData)
&& (! $this->getSubmitLabel() || $this->isSubmitted())
&& $this->isValid($formData)
) {
$this->getResponse()->setAutoRefreshInterval(1);
}
return $redirectUrl;
}
}