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
commitbe4626482ba8761da39746a6ac60d133d3852a0f (patch)
tree45065832c85c4789237e94b3114360eac91d86f0 /library/Icingadb/Web
parentReleasing progress-linux version 1.1.1-1~progress7.99u1. (diff)
downloadicingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz
icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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()]);
}