π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Group recursive search
Smaug6739ff6e333ae4b9
diff --git a/frontend/app/components/AppSelect.vue b/frontend/app/components/AppSelect.vueindex 1e09f63f..24391859 100644--- a/frontend/app/components/AppSelect.vue+++ b/frontend/app/components/AppSelect.vue@@ -48,21 +48,7 @@ const selected = computed(() => {const filteredItems = computed(() => {if (!search.value.trim()) return props.items;-- const filterRecursive = (items: ANode[]): ANode[] => {- return items- .map(item => {- const matches = item.label.toLowerCase().includes(search.value.toLowerCase());- const filteredChildren = item.childrens ? filterRecursive(item.childrens) : [];- if (matches || filteredChildren.length > 0) {- return { ...item, childrens: filteredChildren };- }- return null;- })- .filter(Boolean) as ANode[];- };-- return filterRecursive(props.items);+ return filterRecursive(props.items, search);});function toggleDropdown() {diff --git a/frontend/app/components/Sidebar/Sidebar.vue b/frontend/app/components/Sidebar/Sidebar.vueindex 2cb4b515..1dbc7cdf 100644--- a/frontend/app/components/Sidebar/Sidebar.vue+++ b/frontend/app/components/Sidebar/Sidebar.vue@@ -61,19 +61,7 @@ const sidebarTree = useSidebarTree();const toggleDock = () => preferences.set('view_dock', !preferences.get('view_dock'));const filterItems = (items: Item[]): Item[] => {if (!filter.value.trim()) return items;- const filterRecursive = (items: Item[]): Item[] => {- return items- .map(item => {- const matches = item.label.toLowerCase().includes(filter.value.toLowerCase());- const filteredChildren = item.childrens ? filterRecursive(item.childrens) : [];- if (matches || filteredChildren.length > 0) {- return { ...item, childrens: filteredChildren };- }- return null;- })- .filter(Boolean) as Item[];- };- return filterRecursive(items);+ return filterRecursive(items, filter);};const tree = computed(() => filterItems(sidebarTree.filtered.value));diff --git a/frontend/app/composables/TreeStructure.ts b/frontend/app/composables/TreeStructure.tsindex 7419543a..fe895a4b 100644--- a/frontend/app/composables/TreeStructure.ts+++ b/frontend/app/composables/TreeStructure.ts@@ -70,3 +70,15 @@ export class TreeStructure {};}}+export const filterRecursive = <T extends ANode>(items: T[], filter: Ref<string>): T[] => {+ return items+ .map(item => {+ const matches = item.label.toLowerCase().includes(filter.value.toLowerCase());+ const filteredChildren = item.childrens ? filterRecursive(item.childrens, filter) : [];+ if (matches || filteredChildren.length > 0) {+ return { ...item, childrens: filteredChildren };+ }+ return null;+ })+ .filter(Boolean) as T[];+};diff --git a/frontend/app/pages/dashboard/categories/index.vue b/frontend/app/pages/dashboard/categories/index.vueindex 99a658db..e287c766 100644--- a/frontend/app/pages/dashboard/categories/index.vue+++ b/frontend/app/pages/dashboard/categories/index.vue@@ -33,21 +33,7 @@ const tree = computed(() => new TreeStructure(useSidebarTree().categories.value)const filteredItems = computed(() => {if (!filter.value.trim()) return tree.value;-- const filterRecursive = (items: Item<Category>[]): Item<Category>[] => {- return items- .map(item => {- const matches = item.label.toLowerCase().includes(filter.value.toLowerCase());- const filteredChildren = item.childrens ? filterRecursive(item.childrens) : [];- if (matches || filteredChildren.length > 0) {- return { ...item, childrens: filteredChildren };- }- return null;- })- .filter(Boolean) as Item<Category>[];- };-- return filterRecursive(tree.value);+ return filterRecursive<Item<Category>>(tree.value, filter);});const createWorkspace = () => useModal().add(new Modal(shallowRef(CreateCategoryModal), { role: 2 }));