Dashboard: Load panes by utilizing the new Navigation

This is only a quick fix to avoid adjusting the complete dashboard
implementation.

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-07 09:05:50 +02:00
parent a3539b0817
commit b5711f4031
1 changed files with 13 additions and 6 deletions

View File

@ -9,6 +9,8 @@ use Icinga\Exception\ConfigurationError;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\User; use Icinga\User;
use Icinga\Web\Navigation\DashboardPane;
use Icinga\Web\Navigation\Navigation;
use Icinga\Web\Widget\Dashboard\Pane; use Icinga\Web\Widget\Dashboard\Pane;
use Icinga\Web\Widget\Dashboard\Dashlet as DashboardDashlet; use Icinga\Web\Widget\Dashboard\Dashlet as DashboardDashlet;
use Icinga\Web\Url; use Icinga\Web\Url;
@ -68,16 +70,21 @@ class Dashboard extends AbstractWidget
*/ */
public function load() public function load()
{ {
$manager = Icinga::app()->getModuleManager(); $navigation = new Navigation();
foreach ($manager->getLoadedModules() as $module) { $navigation->load('dashboard-pane');
if ($this->getUser()->can($manager::MODULE_PERMISSION_NS . $module->getName())) {
$this->mergePanes($module->getPaneItems()); $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; return $this;
} }