Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostgroupTableRow: Prevent filter doubles #984

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
$hostStats = new HostStatistics($this->item);

$hostStats->setBaseFilter(Filter::equal('hostgroup.name', $this->item->name));
if (isset($this->table) && $this->table->hasBaseFilter()) {
if (
isset($this->table)
&& $this->table->hasBaseFilter()
&& ! $hostStats->getBaseFilter()->sameAs($this->table->getBaseFilter())

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 38 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.3 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.
) {
$hostStats->setBaseFilter(
Filter::all($hostStats->getBaseFilter(), $this->table->getBaseFilter())
);
Expand All @@ -41,7 +45,11 @@
$serviceStats = new ServiceStatistics($this->item);

$serviceStats->setBaseFilter(Filter::equal('hostgroup.name', $this->item->name));
if (isset($this->table) && $this->table->hasBaseFilter()) {
if (
isset($this->table)
&& $this->table->hasBaseFilter()
&& ! $serviceStats->getBaseFilter()->sameAs($this->table->getBaseFilter())

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.2 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.3 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 7.4 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.0 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.1 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.2 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.

Check failure on line 51 in library/Icingadb/Widget/ItemTable/HostgroupTableRow.php

View workflow job for this annotation

GitHub Actions / Static analysis for php 8.3 on ubuntu-latest

Cannot call method sameAs() on ipl\Stdlib\Filter\Rule|null.
) {
$serviceStats->setBaseFilter(
Filter::all($serviceStats->getBaseFilter(), $this->table->getBaseFilter())
);
Expand Down
Loading