From b5711f403161c202c7269384fdfcd7cfe67172b0 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 7 Sep 2015 09:05:50 +0200 Subject: [PATCH] Dashboard: Load panes by utilizing the new Navigation This is only a quick fix to avoid adjusting the complete dashboard implementation. refs #5600 --- library/Icinga/Web/Widget/Dashboard.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/library/Icinga/Web/Widget/Dashboard.php b/library/Icinga/Web/Widget/Dashboard.php index 758ec8267..60ac28e1d 100644 --- a/library/Icinga/Web/Widget/Dashboard.php +++ b/library/Icinga/Web/Widget/Dashboard.php @@ -9,6 +9,8 @@ use Icinga\Exception\ConfigurationError; use Icinga\Exception\NotReadableError; use Icinga\Exception\ProgrammingError; use Icinga\User; +use Icinga\Web\Navigation\DashboardPane; +use Icinga\Web\Navigation\Navigation; use Icinga\Web\Widget\Dashboard\Pane; use Icinga\Web\Widget\Dashboard\Dashlet as DashboardDashlet; use Icinga\Web\Url; @@ -68,16 +70,21 @@ class Dashboard extends AbstractWidget */ public function load() { - $manager = Icinga::app()->getModuleManager(); - foreach ($manager->getLoadedModules() as $module) { - if ($this->getUser()->can($manager::MODULE_PERMISSION_NS . $module->getName())) { - $this->mergePanes($module->getPaneItems()); + $navigation = new Navigation(); + $navigation->load('dashboard-pane'); + + $panes = array(); + foreach ($navigation as $dashboardPane) { + /** @var DashboardPane $dashboardPane */ + $pane = new Pane($dashboardPane->getName()); + foreach ($dashboardPane->getDashlets() as $title => $url) { + $pane->addDashlet($title, $url); } + $panes[] = $pane; } - $this->loadUserDashboards(); - + $this->mergePanes($panes); return $this; }