diff --git a/core/src/views/UnifiedSearchModal.vue b/core/src/views/UnifiedSearchModal.vue index ca314fa2673dc..697b5d8d1fe0f 100644 --- a/core/src/views/UnifiedSearchModal.vue +++ b/core/src/views/UnifiedSearchModal.vue @@ -12,78 +12,88 @@ @update:is-open="showDateRangeModal = $event" />
-

{{ t('core', 'Unified search') }}

- -
- - - +
+

{{ t('core', 'Unified search') }}

+ +
+ - {{ t('core', provider.name) }} - - - - - - {{ t('core', 'Today') }} - - - {{ t('core', 'Last 7 days') }} - - - {{ t('core', 'Last 30 days') }} - - - {{ t('core', 'This year') }} - - - {{ t('core', 'Last year') }} - - - {{ t('core', 'Custom date range') }} - - - - - -
-
- - - + {{ provider.name }} + + + + + + {{ t('core', 'Today') }} + + + {{ t('core', 'Last 7 days') }} + + + {{ t('core', 'Last 30 days') }} + + + {{ t('core', 'This year') }} + + + {{ t('core', 'Last year') }} + + + {{ t('core', 'Custom date range') }} + + + + + + + {{ t('core', 'Filter in current view') }} + + +
+
+ + + +
@@ -92,8 +102,8 @@
-
-
+
+
{{ providerResult.provider }}
@@ -116,14 +126,6 @@
-
- - {{ t('core', 'Filter in current view') }} - - -
@@ -150,6 +152,7 @@ import SearchResult from '../components/UnifiedSearch/SearchResult.vue' import debounce from 'debounce' import { emit } from '@nextcloud/event-bus' +import { useBrowserLocation } from '@vueuse/core' import { getProviders, search as unifiedSearch, getContacts } from '../services/UnifiedSearchService.js' export default { @@ -180,6 +183,15 @@ export default { required: true, }, }, + setup() { + /** + * Reactive version of window.location + */ + const currentLocation = useBrowserLocation() + return { + currentLocation, + } + }, data() { return { providers: [], @@ -205,22 +217,23 @@ export default { }, computed: { - userContacts: { - get() { - return this.contacts - }, + userContacts() { + return this.contacts }, - noContentInfo: { - get() { - const isEmptySearch = this.searchQuery.length === 0 - const hasNoResults = this.searchQuery.length > 0 && this.results.length === 0 - - return { - show: isEmptySearch || hasNoResults, - text: this.searching && hasNoResults ? t('core', 'Searching …') : (isEmptySearch ? t('core', 'Start typing in search') : t('core', 'No matching results')), - icon: MagnifyIcon, - } - }, + noContentInfo() { + const isEmptySearch = this.searchQuery.length === 0 + const hasNoResults = this.searchQuery.length > 0 && this.results.length === 0 + + return { + show: isEmptySearch || hasNoResults, + text: this.searching && hasNoResults ? t('core', 'Searching …') : (isEmptySearch ? t('core', 'Start typing in search') : t('core', 'No matching results')), + icon: MagnifyIcon, + } + }, + supportFiltering() { + /* Hard coded apps for the moment this would be improved in coming updates. */ + const providerPaths = ['/settings/users', '/apps/files', '/apps/deck'] + return providerPaths.some((path) => this.currentLocation.pathname?.includes?.(path)) }, }, watch: { @@ -522,21 +535,24 @@ export default { this.internalIsVisible = false this.searchQuery = '' }, - supportFiltering() { - /* Hard coded apps for the moment this would be improved in coming updates. */ - const providerPaths = ['/settings/users', '/apps/files', '/apps/deck'] - const currentPath = window.location.pathname.replace('/index.php', '') - const containsProvider = providerPaths.some(path => currentPath.includes(path)) - return containsProvider - }, }, } diff --git a/package-lock.json b/package-lock.json index 4b3f8fa647607..85e7d270acfb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "@nextcloud/vue": "^8.3.0", "@skjnldsv/sanitize-svg": "^1.0.2", "@vueuse/components": "^10.4.1", + "@vueuse/core": "^10.7.0", "@vueuse/integrations": "^10.6.0", "autosize": "^6.0.1", "backbone": "^1.4.1", @@ -3824,94 +3825,6 @@ "vue": "^2.7.15" } }, - "node_modules/@nextcloud/dialogs/node_modules/@types/web-bluetooth": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", - "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==" - }, - "node_modules/@nextcloud/dialogs/node_modules/@vueuse/core": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.6.1.tgz", - "integrity": "sha512-Pc26IJbqgC9VG1u6VY/xrXXfxD33hnvxBnKrLlA2LJlyHII+BSrRoTPJgGYq7qZOu61itITFUnm6QbacwZ4H8Q==", - "dependencies": { - "@types/web-bluetooth": "^0.0.20", - "@vueuse/metadata": "10.6.1", - "@vueuse/shared": "10.6.1", - "vue-demi": ">=0.14.6" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@nextcloud/dialogs/node_modules/@vueuse/core/node_modules/vue-demi": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", - "integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/@nextcloud/dialogs/node_modules/@vueuse/metadata": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.6.1.tgz", - "integrity": "sha512-qhdwPI65Bgcj23e5lpGfQsxcy0bMjCAsUGoXkJ7DsoeDUdasbZ2DBa4dinFCOER3lF4gwUv+UD2AlA11zdzMFw==", - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@nextcloud/dialogs/node_modules/@vueuse/shared": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.6.1.tgz", - "integrity": "sha512-TECVDTIedFlL0NUfHWncf3zF9Gc4VfdxfQc8JFwoVZQmxpONhLxFrlm0eHQeidHj4rdTPL3KXJa0TZCk1wnc5Q==", - "dependencies": { - "vue-demi": ">=0.14.6" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@nextcloud/dialogs/node_modules/@vueuse/shared/node_modules/vue-demi": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", - "integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, "node_modules/@nextcloud/eslint-config": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/@nextcloud/eslint-config/-/eslint-config-8.3.0.tgz", @@ -5503,9 +5416,9 @@ } }, "node_modules/@types/web-bluetooth": { - "version": "0.0.18", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.18.tgz", - "integrity": "sha512-v/ZHEj9xh82usl8LMR3GarzFY1IrbXJw5L4QfQhokjRV91q+SelFqxQWSep1ucXEZ22+dSTwLFkXeur25sPIbw==" + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", + "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==" }, "node_modules/@types/ws": { "version": "8.5.8", @@ -6039,6 +5952,33 @@ "vue-demi": ">=0.14.6" } }, + "node_modules/@vueuse/components/node_modules/@types/web-bluetooth": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.18.tgz", + "integrity": "sha512-v/ZHEj9xh82usl8LMR3GarzFY1IrbXJw5L4QfQhokjRV91q+SelFqxQWSep1ucXEZ22+dSTwLFkXeur25sPIbw==" + }, + "node_modules/@vueuse/components/node_modules/@vueuse/core": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.5.0.tgz", + "integrity": "sha512-z/tI2eSvxwLRjOhDm0h/SXAjNm8N5ld6/SC/JQs6o6kpJ6Ya50LnEL8g5hoYu005i28L0zqB5L5yAl8Jl26K3A==", + "dependencies": { + "@types/web-bluetooth": "^0.0.18", + "@vueuse/metadata": "10.5.0", + "@vueuse/shared": "10.5.0", + "vue-demi": ">=0.14.6" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/components/node_modules/@vueuse/metadata": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.5.0.tgz", + "integrity": "sha512-fEbElR+MaIYyCkeM0SzWkdoMtOpIwO72x8WsZHRE7IggiOlILttqttM69AS13nrDxosnDBYdyy3C5mR1LCxHsw==", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/@vueuse/components/node_modules/vue-demi": { "version": "0.14.6", "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", @@ -6065,13 +6005,24 @@ } }, "node_modules/@vueuse/core": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.5.0.tgz", - "integrity": "sha512-z/tI2eSvxwLRjOhDm0h/SXAjNm8N5ld6/SC/JQs6o6kpJ6Ya50LnEL8g5hoYu005i28L0zqB5L5yAl8Jl26K3A==", + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.7.0.tgz", + "integrity": "sha512-4EUDESCHtwu44ZWK3Gc/hZUVhVo/ysvdtwocB5vcauSV4B7NiGY5972WnsojB3vRNdxvAt7kzJWE2h9h7C9d5w==", + "dependencies": { + "@types/web-bluetooth": "^0.0.20", + "@vueuse/metadata": "10.7.0", + "@vueuse/shared": "10.7.0", + "vue-demi": ">=0.14.6" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/core/node_modules/@vueuse/shared": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.7.0.tgz", + "integrity": "sha512-kc00uV6CiaTdc3i1CDC4a3lBxzaBE9AgYNtFN87B5OOscqeWElj/uza8qVDmk7/U8JbqoONLbtqiLJ5LGRuqlw==", "dependencies": { - "@types/web-bluetooth": "^0.0.18", - "@vueuse/metadata": "10.5.0", - "@vueuse/shared": "10.5.0", "vue-demi": ">=0.14.6" }, "funding": { @@ -6168,11 +6119,6 @@ } } }, - "node_modules/@vueuse/integrations/node_modules/@types/web-bluetooth": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", - "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==" - }, "node_modules/@vueuse/integrations/node_modules/@vueuse/core": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.6.0.tgz", @@ -6232,9 +6178,9 @@ } }, "node_modules/@vueuse/metadata": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.5.0.tgz", - "integrity": "sha512-fEbElR+MaIYyCkeM0SzWkdoMtOpIwO72x8WsZHRE7IggiOlILttqttM69AS13nrDxosnDBYdyy3C5mR1LCxHsw==", + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.7.0.tgz", + "integrity": "sha512-GlaH7tKP2iBCZ3bHNZ6b0cl9g0CJK8lttkBNUX156gWvNYhTKEtbweWLm9rxCPIiwzYcr/5xML6T8ZUEt+DkvA==", "funding": { "url": "https://github.com/sponsors/antfu" } diff --git a/package.json b/package.json index db94305722a7d..eed0cd4b0eb4a 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@nextcloud/vue": "^8.3.0", "@skjnldsv/sanitize-svg": "^1.0.2", "@vueuse/components": "^10.4.1", + "@vueuse/core": "^10.7.0", "@vueuse/integrations": "^10.6.0", "autosize": "^6.0.1", "backbone": "^1.4.1",