DashboardsController: Add the welcomeFrom instance directly to the dashboard

Since we no longer use an additional wrapper for the dashboards,
the welcome form can be added directly to the dashboard instance
This commit is contained in:
Yonas Habteab 2022-05-30 10:26:29 +02:00
parent 9f7eba4cf8
commit 4a32ee7b60
2 changed files with 6 additions and 18 deletions

View File

@ -24,6 +24,11 @@ use ipl\Web\Url;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
/**
* Handles all kind of dashboard request actions
*
* See {@see Dashboard} for more information about dashboards
*/
class DashboardsController extends CompatController
{
/** @var Dashboard */
@ -55,7 +60,7 @@ class DashboardsController extends CompatController
})->handleRequest($this->getServerRequest());
$this->content->getAttributes()->add('class', 'welcome-view');
$this->dashboard->setWelcomeForm($welcomeForm);
$this->dashboard->addHtml($welcomeForm);
} else {
$pane = $this->getParam('pane');
if (! $pane) {

View File

@ -10,7 +10,6 @@ use Icinga\Web\Dashboard\Common\DashboardEntries;
use Icinga\Web\Dashboard\Common\DashboardEntry;
use Icinga\Web\Dashboard\Common\DashboardManager;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Form;
use ipl\Html\HtmlElement;
use ipl\Web\Url;
use ipl\Web\Widget\Tabs;
@ -84,13 +83,6 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
*/
private $tabParam = 'pane';
/**
* A welcome form rendered when there is no dashboard panes
*
* @var Form
*/
private $welcomeForm;
/**
* Set the given tab name as active
*
@ -219,13 +211,6 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
throw new ConfigurationError('Could not determine active pane');
}
public function setWelcomeForm(Form $form)
{
$this->welcomeForm = $form;
return $this;
}
protected function assemble()
{
$activeHome = $this->getActiveHome();
@ -250,8 +235,6 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
. ' You will always be able to edit them afterwards.'
);
$this->addHtml(HtmlElement::create('p', null, $message));
$this->addHtml($this->welcomeForm);
} elseif (! $activeHome->hasEntries()) {
$this->addHtml(HtmlElement::create('h1', null, t('No dashboard added to this dashboard home.')));
} else {