Improve mobile search performance, streamline namespace registration

This commit is contained in:
Björn Fromme
2021-10-26 10:18:27 +02:00
parent 8228c0d153
commit 2b2dbae409
25 changed files with 113 additions and 134 deletions
@@ -65,26 +65,16 @@ class AjaxFilterPanelController extends ActionController
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
$excludedRegionUids = GeneralUtility::trimExplode(',', $this->settings['excludedRegionUids']);
$filterOptions = $this->filterService->getFilterOptions(
$filterSettings,
$excludedConceptUids,
$excludedRegionUids,
$forcedConceptUids
);
$filterOptions = $this
->filterService
->getFilterOptions(
$filterSettings,
$excludedConceptUids,
$excludedRegionUids,
$forcedConceptUids
);
$this->view->assignMultiple([
'filterSettings' => $filterSettings,
'filterOptions' => $filterOptions,
'stimulusController' => 'mobile-search',
]);
}
/**
* @param array $filterSettings
*/
public function searchAction(array $filterSettings)
{
$uri = $this->uriBuilder
$resultsUri = $this->uriBuilder
->reset()
->setCreateAbsoluteUri(true)
->setTargetPageUid($this->settings['defaultSearchPageUid'])
@@ -96,6 +86,13 @@ class AjaxFilterPanelController extends ActionController
'searchresult'
);
return json_encode($uri, JSON_THROW_ON_ERROR);
$filterOptions->setResultsUri($resultsUri);
$this->view->assignMultiple([
'filterSettings' => $filterSettings,
'filterOptions' => $filterOptions,
'stimulusController' => 'mobile-search',
]);
}
}
@@ -1,6 +1,6 @@
<?php
namespace EP\EpProducts\Domain\Model;
namespace EP\EpProducts\Domain\Model\Dto;
/***************************************************************
*
@@ -101,6 +101,11 @@ class FilterOptions implements \JsonSerializable
*/
protected $resultCount;
/**
* @var string
*/
protected $resultsUri;
public function __construct()
{
$this->pax = [
@@ -301,6 +306,22 @@ class FilterOptions implements \JsonSerializable
$this->resultCount = $resultCount;
}
/**
* @return string
*/
public function getResultsUri(): ?string
{
return $this->resultsUri;
}
/**
* @param string $resultsUri
*/
public function setResultsUri(string $resultsUri)
{
$this->resultsUri = $resultsUri;
}
/**
* @return array
*/
@@ -319,6 +340,7 @@ class FilterOptions implements \JsonSerializable
'dateTo' => ($this->getDateTo() !== null) ? $this->getDateTo()->format('Y-m-d') : null,
'busAvailable' => $this->getBusAvailable(),
'resultCount' => $this->getResultCount(),
'resultsUri' => $this->getResultsUri(),
];
}
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\FilterOptions;
use EP\EpProducts\Domain\Model\Dto\FilterOptions;
use EP\EpProducts\Service\FilterService;
use EP\EpProducts\Traits\DbConnectionTrait;
use TYPO3\CMS\Core\Database\Connection;
@@ -27,7 +27,7 @@ namespace EP\EpProducts\Service;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\FilterOptions;
use EP\EpProducts\Domain\Model\Dto\FilterOptions;
use EP\EpProducts\Domain\Model\SearchResult;
use EP\EpProducts\Domain\Repository\DateRepository;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -26,7 +26,7 @@ namespace EP\EpProducts\Service;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\FilterOptions;
use EP\EpProducts\Domain\Model\Dto\FilterOptions;
use EP\EpProducts\Traits\DbConnectionTrait;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\SingletonInterface;
@@ -14,7 +14,6 @@ export default class extends Controller {
static values = {
optionsUri: String,
initialOptionsUri: String,
searchUri: String,
loading: Boolean,
loaded: Boolean,
show: Boolean,
@@ -63,20 +62,6 @@ export default class extends Controller {
})
}
search() {
const options = {
method: 'POST',
body: new FormData(this.formTarget)
}
this.loadingValue = true
fetch(this.searchUriValue, options)
.then(this.checkStatus)
.then(this.parseJSON)
.then(uri => {
window.location = uri
})
}
selectDateRange(e) {
e.stopPropagation()
this.dateFromTarget.value = e.detail.from
@@ -1,13 +1,11 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<div class="fixed lg:hidden top-0 left-0 inset-0 w-screen h-screen pt-14 pb-10 z-50 bg-gray-700 hidden"
data-controller="mobile-search"
data-mobile-search-options-uri-value="{ep:uri.ajax(controller: 'AjaxFilterPanel', action: 'options', pageUid: settings.defaultAjaxUid, format: 'html')}"
data-mobile-search-initial-options-uri-value="{ep:uri.ajax(controller: 'AjaxFilterPanel', action: 'options', pageUid: settings.defaultAjaxUid, arguments: '{filterSettings: filterSettings}', format: 'html')}"
data-mobile-search-search-uri-value="{ep:uri.ajax(controller: 'AjaxFilterPanel', action: 'search', pageUid: settings.defaultAjaxUid, format: 'json')}"
data-action="overlay-toggle:toggle@window->mobile-search#open datepicker:range-select->mobile-search#selectDateRange">
<div class="fixed top-0 left-0 z-100 inset-x-0 px-4 py-2 flex justify-between bg-white shadow-md">
<a href="{f:uri.typolink(parameter: settings.defaultHomeUid)}"
@@ -1,7 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,7 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -13,13 +12,14 @@
data="{'mobile-search-target': 'form'}">
<f:render partial="Search/FilterPanel" arguments="{_all}"/>
</f:form>
<div class="mt-4">
<button type="button"
class="button button--primary w-full"
data-action="mobile-search#search">
Ergebnis anzeigen
</button>
</div>
<f:if condition="{filterOptions.resultsUri}">
<div class="mt-4">
<a href="{filterOptions.resultsUri}"
class="button button--primary w-full">
Ergebnis anzeigen
</a>
</div>
</f:if>
<div class="mt-4">
<button type="button"
class="button button--secondary w-full"
@@ -1,11 +0,0 @@
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<f:layout name="Form/Default"/>
<f:section name="Main">
<f:render partial="ContactForm/Full" arguments="{_all}"/>
</f:section>
</div>
@@ -1,11 +0,0 @@
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<f:layout name="Form/Default"/>
<f:section name="Main">
<f:render partial="ContactForm/Simple" arguments="{_all}"/>
</f:section>
</div>
@@ -1,6 +1,6 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,6 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,6 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,7 +1,7 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,6 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,6 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,7 +1,6 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:if condition="{watchlist -> f:count()} == 0">
<f:then>
@@ -1,6 +1,6 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,22 +1,22 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
<f:layout name="Default"/>
<f:section name="Main">
<ep:container data="{data}" cssClasses="py-8">
<f:if condition="{data.header_layout} != 100">
<f:if condition="{data.header}">
<f:render partial="Header/Header" arguments="{header: data.header, subheader: data.subheader, layout: data.header_layout, link: data.header_link}" />
<f:section name="Main">
<ep:container data="{data}" cssClasses="py-8">
<f:if condition="{data.header_layout} != 100">
<f:if condition="{data.header}">
<f:render partial="Header/Header" arguments="{header: data.header, subheader: data.subheader, layout: data.header_layout, link: data.header_link}" />
</f:if>
</f:if>
</f:if>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<f:for each="{children_300}" as="record">
{record.renderedContent -> f:format.raw()}
</f:for>
</div>
</ep:container>
</f:section>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<f:for each="{children_300}" as="record">
{record.renderedContent -> f:format.raw()}
</f:for>
</div>
</ep:container>
</f:section>
</html>
@@ -1,8 +1,7 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
xmlns:encore="http://typo3.org/ns/Ssch/Typo3Encore/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
data-namespace-typo3-fluid="true">
<div class="container">
<div class="page-header">
@@ -1,10 +1,8 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
<f:layout name="Default"/>
<f:section name="Main">
<div class="ajax-content-wrapper"
@@ -1,4 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,4 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>
@@ -1,6 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers">
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="Default"/>