From d4dc282ac8b12b21110944145c6f962f873f8725 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 9 Sep 2019 14:42:16 +0200 Subject: [PATCH] DashboardContainer: Allow to define a priority for dashlets refs #3931 --- library/Icinga/Application/Modules/DashboardContainer.php | 8 ++++++-- library/Icinga/Application/Modules/Module.php | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Application/Modules/DashboardContainer.php b/library/Icinga/Application/Modules/DashboardContainer.php index 527c1351c..f3c8bc671 100644 --- a/library/Icinga/Application/Modules/DashboardContainer.php +++ b/library/Icinga/Application/Modules/DashboardContainer.php @@ -43,12 +43,16 @@ class DashboardContainer extends NavigationItemContainer * * @param string $name * @param string $url + * @param int $priority * * @return $this */ - public function add($name, $url) + public function add($name, $url, $priority = null) { - $this->dashlets[$name] = $url; + $this->dashlets[$name] = [ + 'url' => $url, + 'priority' => $priority + ]; return $this; } } diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 735738089..e8350e156 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -315,10 +315,11 @@ class Module foreach ($panes as $pane) { /** @var DashboardContainer $pane */ $dashlets = []; - foreach ($pane->getDashlets() as $dashletName => $dashletUrl) { + foreach ($pane->getDashlets() as $dashletName => $dashletConfig) { $dashlets[$dashletName] = [ - 'label' => $this->translate($dashletName), - 'url' => $dashletUrl + 'label' => $this->translate($dashletName), + 'url' => $dashletConfig['url'], + 'priority' => $dashletConfig['priority'] ]; }