feat: Add nested search in folders (#14372)

Co-authored-by: Milorad FIlipović <milorad@n8n.io>
This commit is contained in:
Ricardo Espinoza
2025-04-11 19:17:28 -04:00
committed by GitHub
parent f38bd84fd1
commit cade309d3b
13 changed files with 354 additions and 46 deletions

View File

@@ -64,6 +64,7 @@ import { useUsageStore } from '@/stores/usage.store';
import { useInsightsStore } from '@/features/insights/insights.store';
import InsightsSummary from '@/features/insights/components/InsightsSummary.vue';
import { useOverview } from '@/composables/useOverview';
import { PROJECT_ROOT } from 'n8n-workflow';
const SEARCH_DEBOUNCE_TIME = 300;
const FILTERS_DEBOUNCE_TIME = 100;
@@ -132,6 +133,8 @@ const currentSort = ref('updatedAt:desc');
const currentFolderId = ref<string | null>(null);
const showCardsBadge = ref(false);
/**
* Folder actions
* These can appear on the list header, and then they are applied to current folder
@@ -352,6 +355,7 @@ watch(
() => route.params?.folderId,
async (newVal) => {
currentFolderId.value = newVal as string;
filters.value.search = '';
await fetchWorkflows();
},
);
@@ -478,7 +482,9 @@ const fetchWorkflows = async () => {
name: filters.value.search || undefined,
active: activeFilter,
tags: tags.length ? tags : undefined,
parentFolderId: parentFolder ?? (isOverviewPage.value ? undefined : '0'), // Sending 0 will only show one level of folders
parentFolderId:
parentFolder ??
(isOverviewPage.value ? undefined : filters?.value.search ? undefined : PROJECT_ROOT), // Sending 0 will only show one level of folders
},
fetchFolders,
);
@@ -499,6 +505,10 @@ const fetchWorkflows = async () => {
}
workflowsAndFolders.value = fetchedResources;
// Toggle ownership cards visibility only after we have fetched the workflows
showCardsBadge.value = isOverviewPage.value || filters.value.search !== '';
return fetchedResources;
} catch (error) {
toast.showError(error, i18n.baseText('workflows.list.error.fetching'));
@@ -1320,6 +1330,7 @@ const onCreateWorkflowClick = () => {
:actions="folderCardActions"
:read-only="readOnlyEnv || (!hasPermissionToDeleteFolders && !hasPermissionToCreateFolders)"
:personal-project="projectsStore.personalProject"
:show-ownership-badge="showCardsBadge"
class="mb-2xs"
@action="onFolderCardAction"
/>
@@ -1331,6 +1342,7 @@ const onCreateWorkflowClick = () => {
:data="data as WorkflowResource"
:workflow-list-event-bus="workflowListEventBus"
:read-only="readOnlyEnv"
:show-ownership-badge="showCardsBadge"
@click:tag="onClickTag"
@workflow:deleted="onWorkflowDeleted"
@workflow:moved="fetchWorkflows"