From 49267d6fa3d79eaa198725d8db5ccf52aff9f93d Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 8 Apr 2022 10:35:53 +0200 Subject: [PATCH] Use sendMultipartUpdate() for drag&drop actions & adjust some css styles --- .../controllers/DashboardsController.php | 20 +++++-------------- library/Icinga/Web/Dashboard/Dashboard.php | 2 +- public/css/icinga/dashboards.less | 6 +----- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/application/controllers/DashboardsController.php b/application/controllers/DashboardsController.php index b181366b4..f40597af1 100644 --- a/application/controllers/DashboardsController.php +++ b/application/controllers/DashboardsController.php @@ -20,7 +20,6 @@ use Icinga\Web\Dashboard\Settings; use Icinga\Web\Dashboard\Setup\SetupNewDashboard; use Icinga\Web\Notification; use Icinga\Web\Widget\Tabextension\DashboardSettings; -use ipl\Html\HtmlElement; use ipl\Web\Compat\CompatController; use ipl\Web\Url; use ipl\Web\Widget\ActionLink; @@ -58,6 +57,7 @@ class DashboardsController extends CompatController $this->redirectNow($welcomeForm->getRedirectUrl()); })->handleRequest(ServerRequest::fromGlobals()); + $this->content->getAttributes()->add('class', 'welcome-view'); $this->dashboard->setWelcomeForm($welcomeForm); } else { $pane = $this->getParam('pane'); @@ -131,8 +131,6 @@ class DashboardsController extends CompatController $homeForm = (new HomePaneForm($this->dashboard)) ->on(HomePaneForm::ON_SUCCESS, function () { - $this->getResponse()->setAutoRefreshInterval(1); - $this->redirectNow(Url::fromPath(Dashboard::BASE_ROUTE . '/settings')); }) ->handleRequest(ServerRequest::fromGlobals()); @@ -288,8 +286,6 @@ class DashboardsController extends CompatController $dashboards = Json::decode($dashboards['dashboardData'], true); $originals = $dashboards['originals']; - $widgetType = $dashboards['Type']; - unset($dashboards['Type']); unset($dashboards['originals']); $orgHome = null; @@ -305,9 +301,6 @@ class DashboardsController extends CompatController } } - $reroutePath = $dashboards['redirectPath']; - unset($dashboards['redirectPath']); - foreach ($dashboards as $home => $value) { if (! $this->dashboard->hasEntry($home)) { Notification::error(sprintf(t('Dashboard home "%s" not found'), $home)); @@ -384,13 +377,9 @@ class DashboardsController extends CompatController } } - if ($widgetType !== 'Dashlets' || ($orgHome && $orgPane)) { - $this->redirectNow($reroutePath); - } - - // Just create a dummy content and ignore it, as we don't have any view scripts and aren't redirecting - $this->getResponse()->setHeader('X-Icinga-Container', 'ignore'); - $this->addContent(new HtmlElement('p')); + $this->createTabs(); + $this->dashboard->activate('dashboard_settings'); + $this->sendMultipartUpdate(); } /** @@ -442,6 +431,7 @@ class DashboardsController extends CompatController ] )); + $this->content->getAttributes()->add('class', 'dashboard-manager'); $this->addContent(new Settings($this->dashboard)); } diff --git a/library/Icinga/Web/Dashboard/Dashboard.php b/library/Icinga/Web/Dashboard/Dashboard.php index b7f78fc9d..94c8057da 100644 --- a/library/Icinga/Web/Dashboard/Dashboard.php +++ b/library/Icinga/Web/Dashboard/Dashboard.php @@ -235,7 +235,7 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry { $activeHome = $this->getActiveHome(); if (! $activeHome || (! $activeHome->hasEntries() && $activeHome->getName() === DashboardHome::DEFAULT_HOME)) { - $this->setAttribute('class', 'dashboard-introduction welcome-view'); + $this->setAttribute('class', 'dashboard-introduction'); $this->addHtml(HtmlElement::create('h1', null, t('Welcome to Icinga Web 2!'))); $this->addHtml(HtmlElement::create( diff --git a/public/css/icinga/dashboards.less b/public/css/icinga/dashboards.less index 6c2a1e2bb..8a06ed9f5 100644 --- a/public/css/icinga/dashboards.less +++ b/public/css/icinga/dashboards.less @@ -137,7 +137,7 @@ } // Dashboard manager -:not(.dashboard) > .container > .content { +:not(.dashboard) > .container > .content.dashboard-manager { padding-top: 0; } @@ -332,10 +332,6 @@ form.icinga-form .control-group.form-controls .remove-button { width: calc(85% + 1.4em); } -.drag-active * { - pointer-events: none; -} - .draggable-element { opacity: .4; }