Cleanup dashboard welcome page

* The `h1` is the tab or page title, the welcome message is at most a `h2?`
* It's not necessary to mention that the welcome page is only shown as
  long as there are no dashboards/dashlets, if the very next statement
  explains this already
* The icinga form layout is not relevant here, so there's no need to
  work-around/counteract it
* The text opacity just reduced the contrast needlessly
This commit is contained in:
Johannes Meyer 2022-04-29 15:46:55 +02:00 committed by Yonas Habteab
parent fd31f2d960
commit 8bd82ff97c
3 changed files with 15 additions and 23 deletions

View File

@ -6,14 +6,16 @@ namespace Icinga\Forms\Dashboard;
use Icinga\Web\Dashboard\Dashboard;
use Icinga\Web\Dashboard\DashboardHome;
use ipl\Web\Compat\CompatForm;
use ipl\Html\Form;
use ipl\Web\Url;
class WelcomeForm extends CompatForm
class WelcomeForm extends Form
{
/** @var Dashboard */
protected $dashboard;
protected $defaultAttributes = ['class' => 'icinga-controls'];
public function __construct(Dashboard $dashboard)
{
$this->dashboard = $dashboard;
@ -27,9 +29,6 @@ class WelcomeForm extends CompatForm
protected function assemble()
{
$element = $this->createElement('submit', 'btn_use_defaults', ['label' => t('Use System Defaults')]);
$this->registerElement($element)->decorate($element);
$this->addElement('submit', 'btn_customize_dashlets', [
'label' => t('Add Dashlets Now'),
'href' => Url::fromPath(Dashboard::BASE_ROUTE . '/setup-dashboard'),
@ -37,7 +36,7 @@ class WelcomeForm extends CompatForm
'data-no-icinga-ajax' => true
]);
$this->getElement('btn_customize_dashlets')->setWrapper($element->getWrapper());
$this->addElement('submit', 'btn_use_defaults', ['label' => t('Use System Defaults')]);
}
protected function onSuccess()

View File

@ -232,11 +232,11 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
if (! $activeHome || (! $activeHome->hasEntries() && $activeHome->getName() === DashboardHome::DEFAULT_HOME)) {
$this->setAttribute('class', 'dashboard-introduction');
$this->addHtml(HtmlElement::create('h1', null, t('Welcome to Icinga Web 2!')));
$this->addHtml(HtmlElement::create('h2', null, t('Welcome to Icinga Web 2!')));
$this->addHtml(HtmlElement::create(
'p',
null,
t('You will see this screen every time you log in and haven\'t created any dashboards yet.')
t('You will see this screen every time you log in.')
));
$message = t(
@ -247,7 +247,7 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
$message = t(
'Now you can either customize which dashlets to display, or use the system default dashlets.'
. ' You will be always able to edit them afterwards.'
. ' You will always be able to edit them afterwards.'
);
$this->addHtml(HtmlElement::create('p', null, $message));

View File

@ -1,3 +1,5 @@
// Welcome view and introduction
.welcome-view {
position: relative;
}
@ -7,29 +9,20 @@
right: 50%;
position: absolute;
transform: translate(50%, -50%);
color: @text-color;
h1, p {
color: inherit;
h2, p {
text-align: center;
}
h1 {
border-bottom: none;
}
p {
opacity: .9;
width: 58em;
font-size: 1.1em;
line-height: 1.5em;
}
// Welcome page form controls
form.icinga-form .form-controls {
margin-left: 13em;
margin-top: 1.8em;
justify-content: center;
form {
display: flex;
padding: 0 20em;
justify-content: space-around;
}
}