summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Web
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
commit7c19368db58f16858fde7f1c5fe50c0d640c0482 (patch)
treeb416482e821607bcef8656c462d39ff995d65db0 /library/Icingadb/Web
parentAdding upstream version 1.1.1. (diff)
downloadicingadb-web-7c19368db58f16858fde7f1c5fe50c0d640c0482.tar.xz
icingadb-web-7c19368db58f16858fde7f1c5fe50c0d640c0482.zip
Adding upstream version 1.1.2.upstream/1.1.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Web')
-rw-r--r--library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php8
-rw-r--r--library/Icingadb/Web/Controller.php21
-rw-r--r--library/Icingadb/Web/Navigation/Action.php2
-rw-r--r--library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php4
4 files changed, 24 insertions, 11 deletions
diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
index b89e729..31b6483 100644
--- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
+++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
@@ -121,8 +121,12 @@ class ObjectSuggestions extends Suggestions
$quickFilter = Filter::any();
foreach ($model->getSearchColumns() as $column) {
- $where = Filter::like($resolver->qualifyColumn($column, $model->getTableName()), $searchTerm);
- $where->metaData()->set('columnLabel', $resolver->getColumnDefinition($where->getColumn())->getLabel());
+ if (strpos($column, '.') === false) {
+ $column = $resolver->qualifyColumn($column, $model->getTableName());
+ }
+
+ $where = Filter::like($column, $searchTerm);
+ $where->metaData()->set('columnLabel', $resolver->getColumnDefinition($column)->getLabel());
$quickFilter->add($where);
}
diff --git a/library/Icingadb/Web/Controller.php b/library/Icingadb/Web/Controller.php
index ad9f07e..ffa711a 100644
--- a/library/Icingadb/Web/Controller.php
+++ b/library/Icingadb/Web/Controller.php
@@ -307,10 +307,11 @@ class Controller extends CompatController
{
$columns = array_merge($query->getModel()->getSearchColumns(), $additionalColumns);
foreach ($columns as $column) {
- $filter->add(Filter::like(
- $query->getResolver()->qualifyColumn($column, $query->getModel()->getTableName()),
- "*$search*"
- ));
+ if (strpos($column, '.') === false) {
+ $column = $query->getResolver()->qualifyColumn($column, $query->getModel()->getTableName());
+ }
+
+ $filter->add(Filter::like($column, "*$search*"));
}
}
@@ -367,7 +368,10 @@ class Controller extends CompatController
// No matter the format, a limit should only apply if set
if ($this->format !== null) {
- $query->limit(Url::fromRequest()->getParam('limit'));
+ if (! Url::fromRequest()->hasParam('limit')) {
+ $query->limit(null)
+ ->offset(null);
+ }
}
if ($this->format === 'json' || $this->format === 'csv') {
@@ -512,7 +516,12 @@ class Controller extends CompatController
{
parent::preDispatch();
- $this->format = $this->params->shift('format');
+ $this->format = $this->params->shift(
+ 'format',
+ $this->getRequest()->isApiRequest()
+ ? 'json'
+ : null
+ );
}
public function postDispatch()
diff --git a/library/Icingadb/Web/Navigation/Action.php b/library/Icingadb/Web/Navigation/Action.php
index d02f933..449e9d2 100644
--- a/library/Icingadb/Web/Navigation/Action.php
+++ b/library/Icingadb/Web/Navigation/Action.php
@@ -113,7 +113,7 @@ class Action extends NavigationItem
public function getUrl(): ?\Icinga\Web\Url
{
$url = parent::getUrl();
- if (! $this->resolved && $url === null && $this->rawUrl !== null) {
+ if (! $this->resolved && $url === null && $this->rawUrl !== null && $this->object !== null) {
$this->setUrl(Url::fromPath($this->expandMacros($this->rawUrl, $this->getObject())));
$this->resolved = true;
return parent::getUrl();
diff --git a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
index 658fa1c..5e0f555 100644
--- a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
+++ b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
@@ -52,7 +52,7 @@ abstract class ProblemsBadge extends NavigationItemRenderer
return $this->count;
}
- $this->count = $this->round($count);
+ $this->count = $count;
$this->setState(static::STATE_CRITICAL);
}
@@ -146,7 +146,7 @@ abstract class ProblemsBadge extends NavigationItemRenderer
$count = $this->getProblemsCount();
if ($count) {
- return (new StateBadge($count, $this->getState()))
+ return (new StateBadge($this->round($count), $this->getState()))
->addAttributes(['class' => 'badge', 'title' => $this->getTitle()]);
}