aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Search/SearchComposer.php9
-rw-r--r--lib/private/Search/SearchQuery.php2
-rw-r--r--lib/private/TemplateLayout.php31
3 files changed, 26 insertions, 16 deletions
diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php
index 61bbbbc969b..dd4edfc5f40 100644
--- a/lib/private/Search/SearchComposer.php
+++ b/lib/private/Search/SearchComposer.php
@@ -106,9 +106,9 @@ class SearchComposer {
}
/**
- * Get a list of all provider IDs for the consecutive calls to `search`
+ * Get a list of all provider IDs & Names for the consecutive calls to `search`
*
- * @return string[]
+ * @return array
*/
public function getProviders(): array {
$this->loadLazyProviders();
@@ -118,7 +118,10 @@ class SearchComposer {
*/
return array_values(
array_map(function (IProvider $provider) {
- return $provider->getId();
+ return [
+ 'id' => $provider->getId(),
+ 'name' => $provider->getName()
+ ];
}, $this->providers));
}
diff --git a/lib/private/Search/SearchQuery.php b/lib/private/Search/SearchQuery.php
index 2ed31fed441..186b4ccf18f 100644
--- a/lib/private/Search/SearchQuery.php
+++ b/lib/private/Search/SearchQuery.php
@@ -28,7 +28,7 @@ namespace OC\Search;
use OCP\Search\ISearchQuery;
class SearchQuery implements ISearchQuery {
- public const LIMIT_DEFAULT = 20;
+ public const LIMIT_DEFAULT = 5;
/** @var string */
private $term;
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 69eb26ab8b2..87a4d7badc1 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -44,34 +44,40 @@
namespace OC;
-use OC\AppFramework\Http\Request;
+use OC\Search\SearchQuery;
use OC\Template\JSCombiner;
use OC\Template\JSConfigHelper;
use OC\Template\SCSSCacher;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Defaults;
+use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Support\Subscription\IRegistry;
+use OCP\Util;
class TemplateLayout extends \OC_Template {
private static $versionHash = '';
- /**
- * @var \OCP\IConfig
- */
+ /** @var IConfig */
private $config;
+ /** @var IInitialStateService */
+ private $initialState;
+
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '') {
- // yes - should be injected ....
- $this->config = \OC::$server->getConfig();
+ /** @var IConfig */
+ $this->config = \OC::$server->get(IConfig::class);
- if (\OCP\Util::isIE()) {
- \OC_Util::addStyle('ie');
+ /** @var IInitialStateService */
+ $this->initialState = \OC::$server->get(InitialStateService::class);
+
+ if (Util::isIE()) {
+ Util::addStyle('ie');
}
// Decide which page we show
@@ -83,6 +89,9 @@ class TemplateLayout extends \OC_Template {
$this->assign('bodyid', 'body-user');
}
+ $this->initialState->provideInitialState('unified-search', 'limit-default', SearchQuery::LIMIT_DEFAULT);
+ Util::addScript('dist/unified-search', null, true);
+
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
@@ -240,10 +249,8 @@ class TemplateLayout extends \OC_Template {
}
}
}
-
- /** @var InitialStateService $initialState */
- $initialState = \OC::$server->query(InitialStateService::class);
- $this->assign('initialStates', $initialState->getInitialStates());
+
+ $this->assign('initialStates', $this->initialState->getInitialStates());
}
/**