Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 16 additions & 6 deletions library/Icingadb/Common/SearchControls.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
namespace Icinga\Module\Icingadb\Common;

use Icinga\Module\Icingadb\Hook\SearchColumnsProviderHook;
use ipl\Html\Html;
use ipl\Orm\Query;
use ipl\Web\Control\SearchBar;
use ipl\Web\Control\SearchEditor;
use ipl\Web\Url;
use ipl\Web\Widget\ContinueWith;

trait SearchControls
{
use \ipl\Web\Compat\SearchControls {
\ipl\Web\Compat\SearchControls::createSearchBar as private webCreateSearchBar;
\ipl\Web\Compat\SearchControls::createSearchEditor as private webCreateSearchEditor;
}

/**
Expand All @@ -31,11 +32,6 @@ public function createSearchBar(Query $query, ...$params): SearchBar
{
$searchBar = $this->webCreateSearchBar($query, ...$params);

if (($wrapper = $searchBar->getWrapper()) && ! $wrapper->getWrapper()) {
// TODO: Remove this once ipl-web v0.7.0 is required
$searchBar->addWrapper(Html::tag('div', ['class' => 'search-controls']));
}

$model = $query->getModel();
$defaultColumns = $model->getSearchColumns();
$columns = SearchColumnsProviderHook::getCustomVarColumns($model, $defaultColumns);
Expand All @@ -51,6 +47,20 @@ private function callHandleRequest()
return false;
}

/**
* Necessary because {@see self::callHandleRequest()} prevents the {@see webCreateSearchEditor()} from calling
* $editor->handleRequest()
*
* @inheritdoc
*/
public function createSearchEditor(Query $query, ...$params): SearchEditor
{
$editor = $this->webCreateSearchEditor($query, ...$params);
$editor->handleRequest($this->getServerRequest());

return $editor;
}

/**
* Create and return a ContinueWith
*
Expand Down
46 changes: 0 additions & 46 deletions public/css/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -107,52 +107,6 @@ div.show-more {
.notice {
display: none;
}

// TODO: Remove once ipl-web v0.7.0 is required
&:not(.default-layout) {
.pagination-control {
float: left;
}

.sort-control {
display: flex;
justify-content: flex-end;

:not(.form-element) > label {
margin-right: 0;
}

.control-button {
margin: 0;
}
}

> :not(:only-child) {
margin-bottom: 0.5em;
}

.search-suggestions {
margin-bottom: 2.5em;
}

.search-controls {
clear: both;
display: flex;
min-width: 100%;

.search-bar {
flex: 1 1 auto;

& ~ .control-button:last-child {
margin-right: -.5em;
}

& ~ .control-button {
margin-left: .5em;
}
}
}
}
}

.content > h2:first-child,
Expand Down
Loading