From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- library/Icinga/Web/Menu.php | 152 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 library/Icinga/Web/Menu.php (limited to 'library/Icinga/Web/Menu.php') diff --git a/library/Icinga/Web/Menu.php b/library/Icinga/Web/Menu.php new file mode 100644 index 0000000..dc1cdc8 --- /dev/null +++ b/library/Icinga/Web/Menu.php @@ -0,0 +1,152 @@ +init(); + $this->load('menu-item'); + } + + /** + * Setup the main menu + */ + public function init() + { + $this->addItem('dashboard', [ + 'label' => t('Dashboard'), + 'url' => 'dashboard', + 'icon' => 'dashboard', + 'priority' => 10 + ]); + $this->addItem('system', [ + 'cssClass' => 'system-nav-item', + 'label' => t('System'), + 'icon' => 'services', + 'priority' => 700, + 'renderer' => [ + 'SummaryNavigationItemRenderer', + 'state' => 'critical' + ], + 'children' => [ + 'about' => [ + 'icon' => 'info', + 'description' => t('Open about page'), + 'label' => t('About'), + 'url' => 'about', + 'priority' => 700 + ], + 'health' => [ + 'icon' => 'eye', + 'description' => t('Open health overview'), + 'label' => t('Health'), + 'url' => 'health', + 'priority' => 710, + 'renderer' => 'HealthNavigationRenderer' + ], + 'announcements' => [ + 'icon' => 'megaphone', + 'description' => t('List announcements'), + 'label' => t('Announcements'), + 'url' => 'announcements', + 'priority' => 720 + ], + 'sessions' => [ + 'icon' => 'host', + 'description' => t('List of users who stay logged in'), + 'label' => t('User Sessions'), + 'permission' => 'application/sessions', + 'url' => 'manage-user-devices', + 'priority' => 730 + ] + ] + ]); + $this->addItem('configuration', [ + 'cssClass' => 'configuration-nav-item', + 'label' => t('Configuration'), + 'icon' => 'wrench', + 'permission' => 'config/*', + 'priority' => 800, + 'children' => [ + 'application' => [ + 'icon' => 'wrench', + 'description' => t('Open application configuration'), + 'label' => t('Application'), + 'url' => 'config', + 'priority' => 810 + ], + 'authentication' => [ + 'icon' => 'users', + 'description' => t('Open access control configuration'), + 'label' => t('Access Control'), + 'permission' => 'config/access-control/*', + 'priority' => 830, + 'url' => 'role' + ], + 'navigation' => [ + 'icon' => 'sitemap', + 'description' => t('Open shared navigation configuration'), + 'label' => t('Shared Navigation'), + 'url' => 'navigation/shared', + 'permission' => 'config/navigation', + 'priority' => 840, + ], + 'modules' => [ + 'icon' => 'cubes', + 'description' => t('Open module configuration'), + 'label' => t('Modules'), + 'url' => 'config/modules', + 'permission' => 'config/modules', + 'priority' => 890 + ] + ] + ]); + $this->addItem('user', [ + 'cssClass' => 'user-nav-item', + 'label' => Auth::getInstance()->getUser()->getUsername(), + 'icon' => 'user', + 'priority' => 900, + 'children' => [ + 'account' => [ + 'icon' => 'sliders', + 'description' => t('Open your account preferences'), + 'label' => t('My Account'), + 'priority' => 100, + 'url' => 'account' + ], + 'logout' => [ + 'icon' => 'off', + 'description' => t('Log out'), + 'label' => t('Logout'), + 'priority' => 200, + 'attributes' => ['target' => '_self'], + 'url' => 'authentication/logout' + ] + ] + ]); + + if (Logger::writesToFile()) { + $this->getItem('system')->addChild($this->createItem('application_log', [ + 'icon' => 'doc-text', + 'description' => t('Open Application Log'), + 'label' => t('Application Log'), + 'url' => 'list/applicationlog', + 'permission' => 'application/log', + 'priority' => 900 + ])); + } + } +} -- cgit v1.2.3