diff options
Diffstat (limited to 'modules-available/statistics')
-rw-r--r-- | modules-available/statistics/inc/statisticsfilterset.inc.php | 16 | ||||
-rw-r--r-- | modules-available/statistics/pages/summary.inc.php | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/modules-available/statistics/inc/statisticsfilterset.inc.php b/modules-available/statistics/inc/statisticsfilterset.inc.php index 26595e93..5840821b 100644 --- a/modules-available/statistics/inc/statisticsfilterset.inc.php +++ b/modules-available/statistics/inc/statisticsfilterset.inc.php @@ -41,6 +41,22 @@ class StatisticsFilterSet $this->cache = compact('where', 'join', 'args'); } + /** + * Are there any "specific filters" in place? + * We consider filters specific that filter by precise information like + * CPU model, IP address, MAC address, etc. In those cases we might not + * want to filter non-client machines in the summary view, for example. + */ + public function hasSpecificFilters(): bool + { + $ignored = ['firstseen', 'lastseen', 'lastboot', 'runtime', 'state']; + foreach ($this->filters as $key => $_) { + if (!in_array($key, $ignored)) + return true; + } + return false; + } + public function filterNonClients() { if (Module::get('runmode') === false || $this->hasFilter('IsClientStatisticsFilter') !== null) diff --git a/modules-available/statistics/pages/summary.inc.php b/modules-available/statistics/pages/summary.inc.php index 905f5d90..a540e39e 100644 --- a/modules-available/statistics/pages/summary.inc.php +++ b/modules-available/statistics/pages/summary.inc.php @@ -31,7 +31,9 @@ class SubPage dechex((int)(abs((5 - $i) * 51)))); } - $filterSet->filterNonClients(); + if (!$filterSet->hasSpecificFilters()) { + $filterSet->filterNonClients(); + } StatisticsFilter::renderFilterBox('summary', $filterSet); Render::openTag('div', array('class' => 'row')); self::showSummary($filterSet); |