Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-08-05 10:49:18 +0300
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2020-08-05 15:52:16 +0300
commitea8f68bea6957ae459ff1ba6849b25354b3f0093 (patch)
treeb6523d1ad1c01e55622fd31bfcfb27daabec0593 /core/src
parentd98f7c1bd83fc03fd297ebeac6279ffe17316950 (diff)
Hand in the route and the parameters of the request
Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/services/UnifiedSearchService.js3
-rw-r--r--core/src/views/UnifiedSearch.vue29
2 files changed, 13 insertions, 19 deletions
diff --git a/core/src/services/UnifiedSearchService.js b/core/src/services/UnifiedSearchService.js
index bc8cca19ce8..8e4c4a2a073 100644
--- a/core/src/services/UnifiedSearchService.js
+++ b/core/src/services/UnifiedSearchService.js
@@ -24,8 +24,7 @@ import { loadState } from '@nextcloud/initial-state'
import axios from '@nextcloud/axios'
export const defaultLimit = loadState('unified-search', 'limit-default')
-export const activeApp = loadState('core', 'active-app')
-
+export const minSearchLength = 2
/**
* Get the list of available search providers
*
diff --git a/core/src/views/UnifiedSearch.vue b/core/src/views/UnifiedSearch.vue
index 4e32bdbedd1..4f316866862 100644
--- a/core/src/views/UnifiedSearch.vue
+++ b/core/src/views/UnifiedSearch.vue
@@ -67,7 +67,7 @@
<!-- Grouped search results -->
<template v-else>
- <ul v-for="(list, type, typesIndex) in orderedResults"
+ <ul v-for="({list, type}, typesIndex) in orderedResults"
:key="type"
class="unified-search__results"
:class="`unified-search__results-${type}`"
@@ -97,7 +97,7 @@
</template>
<script>
-import { getTypes, search, defaultLimit, activeApp } from '../services/UnifiedSearchService'
+import { minSearchLength, getTypes, search, defaultLimit } from '../services/UnifiedSearchService'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import Magnify from 'vue-material-design-icons/Magnify'
import debounce from 'debounce'
@@ -106,8 +106,6 @@ import HeaderMenu from '../components/HeaderMenu'
import SearchResult from '../components/UnifiedSearch/SearchResult'
import SearchResultPlaceholder from '../components/UnifiedSearch/SearchResultPlaceholder'
-const minSearchLength = 2
-
export default {
name: 'UnifiedSearch',
@@ -132,7 +130,6 @@ export default {
query: '',
focused: null,
- activeApp,
defaultLimit,
minSearchLength,
@@ -163,18 +160,16 @@ export default {
},
/**
- * Order results by putting the active app first
+ * Return ordered results
* @returns {Object}
*/
orderedResults() {
- const ordered = {}
- Object.keys(this.results)
- .sort((a, b) => this.typesMap[a].order - this.typesMap[b].order)
- .forEach(type => {
- ordered[type] = this.results[type]
- })
-
- return ordered
+ return Object.values(this.typesIDs)
+ .filter(type => type in this.results)
+ .map(type => ({
+ type,
+ list: this.results[type],
+ }))
},
/**
@@ -390,10 +385,10 @@ export default {
* @returns {Array}
*/
limitIfAny(list, type) {
- if (!this.limits[type]) {
- return list
+ if (type in this.limits) {
+ return list.slice(0, this.limits[type])
}
- return list.slice(0, this.limits[type])
+ return list
},
getResultsList() {