Wizard: Add restart button

refs #9658
This commit is contained in:
Noah Hilverling 2016-12-22 14:17:30 +01:00
parent 361bfc5081
commit 19f2c813f1
3 changed files with 66 additions and 1 deletions

View File

@ -5,6 +5,8 @@ namespace Icinga\Module\Setup\Controllers;
use Icinga\Module\Setup\WebWizard;
use Icinga\Web\Controller;
use Icinga\Web\Form;
use Icinga\Web\Url;
class IndexController extends Controller
{
@ -42,8 +44,47 @@ class IndexController extends Controller
$this->view->report = $setup->getReport();
} else {
$wizard->handleRequest();
$restartForm = new Form();
$restartForm->setUidDisabled();
$restartForm->setName('setup_restart_form');
$restartForm->setAction(Url::fromPath('setup/index/restart'));
$restartForm->setAttrib('class', 'restart-form');
$restartForm->addElement(
'button',
'btn_submit',
array(
'type' => 'submit',
'value' => 'btn_submit',
'escape' => false,
'label' => $this->view->icon('reply-all'),
'title' => $this->translate('Restart the setup'),
'decorators' => array('ViewHelper')
)
);
$this->view->restartForm = $restartForm;
}
$this->view->wizard = $wizard;
}
/**
* Reset session and restart the wizard
*/
public function restartAction()
{
$this->assertHttpMethod('POST');
$form = new Form(array(
'onSuccess' => function () {
$wizard = new WebWizard();
$wizard->clearSession();
}
));
$form->setUidDisabled();
$form->setRedirectUrl('setup');
$form->setSubmitLabel('btn_submit');
$form->handleRequest();
}
}

View File

@ -52,6 +52,9 @@ if ($notifications->hasMessages()) {
<td class="middle"><div class="bubble <?= $stateClass; ?>"></div></td>
<td class="right"><div class="line right <?= $stateClass; ?>"></div></td>
</tr></tbody></table>
<?php if (($maxProgress < $currentPos && $currentPos === 1) || ($maxProgress >= $currentPos && $maxProgress === 1)): ?>
<?= $this->restartForm ?>
<?php endif ?>
</div>
<div class="step" style="width: 10%;">
<h1><?= $this->translate('Requirements', 'setup.progress'); ?></h1>
@ -65,6 +68,9 @@ if ($notifications->hasMessages()) {
<td class="middle"><div class="bubble<?= $stateClass; ?>"></div></td>
<td class="right"><div class="line right<?= $stateClass; ?>"></div></td>
</tr></tbody></table>
<?php if (($maxProgress < $currentPos && $currentPos === 2) || ($maxProgress >= $currentPos && $maxProgress === 2)): ?>
<?= $this->restartForm ?>
<?php endif ?>
</div>
<div class="step" style="width: 60%;">
<h1><?= $this->translate('Configuration', 'setup.progress'); ?></h1>
@ -122,6 +128,9 @@ if ($notifications->hasMessages()) {
<?php endforeach ?>
</td>
</tr></tbody></table>
<?php if ($maxProgress > 2 || $currentPos > 2): ?>
<?= $this->restartForm ?>
<?php endif ?>
</div>
<div class="step" style="width: 10%;">
<h1><?= $this->translate('Finish', 'setup.progress'); ?></h1>

View File

@ -20,6 +20,21 @@
float: left;
}
form[name='setup_restart_form'] button {
background: none;
border: none;
color: #ffffff;
cursor: pointer;
outline: none;
font-size: 1.4em;
margin-right: 0.6em;
-moz-transform: scale(1, -1);
-webkit-transform: scale(1, -1);
-o-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
}
.progress-bar {
overflow: hidden;
padding-top: 1em;
@ -36,7 +51,7 @@
}
table {
margin-top: 0.7em;
margin-top: 0.3em;
td {
padding: 0;