Browse Source

fix(nc-gui): failing grid tests

pull/7625/head
DarkPhoenix2704 9 months ago
parent
commit
f0bd7e4b25
  1. 9
      packages/nc-gui/components/cmd-l/index.vue

9
packages/nc-gui/components/cmd-l/index.vue

@ -26,21 +26,22 @@ const { recentViews, activeView } = storeToRefs(viewStore)
const selected: Ref<string> = ref('') const selected: Ref<string> = ref('')
const newView: Ref< const newView = ref<
| { | {
viewId: string | null viewId: string | null
tableId: string tableId: string
baseId: string baseId: string
} }
| undefined | undefined
> = ref() >()
const filteredViews = computed(() => { const filteredViews = computed(() => {
const filteredList = recentViews.value.filter((v) => { const filteredList = recentViews.value.filter((v) => {
if (!v.viewName || !v.tableName || !v.baseName) return false
return v.viewName.toLowerCase().includes(search.value.toLowerCase()) return v.viewName.toLowerCase().includes(search.value.toLowerCase())
}) })
if (!filteredList.find((v) => v.tableID + v.viewName === selected.value) && filteredList.length) { if (filteredList.find((v) => v.tableID + v.viewName === selected.value) && filteredList.length) {
selected.value = filteredList[0].tableID + filteredList[0].viewName selected.value = filteredList[0].tableID + filteredList[0].viewName
} }
return filteredList return filteredList
@ -174,7 +175,7 @@ useEventListener('keydown', (e: KeyboardEvent) => {
onMounted(() => { onMounted(() => {
document.querySelector('.cmdOpt-list')?.focus() document.querySelector('.cmdOpt-list')?.focus()
if (!activeView.value) return if (!activeView.value || !filteredViews.value.length) return
const index = filteredViews.value.findIndex( const index = filteredViews.value.findIndex(
(v) => v.viewName === filteredViews.value?.title && v.tableID === filteredViews.value?.fk_model_id, (v) => v.viewName === filteredViews.value?.title && v.tableID === filteredViews.value?.fk_model_id,
) )

Loading…
Cancel
Save