mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-25 10:57:40 +02:00
DashboardManager: Ensure to insert dashboard homes with correct priority order
This commit is contained in:
parent
a527946306
commit
2405c7a1fc
@ -150,16 +150,17 @@ trait DashboardManager
|
||||
$conn = DBUtils::getConn();
|
||||
$homes = is_array($entryOrEntries) ? $entryOrEntries : [$entryOrEntries];
|
||||
|
||||
// Highest priority is 0, so count($entries) are always lowest prio + 1
|
||||
$priority = count($this->getEntries());
|
||||
|
||||
/** @var DashboardHome $home */
|
||||
foreach ($homes as $home) {
|
||||
if (! $this->hasEntry($home->getName())) {
|
||||
// Highest priority is 0, so count($entries) are always lowest prio + 1
|
||||
$priority = $home->getName() === DashboardHome::DEFAULT_HOME ? 0 : count($this->getEntries());
|
||||
$conn->insert(DashboardHome::TABLE, [
|
||||
'user_id' => self::getUser()->getAdditional('id'),
|
||||
'name' => $home->getName(),
|
||||
'label' => $home->getTitle(),
|
||||
'priority' => $priority,
|
||||
'priority' => $home->getName() === DashboardHome::DEFAULT_HOME ? 0 : $priority++,
|
||||
'type' => $home->getType() !== Dashboard::SYSTEM ? $home->getType() : Dashboard::PRIVATE_DS
|
||||
]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user