mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
Wizard: Show a textarea on the finish page instead of multiple paragraphs
refs #7911
This commit is contained in:
parent
cef9b58029
commit
c8c0e13184
@ -136,28 +136,35 @@ class BackendStep extends Step
|
|||||||
|
|
||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
$report = '';
|
$report = array();
|
||||||
|
|
||||||
if ($this->backendIniError === false) {
|
if ($this->backendIniError === false) {
|
||||||
$message = mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s');
|
$report[] = sprintf(
|
||||||
$report .= '<p>' . sprintf($message, Config::resolvePath('modules/monitoring/backends.ini')) . '</p>';
|
mt('monitoring', 'Monitoring backend configuration has been successfully written to: %s'),
|
||||||
} elseif ($this->backendIniError !== null) {
|
|
||||||
$message = mt(
|
|
||||||
'monitoring',
|
|
||||||
'Monitoring backend configuration could not be written to: %s; An error occured:'
|
|
||||||
);
|
|
||||||
$report .= '<p class="error">' . sprintf(
|
|
||||||
$message,
|
|
||||||
Config::resolvePath('modules/monitoring/backends.ini')
|
Config::resolvePath('modules/monitoring/backends.ini')
|
||||||
) . '</p><p>' . $this->backendIniError->getMessage() . '</p>';
|
);
|
||||||
|
} elseif ($this->backendIniError !== null) {
|
||||||
|
$report[] = sprintf(
|
||||||
|
mt(
|
||||||
|
'monitoring',
|
||||||
|
'Monitoring backend configuration could not be written to: %s. An error occured:'
|
||||||
|
),
|
||||||
|
Config::resolvePath('modules/monitoring/backends.ini')
|
||||||
|
);
|
||||||
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->backendIniError->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->resourcesIniError === false) {
|
if ($this->resourcesIniError === false) {
|
||||||
$message = mt('monitoring', 'Resource configuration has been successfully updated: %s');
|
$report[] = sprintf(
|
||||||
$report .= '<p>' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>';
|
mt('monitoring', 'Resource configuration has been successfully updated: %s'),
|
||||||
|
Config::resolvePath('resources.ini')
|
||||||
|
);
|
||||||
} elseif ($this->resourcesIniError !== null) {
|
} elseif ($this->resourcesIniError !== null) {
|
||||||
$message = mt('monitoring', 'Resource configuration could not be udpated: %s; An error occured:');
|
$report[] = sprintf(
|
||||||
$report .= '<p class="error">' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>'
|
mt('monitoring', 'Resource configuration could not be udpated: %s. An error occured:'),
|
||||||
. '<p>' . $this->resourcesIniError->getMessage() . '</p>';
|
Config::resolvePath('resources.ini')
|
||||||
|
);
|
||||||
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->resourcesIniError->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $report;
|
return $report;
|
||||||
|
@ -85,15 +85,21 @@ class InstanceStep extends Step
|
|||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
if ($this->error === false) {
|
if ($this->error === false) {
|
||||||
$message = mt('monitoring', 'Monitoring instance configuration has been successfully created: %s');
|
return array(sprintf(
|
||||||
return '<p>' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini')) . '</p>';
|
mt('monitoring', 'Monitoring instance configuration has been successfully created: %s'),
|
||||||
|
Config::resolvePath('modules/monitoring/instances.ini')
|
||||||
|
));
|
||||||
} elseif ($this->error !== null) {
|
} elseif ($this->error !== null) {
|
||||||
$message = mt(
|
return array(
|
||||||
'monitoring',
|
sprintf(
|
||||||
'Monitoring instance configuration could not be written to: %s; An error occured:'
|
mt(
|
||||||
|
'monitoring',
|
||||||
|
'Monitoring instance configuration could not be written to: %s. An error occured:'
|
||||||
|
),
|
||||||
|
Config::resolvePath('modules/monitoring/instances.ini')
|
||||||
|
),
|
||||||
|
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
|
||||||
);
|
);
|
||||||
return '<p class="error">' . sprintf($message, Config::resolvePath('modules/monitoring/instances.ini'))
|
|
||||||
. '</p><p>' . $this->error->getMessage() . '</p>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,15 +63,21 @@ class SecurityStep extends Step
|
|||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
if ($this->error === false) {
|
if ($this->error === false) {
|
||||||
$message = mt('monitoring', 'Monitoring security configuration has been successfully created: %s');
|
return array(sprintf(
|
||||||
return '<p>' . sprintf($message, Config::resolvePath('modules/monitoring/config.ini')) . '</p>';
|
mt('monitoring', 'Monitoring security configuration has been successfully created: %s'),
|
||||||
|
Config::resolvePath('modules/monitoring/config.ini')
|
||||||
|
));
|
||||||
} elseif ($this->error !== null) {
|
} elseif ($this->error !== null) {
|
||||||
$message = mt(
|
return array(
|
||||||
'monitoring',
|
sprintf(
|
||||||
'Monitoring security configuration could not be written to: %s; An error occured:'
|
mt(
|
||||||
|
'monitoring',
|
||||||
|
'Monitoring security configuration could not be written to: %s. An error occured:'
|
||||||
|
),
|
||||||
|
Config::resolvePath('modules/monitoring/config.ini')
|
||||||
|
),
|
||||||
|
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
|
||||||
);
|
);
|
||||||
return '<p class="error">' . sprintf($message, Config::resolvePath('modules/monitoring/config.ini'))
|
|
||||||
. '</p><p>' . $this->error->getMessage() . '</p>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,10 @@
|
|||||||
<div id="setup-finish">
|
<div id="setup-finish">
|
||||||
<div class="report">
|
<?php if ($success): ?>
|
||||||
<?php $firstLine = true; ?>
|
<h2 class="success"><?= $this->translate('Congratulations! Icinga Web 2 has been successfully set up.'); ?></h2>
|
||||||
<?php foreach ($report as $entry): ?>
|
<?php else: ?>
|
||||||
<?php if ($entry): ?>
|
<h2 class="failure"><?= $this->translate('Sorry! Failed to set up Icinga Web 2 successfully.'); ?></h2>
|
||||||
<?php if (false === $firstLine): ?>
|
<?php endif ?>
|
||||||
<div class="line-separator"></div>
|
<div class="buttons pull-right">
|
||||||
<?php endif ?>
|
|
||||||
<?= $entry; ?>
|
|
||||||
<?php $firstLine = false; ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php if ($success): ?>
|
|
||||||
<p class="success"><?= $this->translate('Congratulations! Icinga Web 2 has been successfully set up.'); ?></p>
|
|
||||||
<?php else: ?>
|
|
||||||
<p class="failure"><?= $this->translate('Sorry! Failed to set up Icinga Web 2 successfully.'); ?></p>
|
|
||||||
<?php endif ?>
|
|
||||||
</div>
|
|
||||||
<div class="buttons">
|
|
||||||
<?php if ($success): ?>
|
<?php if ($success): ?>
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
$this->translate('Login to Icinga Web 2'),
|
$this->translate('Login to Icinga Web 2'),
|
||||||
@ -39,4 +27,7 @@
|
|||||||
); ?>
|
); ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
<textarea class="report" readonly><?= join("\n\n", array_map(function($a) {
|
||||||
|
return join("\n", $a);
|
||||||
|
}, $report)); ?></textarea>
|
||||||
</div>
|
</div>
|
@ -81,13 +81,16 @@ class Setup implements IteratorAggregate
|
|||||||
/**
|
/**
|
||||||
* Return a report of all actions that were run
|
* Return a report of all actions that were run
|
||||||
*
|
*
|
||||||
* @return array An array of HTML strings
|
* @return array An array of arrays of strings
|
||||||
*/
|
*/
|
||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
$reports = array();
|
$reports = array();
|
||||||
foreach ($this->steps as $step) {
|
foreach ($this->steps as $step) {
|
||||||
$reports[] = $step->getReport();
|
$report = $step->getReport();
|
||||||
|
if (! empty($report)) {
|
||||||
|
$reports[] = $report;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reports;
|
return $reports;
|
||||||
|
@ -23,9 +23,9 @@ abstract class Step
|
|||||||
abstract public function getSummary();
|
abstract public function getSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a HTML representation of this step's configuration changes that were made
|
* Return a textual summary of all configuration changes made
|
||||||
*
|
*
|
||||||
* @return string
|
* @return array
|
||||||
*/
|
*/
|
||||||
abstract public function getReport();
|
abstract public function getReport();
|
||||||
}
|
}
|
||||||
|
@ -161,32 +161,45 @@ class AuthenticationStep extends Step
|
|||||||
|
|
||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
$report = '';
|
$report = array();
|
||||||
|
|
||||||
if ($this->authIniError === false) {
|
if ($this->authIniError === false) {
|
||||||
$message = mt('setup', 'Authentication configuration has been successfully written to: %s');
|
$report[] = sprintf(
|
||||||
$report .= '<p>' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>';
|
mt('setup', 'Authentication configuration has been successfully written to: %s'),
|
||||||
|
Config::resolvePath('authentication.ini')
|
||||||
|
);
|
||||||
} elseif ($this->authIniError !== null) {
|
} elseif ($this->authIniError !== null) {
|
||||||
$message = mt('setup', 'Authentication configuration could not be written to: %s; An error occured:');
|
$report[] = sprintf(
|
||||||
$report .= '<p class="error">' . sprintf($message, Config::resolvePath('authentication.ini')) . '</p>'
|
mt('setup', 'Authentication configuration could not be written to: %s. An error occured:'),
|
||||||
. '<p>' . $this->authIniError->getMessage() . '</p>';
|
Config::resolvePath('authentication.ini')
|
||||||
|
);
|
||||||
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->authIniError->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->dbError === false) {
|
if ($this->dbError === false) {
|
||||||
$message = mt('setup', 'Account "%s" has been successfully created.');
|
$report[] = sprintf(
|
||||||
$report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
|
mt('setup', 'Account "%s" has been successfully created.'),
|
||||||
|
$this->data['adminAccountData']['username']
|
||||||
|
);
|
||||||
} elseif ($this->dbError !== null) {
|
} elseif ($this->dbError !== null) {
|
||||||
$message = mt('setup', 'Unable to create account "%s". An error occured:');
|
$report[] = sprintf(
|
||||||
$report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'
|
mt('setup', 'Unable to create account "%s". An error occured:'),
|
||||||
. '<p>' . $this->dbError->getMessage() . '</p>';
|
$this->data['adminAccountData']['username']
|
||||||
|
);
|
||||||
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->dbError->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->permIniError === false) {
|
if ($this->permIniError === false) {
|
||||||
$message = mt('setup', 'Account "%s" has been successfully defined as initial administrator.');
|
$report[] = sprintf(
|
||||||
$report .= '<p>' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>';
|
mt('setup', 'Account "%s" has been successfully defined as initial administrator.'),
|
||||||
|
$this->data['adminAccountData']['username']
|
||||||
|
);
|
||||||
} elseif ($this->permIniError !== null) {
|
} elseif ($this->permIniError !== null) {
|
||||||
$message = mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:');
|
$report[] = sprintf(
|
||||||
$report .= '<p class="error">' . sprintf($message, $this->data['adminAccountData']['username']) . '</p>'
|
mt('setup', 'Unable to define account "%s" as initial administrator. An error occured:'),
|
||||||
. '<p>' . $this->permIniError->getMessage() . '</p>';
|
$this->data['adminAccountData']['username']
|
||||||
|
);
|
||||||
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->permIniError->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $report;
|
return $report;
|
||||||
|
@ -247,12 +247,14 @@ class DatabaseStep extends Step
|
|||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
if ($this->error === false) {
|
if ($this->error === false) {
|
||||||
return '<p>' . join('</p><p>', $this->messages) . '</p>'
|
$report = $this->messages;
|
||||||
. '<p>' . mt('setup', 'The database has been fully set up!') . '</p>';
|
$report[] = mt('setup', 'The database has been fully set up!');
|
||||||
|
return $report;
|
||||||
} elseif ($this->error !== null) {
|
} elseif ($this->error !== null) {
|
||||||
$message = mt('setup', 'Failed to fully setup the database. An error occured:');
|
$report = $this->messages;
|
||||||
return '<p>' . join('</p><p>', $this->messages) . '</p>'
|
$report[] = mt('setup', 'Failed to fully setup the database. An error occured:');
|
||||||
. '<p class="error">' . $message . '</p><p>' . $this->error->getMessage() . '</p>';
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage());
|
||||||
|
return $report;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,12 +102,18 @@ class GeneralConfigStep extends Step
|
|||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
if ($this->error === false) {
|
if ($this->error === false) {
|
||||||
$message = mt('setup', 'General configuration has been successfully written to: %s');
|
return array(sprintf(
|
||||||
return '<p>' . sprintf($message, Config::resolvePath('config.ini')) . '</p>';
|
mt('setup', 'General configuration has been successfully written to: %s'),
|
||||||
|
Config::resolvePath('config.ini')
|
||||||
|
));
|
||||||
} elseif ($this->error !== null) {
|
} elseif ($this->error !== null) {
|
||||||
$message = mt('setup', 'General configuration could not be written to: %s; An error occured:');
|
return array(
|
||||||
return '<p class="error">' . sprintf($message, Config::resolvePath('config.ini')) . '</p>'
|
sprintf(
|
||||||
. '<p>' . $this->error->getMessage() . '</p>';
|
mt('setup', 'General configuration could not be written to: %s. An error occured:'),
|
||||||
|
Config::resolvePath('config.ini')
|
||||||
|
),
|
||||||
|
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,18 @@ class ResourceStep extends Step
|
|||||||
public function getReport()
|
public function getReport()
|
||||||
{
|
{
|
||||||
if ($this->error === false) {
|
if ($this->error === false) {
|
||||||
$message = mt('setup', 'Resource configuration has been successfully written to: %s');
|
return array(sprintf(
|
||||||
return '<p>' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>';
|
mt('setup', 'Resource configuration has been successfully written to: %s'),
|
||||||
|
Config::resolvePath('resources.ini')
|
||||||
|
));
|
||||||
} elseif ($this->error !== null) {
|
} elseif ($this->error !== null) {
|
||||||
$message = mt('setup', 'Resource configuration could not be written to: %s; An error occured:');
|
return array(
|
||||||
return '<p class="error">' . sprintf($message, Config::resolvePath('resources.ini')) . '</p>'
|
sprintf(
|
||||||
. '<p>' . $this->error->getMessage() . '</p>';
|
mt('setup', 'Resource configuration could not be written to: %s. An error occured:'),
|
||||||
|
Config::resolvePath('resources.ini')
|
||||||
|
),
|
||||||
|
sprintf(mt('setup', 'ERROR: %s'), $this->error->getMessage())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,13 +53,13 @@ class EnableModuleStep extends Step
|
|||||||
$okMessage = mt('setup', 'Module "%s" has been successfully enabled.');
|
$okMessage = mt('setup', 'Module "%s" has been successfully enabled.');
|
||||||
$failMessage = mt('setup', 'Module "%s" could not be enabled. An error occured:');
|
$failMessage = mt('setup', 'Module "%s" could not be enabled. An error occured:');
|
||||||
|
|
||||||
$report = '';
|
$report = array();
|
||||||
foreach ($this->moduleNames as $moduleName) {
|
foreach ($this->moduleNames as $moduleName) {
|
||||||
if (isset($this->errors[$moduleName])) {
|
if (isset($this->errors[$moduleName])) {
|
||||||
$report .= '<p class="error">' . sprintf($failMessage, $moduleName) . '</p>'
|
$report[] = sprintf($failMessage, $moduleName);
|
||||||
. '<p>' . $this->errors[$moduleName]->getMessage() . '</p>';
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->errors[$moduleName]->getMessage());
|
||||||
} else {
|
} else {
|
||||||
$report .= '<p>' . sprintf($okMessage, $moduleName) . '</p>';
|
$report[] = sprintf($okMessage, $moduleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ class MakeDirStep extends Step
|
|||||||
$okMessage = mt('setup', 'Directory "%s" in "%s" has been successfully created.');
|
$okMessage = mt('setup', 'Directory "%s" in "%s" has been successfully created.');
|
||||||
$failMessage = mt('setup', 'Unable to create directory "%s" in "%s". An error occured:');
|
$failMessage = mt('setup', 'Unable to create directory "%s" in "%s". An error occured:');
|
||||||
|
|
||||||
$report = '';
|
$report = array();
|
||||||
foreach ($this->paths as $path) {
|
foreach ($this->paths as $path) {
|
||||||
if (array_key_exists($path, $this->errors)) {
|
if (array_key_exists($path, $this->errors)) {
|
||||||
if (is_array($this->errors[$path])) {
|
if (is_array($this->errors[$path])) {
|
||||||
$report .= '<p class="error">' . sprintf($failMessage, basename($path), dirname($path)) . '</p>'
|
$report[] = sprintf($failMessage, basename($path), dirname($path));
|
||||||
. '<p>' . $this->errors[$path]['message'] . '</p>';
|
$report[] = sprintf(mt('setup', 'ERROR: %s'), $this->errors[$path]['message']);
|
||||||
} else {
|
} else {
|
||||||
$report .= '<p>' . sprintf($okMessage, basename($path), dirname($path)) . '</p>';
|
$report[] = sprintf($okMessage, basename($path), dirname($path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,48 +300,28 @@ form#setup_requirements {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.conspicuous-state-notification {
|
|
||||||
width: 66%;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 0.5em;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
#setup-finish {
|
#setup-finish {
|
||||||
div.report {
|
h2 {
|
||||||
padding: 1em;
|
padding: 0.5em;
|
||||||
border: 1px solid lightgrey;
|
border-bottom: 0;
|
||||||
border-radius: 0em;
|
font-variant: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
|
||||||
div.line-separator {
|
&.success {
|
||||||
width: 50%;
|
background-color: @colorOk;
|
||||||
height: 1px;
|
|
||||||
margin: 0 auto;
|
|
||||||
background-color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
&.failure {
|
||||||
margin: 1em;
|
background-color: @colorCritical;
|
||||||
color: #444;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
&.error {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.failure {
|
|
||||||
.conspicuous-state-notification;
|
|
||||||
background-color: @colorCritical;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.success {
|
|
||||||
.conspicuous-state-notification;
|
|
||||||
background-color: @colorOk;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea.report {
|
||||||
|
width: 66%;
|
||||||
|
height: 25em;
|
||||||
|
}
|
||||||
|
|
||||||
div.buttons {
|
div.buttons {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user