ConfigHealthItemRenderer: ask branch for count

This commit is contained in:
Thomas Gelf 2021-08-23 08:58:02 +02:00
parent 085cec0eb7
commit 6ff5b0c8d7

View File

@ -9,7 +9,7 @@ use Icinga\Application\Web;
use Icinga\Authentication\Auth; use Icinga\Authentication\Auth;
use Icinga\Module\Director\Db; use Icinga\Module\Director\Db;
use Icinga\Module\Director\Db\Branch\Branch; use Icinga\Module\Director\Db\Branch\Branch;
use Icinga\Module\Director\Db\Branch\BranchActivityStore; use Icinga\Module\Director\Db\Branch\BranchStore;
use Icinga\Module\Director\Db\Migrations; use Icinga\Module\Director\Db\Migrations;
use Icinga\Module\Director\KickstartHelper; use Icinga\Module\Director\KickstartHelper;
use Icinga\Module\Director\Web\Controller\Extension\DirectorDb; use Icinga\Module\Director\Web\Controller\Extension\DirectorDb;
@ -104,10 +104,9 @@ class ConfigHealthItemRenderer extends BadgeNavigationItemRenderer
return; return;
} }
$branch = Branch::detect(); $branch = Branch::detect(new BranchStore($this->db()));
if ($branch->isBranch()) { if ($branch->isBranch()) {
$store = new BranchActivityStore($this->db()); $count = $branch->getActivityCount();
$count = $store->count($branch->getUuid());
if ($count > 0) { if ($count > 0) {
$this->directorState = self::STATE_PENDING; $this->directorState = self::STATE_PENDING;
$this->count = $count; $this->count = $count;
@ -131,8 +130,6 @@ class ConfigHealthItemRenderer extends BadgeNavigationItemRenderer
), ),
$pendingChanges $pendingChanges
); );
return;
} }
} }