mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-25 18:59:04 +02:00
Replace count(getEntries())
with countEntries()
This commit is contained in:
parent
d0b3437995
commit
c56cbf25d6
@ -505,7 +505,7 @@ class DashboardsController extends CompatController
|
||||
|
||||
$activeHome = $this->dashboard->getActiveHome();
|
||||
// We can't grant access the user to the dashboard manager if there aren't any dashboards to manage
|
||||
if (! $activeHome || (! $activeHome->hasEntries() && count($this->dashboard->getEntries()) === 1)) {
|
||||
if (! $activeHome || (! $activeHome->hasEntries() && $this->dashboard->countEntries() === 1)) {
|
||||
$this->redirectNow(Dashboard::BASE_ROUTE);
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ class DashboardsController extends CompatController
|
||||
&& (
|
||||
! $activeHome->isDefaultHome()
|
||||
|| $activeHome->hasEntries()
|
||||
|| count($this->dashboard->getEntries()) > 1
|
||||
|| $this->dashboard->countEntries() > 1
|
||||
)
|
||||
) {
|
||||
$params = [];
|
||||
|
@ -157,13 +157,13 @@ trait DashboardManager
|
||||
$homes = is_array($entryOrEntries) ? $entryOrEntries : [$entryOrEntries];
|
||||
|
||||
// Highest priority is 0, so count($entries) are always lowest prio + 1
|
||||
$priority = count($this->getEntries());
|
||||
$priority = $this->countEntries();
|
||||
|
||||
/** @var DashboardHome $home */
|
||||
foreach ($homes as $home) {
|
||||
if (! $this->hasEntry($home->getName())) {
|
||||
$conn->insert(DashboardHome::TABLE, [
|
||||
'user_id' => self::getUser()->getAdditional('id'),
|
||||
'user_id' => $this::getUser()->getAdditional('id'),
|
||||
'name' => $home->getName(),
|
||||
'label' => $home->getTitle(),
|
||||
'priority' => $home->isDefaultHome() ? 0 : $priority++,
|
||||
@ -184,7 +184,7 @@ trait DashboardManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and|or init the default dashboard home
|
||||
* Initialize and get the default dashboard home
|
||||
*
|
||||
* @return DashboardHome
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ class Settings extends BaseHtmlElement
|
||||
protected function assemble()
|
||||
{
|
||||
$activeHome = $this->dashboard->getActiveHome();
|
||||
if (count($this->dashboard->getEntries()) === 1 && $activeHome->isDefaultHome()) {
|
||||
if ($this->dashboard->countEntries() === 1 && $activeHome->isDefaultHome()) {
|
||||
$this->setAttribute('data-icinga-home', DashboardHome::DEFAULT_HOME);
|
||||
$this->addFrom((new DashboardHomeList($activeHome))->setHeaderDisabled());
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user