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\Dashboard;
use Icinga\Web\Dashboard\DashboardHome; use Icinga\Web\Dashboard\DashboardHome;
use ipl\Web\Compat\CompatForm; use ipl\Html\Form;
use ipl\Web\Url; use ipl\Web\Url;
class WelcomeForm extends CompatForm class WelcomeForm extends Form
{ {
/** @var Dashboard */ /** @var Dashboard */
protected $dashboard; protected $dashboard;
protected $defaultAttributes = ['class' => 'icinga-controls'];
public function __construct(Dashboard $dashboard) public function __construct(Dashboard $dashboard)
{ {
$this->dashboard = $dashboard; $this->dashboard = $dashboard;
@ -27,9 +29,6 @@ class WelcomeForm extends CompatForm
protected function assemble() 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', [ $this->addElement('submit', 'btn_customize_dashlets', [
'label' => t('Add Dashlets Now'), 'label' => t('Add Dashlets Now'),
'href' => Url::fromPath(Dashboard::BASE_ROUTE . '/setup-dashboard'), 'href' => Url::fromPath(Dashboard::BASE_ROUTE . '/setup-dashboard'),
@ -37,7 +36,7 @@ class WelcomeForm extends CompatForm
'data-no-icinga-ajax' => true '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() protected function onSuccess()

View File

@ -232,11 +232,11 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
if (! $activeHome || (! $activeHome->hasEntries() && $activeHome->getName() === DashboardHome::DEFAULT_HOME)) { if (! $activeHome || (! $activeHome->hasEntries() && $activeHome->getName() === DashboardHome::DEFAULT_HOME)) {
$this->setAttribute('class', 'dashboard-introduction'); $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( $this->addHtml(HtmlElement::create(
'p', 'p',
null, 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( $message = t(
@ -247,7 +247,7 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
$message = t( $message = t(
'Now you can either customize which dashlets to display, or use the system default dashlets.' '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)); $this->addHtml(HtmlElement::create('p', null, $message));

View File

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