From 8bd82ff97c67d1214dcd6d641351bfe498140b12 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 29 Apr 2022 15:46:55 +0200 Subject: [PATCH] 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 --- application/forms/Dashboard/WelcomeForm.php | 11 +++++------ library/Icinga/Web/Dashboard/Dashboard.php | 6 +++--- public/css/icinga/dashboards.less | 21 +++++++-------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/application/forms/Dashboard/WelcomeForm.php b/application/forms/Dashboard/WelcomeForm.php index 4951d900d..e921187b2 100644 --- a/application/forms/Dashboard/WelcomeForm.php +++ b/application/forms/Dashboard/WelcomeForm.php @@ -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() diff --git a/library/Icinga/Web/Dashboard/Dashboard.php b/library/Icinga/Web/Dashboard/Dashboard.php index 6e87ceec4..cd9038478 100644 --- a/library/Icinga/Web/Dashboard/Dashboard.php +++ b/library/Icinga/Web/Dashboard/Dashboard.php @@ -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)); diff --git a/public/css/icinga/dashboards.less b/public/css/icinga/dashboards.less index 404993028..a024f681e 100644 --- a/public/css/icinga/dashboards.less +++ b/public/css/icinga/dashboards.less @@ -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; } }