Skip to content

Commit 743bcaa

Browse files
committed
refactor(core): drop the unified search local search bar
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
1 parent a7ca899 commit 743bcaa

10 files changed

Lines changed: 26 additions & 275 deletions

core/src/components/UnifiedSearch/UnifiedSearchLocalSearchBar.vue

Lines changed: 0 additions & 169 deletions
This file was deleted.

core/src/components/UnifiedSearch/UnifiedSearchModal.vue

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@
117117
</NcButton>
118118
</template>
119119
</SearchableList>
120-
<NcButton
121-
v-if="localSearch"
122-
variant="tertiary"
123-
data-cy-unified-search-filter="current-view"
124-
@click="searchLocally">
125-
{{ t('core', 'Filter in current view') }}
126-
<template #icon>
127-
<IconFilter :size="20" />
128-
</template>
129-
</NcButton>
130120
</div>
131121
<div v-show="!detailCategory && hasAnyActiveFilter" class="unified-search-modal__filters-applied">
132122
<FilterChip
@@ -280,7 +270,6 @@ import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
280270
import IconCalendarBlankOutline from 'vue-material-design-icons/CalendarBlankOutline.vue'
281271
import IconClose from 'vue-material-design-icons/Close.vue'
282272
import IconDotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
283-
import IconFilter from 'vue-material-design-icons/Filter.vue'
284273
import IconMagnify from 'vue-material-design-icons/Magnify.vue'
285274
import IconShapeOutline from 'vue-material-design-icons/ShapeOutline.vue'
286275
import CustomDateRangeModal from './CustomDateRangeModal.vue'
@@ -313,7 +302,6 @@ export default defineComponent({
313302
IconCalendarBlankOutline,
314303
IconClose,
315304
IconDotsHorizontal,
316-
IconFilter,
317305
IconMagnify,
318306
IconShapeOutline,
319307
@@ -347,14 +335,6 @@ export default defineComponent({
347335
default: '',
348336
},
349337
350-
/**
351-
* If the current page / app supports local search
352-
*/
353-
localSearch: {
354-
type: Boolean,
355-
default: false,
356-
},
357-
358338
/**
359339
* Reveal the filter row before the user has typed. Set by the header input's
360340
* funnel button (relayed through the parent view) so filters can be opened on
@@ -944,14 +924,6 @@ export default defineComponent({
944924
this.focusTrap = null
945925
},
946926
947-
/**
948-
* Only close the modal but keep the query for in-app search
949-
*/
950-
searchLocally() {
951-
this.$emit('update:query', this.searchQuery)
952-
this.$emit('update:open', false)
953-
},
954-
955927
/**
956928
* Blank the results, then queue the search. Every query and filter change comes through
957929
* here. The results on screen answer the previous question, so holding them until the

core/src/tests/components/UnifiedSearch.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,28 +184,30 @@ describe('UnifiedSearch find shortcut (Ctrl+F) aligns with Ctrl+K', () => {
184184
wrapper.destroy()
185185
})
186186

187-
// Deck & co. own Ctrl+F for their in-app search bar; that must survive the alignment.
188-
it('on local-search pages still toggles the local bar, not the global input', () => {
189-
location.value = { pathname: '/apps/deck' }
187+
it('stays out of the way on pages that own the search shortcut', () => {
188+
location.value = { pathname: '/settings/users' }
190189
const wrapper = mountWithShortcuts()
191190
const focusInput = vi.spyOn(wrapper.vm, 'focusInput').mockImplementation(() => {})
192191

193-
pressCtrl('f')
192+
const prevented = pressCtrl('f')
194193

195-
expect(wrapper.vm.showLocalSearch).toBe(true)
196194
expect(focusInput).not.toHaveBeenCalled()
195+
expect(prevented).not.toHaveBeenCalled()
197196
wrapper.destroy()
198197
})
199198

200-
it('stays out of the way on pages that own the search shortcut', () => {
201-
location.value = { pathname: '/settings/users' }
199+
// Deck filters cards in place and binds Ctrl+F to its own board input, so the header
200+
// must not steal the key there. This replaces the local search bar we used to render.
201+
it('leaves Ctrl+F to Deck, which filters in its own board input', () => {
202+
location.value = { pathname: '/apps/deck' }
202203
const wrapper = mountWithShortcuts()
203204
const focusInput = vi.spyOn(wrapper.vm, 'focusInput').mockImplementation(() => {})
204205

205206
const prevented = pressCtrl('f')
206207

207208
expect(focusInput).not.toHaveBeenCalled()
208209
expect(prevented).not.toHaveBeenCalled()
210+
expect(wrapper.vm.showUnifiedSearch).toBe(false)
209211
wrapper.destroy()
210212
})
211213

@@ -258,12 +260,10 @@ describe('UnifiedSearch find shortcut (Ctrl+F) aligns with Ctrl+K', () => {
258260
})
259261

260262
describe('UnifiedSearch combobox expanded state', () => {
261-
// The header input is the combobox for the unified results only. On local-search
262-
// pages (e.g. deck) Ctrl+F opens just the local bar, so the input must report
263-
// collapsed and not point aria-controls at an unrendered popover.
264-
it('reports collapsed when only the local search bar is open', async () => {
263+
// The header input is the combobox for the results popover, so while that popover is
264+
// shut it must report collapsed rather than point aria-controls at an unrendered panel.
265+
it('reports collapsed while the results popover is closed', async () => {
265266
const wrapper = factory()
266-
wrapper.vm.showLocalSearch = true
267267
wrapper.vm.showUnifiedSearch = false
268268
await wrapper.vm.$nextTick()
269269

core/src/tests/components/UnifiedSearchModal.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function loaded(entries: unknown[], hasMore = false) {
6565

6666
function factory(open = true) {
6767
return shallowMount(UnifiedSearchModal, {
68-
propsData: { open, query: '', localSearch: false },
68+
propsData: { open, query: '' },
6969
global: { mocks: { t: (_: string, s: string) => s, n: (_: string, s: string) => s } },
7070
})
7171
}
@@ -335,7 +335,7 @@ describe('UnifiedSearchModal reset on close', () => {
335335
// The pending debounce must be cancelled on close so it can't dispatch for a shut modal.
336336
const cancelPending = vi.spyOn(wrapper.vm.debouncedFind, 'clear')
337337

338-
// searchLocally-style close: keep the query, just shut the popover.
338+
// Close without clearing: the query stays, only the popover shuts.
339339
await wrapper.setProps({ open: false })
340340

341341
expect(cancelPending).toHaveBeenCalled()
@@ -489,7 +489,7 @@ describe('UnifiedSearchModal controller wiring (init)', () => {
489489
// Open with a query already present: the open() handler starts the async provider
490490
// fetch and calls find() before it resolves, so nothing is dispatched yet.
491491
const wrapper = shallowMount(UnifiedSearchModal, {
492-
propsData: { open: false, query: 'hello', localSearch: false },
492+
propsData: { open: false, query: 'hello' },
493493
global: { mocks: { t: (_: string, s: string) => s, n: (_: string, s: string) => s } },
494494
})
495495
// The focus trap needs a tabbable node the stubbed panel lacks; skip it here.

0 commit comments

Comments
 (0)