Skip to content

Commit

Permalink
Refactor DependencyNodeSummary name to RedundancyGroupSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Oct 16, 2024
1 parent 0b3544f commit 1987ed7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,30 @@
use ipl\Sql\Select;

/**
* Redundancy group's parent nodes summary
* Redundancy group's summary (The nodes could only host and service)
*
* @property int $nodes_total
* @property int $nodes_ok
* @property int $nodes_problem_handled
* @property int $nodes_problem_unhandled
* @property int $nodes_pending
* @property int $nodes_total
* @property int $nodes_ok
* @property int $nodes_unknown_handled
* @property int $nodes_unknown_unhandled
* @property int $nodes_warning_handled
* @property int $nodes_warning_unhandled
*/
class DependencyNodeSummary extends RedundancyGroup
class RedundancyGroupSummary extends RedundancyGroup
{
public function getSummaryColumns(): array
{
return [
'nodes_ok' => new Expression(
'SUM(CASE WHEN (redundancy_group_from_to_service.id IS NOT NULL'
. ' AND redundancy_group_from_to_service_state.soft_state = 0)'
. ' OR'
. ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL'
. ' AND redundancy_group_from_to_host_state.soft_state = 0) THEN 1 ELSE 0 END)'
),
'nodes_problem_handled' => new Expression(
'SUM(CASE WHEN'
. ' (redundancy_group_from_to_service.id IS NOT NULL'
Expand Down Expand Up @@ -65,13 +72,6 @@ public function getSummaryColumns(): array
. ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL)'
. ' THEN 1 ELSE 0 END)'
),
'nodes_ok' => new Expression(
'SUM(CASE WHEN (redundancy_group_from_to_service.id IS NOT NULL'
. ' AND redundancy_group_from_to_service_state.soft_state = 0)'
. ' OR'
. ' (redundancy_group_from_to_host.id IS NOT NULL AND redundancy_group_from_to_service.id IS NULL'
. ' AND redundancy_group_from_to_host_state.soft_state = 0) THEN 1 ELSE 0 END)'
),
'nodes_unknown_handled' => new Expression(
'SUM(CASE WHEN redundancy_group_from_to_service_state.soft_state = 3'
. ' AND (redundancy_group_from_to_service_state.is_handled = \'y\''
Expand Down
4 changes: 2 additions & 2 deletions library/Icingadb/Widget/DependencyNodeStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Icinga\Module\Icingadb\Widget;

use Icinga\Chart\Donut;
use Icinga\Module\Icingadb\Model\DependencyNodeSummary;
use Icinga\Module\Icingadb\Model\RedundancyGroupSummary;
use Icinga\Module\Icingadb\Widget\Detail\ObjectStatistics;
use ipl\Html\Text;
use ipl\Html\ValidHtml;
Expand All @@ -16,7 +16,7 @@
*/
class DependencyNodeStatistics extends ObjectStatistics
{
/** @var DependencyNodeSummary Dependency node summary */
/** @var RedundancyGroupSummary Dependency node summary */
protected $summary;

public function __construct($summary)
Expand Down
6 changes: 3 additions & 3 deletions library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Icinga\Module\Icingadb\Common\Database;
use Icinga\Module\Icingadb\Common\ListItemCommonLayout;
use Icinga\Module\Icingadb\Model\RedundancyGroup;
use Icinga\Module\Icingadb\Model\DependencyNodeSummary;
use Icinga\Module\Icingadb\Model\RedundancyGroupSummary;
use Icinga\Module\Icingadb\Model\RedundancyGroupState;
use Icinga\Module\Icingadb\Util\PluginOutput;
use Icinga\Module\Icingadb\Widget\PluginOutputContainer;
Expand All @@ -35,7 +35,7 @@ class RedundancyGroupListItem extends StateListItem

protected $defaultAttributes = ['class' => ['list-item', 'redundancy-group-list-item']];

/** @var DependencyNodeSummary Objects state summary */
/** @var RedundancyGroupSummary Objects state summary */
protected $summary;

/** @var RedundancyGroupState */
Expand All @@ -48,7 +48,7 @@ protected function init(): void
{
parent::init();

$this->summary = DependencyNodeSummary::on($this->getDb())
$this->summary = RedundancyGroupSummary::on($this->getDb())
->filter(Filter::equal('id', $this->item->id))
->first();

Expand Down

0 comments on commit 1987ed7

Please sign in to comment.