add all filters

This commit is contained in:
Mutasem Aldmour 2024-10-30 13:34:07 +01:00
parent 0a357a8c97
commit b41c91d290
No known key found for this signature in database
GPG key ID: 3DFA8122BB7FD6B8

View file

@ -63,7 +63,7 @@ interface Filters {
nodeTypes: string[]; nodeTypes: string[];
nodeName: string; nodeName: string;
webhookUrl: string; webhookUrl: string;
httpRequestUrl: string; httpNodeUrl: string;
} }
const StatusFilter = { const StatusFilter = {
@ -82,7 +82,7 @@ const filters = ref<Filters>({
nodeTypes: [], nodeTypes: [],
nodeName: '', nodeName: '',
webhookUrl: '', webhookUrl: '',
httpRequestUrl: '', httpNodeUrl: '',
}); });
const readOnlyEnv = computed(() => sourceControlStore.preferences.branchReadOnly); const readOnlyEnv = computed(() => sourceControlStore.preferences.branchReadOnly);
@ -191,16 +191,20 @@ const trackCategoryLinkClick = (category: string) => {
}; };
const fetchWorkflowsWithFilters = async () => { const fetchWorkflowsWithFilters = async () => {
const { homeProject, status, credentials } = filters.value; const { homeProject, status, credentials, nodeTypes, nodeName, webhookUrl, httpNodeUrl } =
filters.value;
const options: WorkflowsFetchOptions = { const options: WorkflowsFetchOptions = {
filter: { filter: {
projectId: homeProject ? homeProject : undefined, projectId: homeProject ? homeProject : undefined,
active: status === StatusFilter.ACTIVE ? true : undefined, active: status === StatusFilter.ACTIVE ? true : undefined,
}, },
credentialIds: credentials.length ? credentials : undefined, credentialIds: credentials.length ? credentials : undefined,
nodeTypes: nodeTypes.length ? nodeTypes : undefined,
nodeName: nodeName.length ? nodeName : undefined,
httpNodeURL: httpNodeUrl.length ? httpNodeUrl : undefined,
webhookURL: webhookUrl.length ? webhookUrl : undefined,
}; };
console.log('fetching', options);
await workflowsStore.fetchAllWorkflows(options); await workflowsStore.fetchAllWorkflows(options);
}; };
@ -254,8 +258,8 @@ const saveFiltersOnQueryString = () => {
query.nodeName = filters.value.nodeName; query.nodeName = filters.value.nodeName;
} }
if (filters.value.httpRequestUrl) { if (filters.value.httpNodeUrl) {
query.httpRequestUrl = filters.value.httpRequestUrl; query.httpNodeUrl = filters.value.httpNodeUrl;
} }
if (filters.value.webhookUrl) { if (filters.value.webhookUrl) {
@ -280,7 +284,7 @@ const setFiltersFromQueryString = async () => {
credentials, credentials,
nodeTypes, nodeTypes,
nodeName, nodeName,
httpRequestUrl, httpNodeUrl,
webhookUrl, webhookUrl,
} = route.query ?? {}; } = route.query ?? {};
@ -306,8 +310,8 @@ const setFiltersFromQueryString = async () => {
filters.value.nodeName = nodeName; filters.value.nodeName = nodeName;
} }
if (httpRequestUrl && typeof httpRequestUrl === 'string') { if (httpNodeUrl && typeof httpNodeUrl === 'string') {
filters.value.httpRequestUrl = httpRequestUrl; filters.value.httpNodeUrl = httpNodeUrl;
} }
if (webhookUrl && typeof webhookUrl === 'string') { if (webhookUrl && typeof webhookUrl === 'string') {
@ -562,6 +566,7 @@ onMounted(async () => {
:model-value="filters.nodeTypes" :model-value="filters.nodeTypes"
:multiple="true" :multiple="true"
:placeholder="i18n.baseText('workflows.filters.nodeTypes.placeholder')" :placeholder="i18n.baseText('workflows.filters.nodeTypes.placeholder')"
:filterable="true"
class="tags-container" class="tags-container"
@update:model-value="setKeyValue('nodeTypes', $event)" @update:model-value="setKeyValue('nodeTypes', $event)"
> >
@ -618,8 +623,8 @@ onMounted(async () => {
> >
<N8nInput <N8nInput
data-test-id="url-webhook-filter" data-test-id="url-webhook-filter"
:model-value="filters.httpRequestUrl" :model-value="filters.httpNodeUrl"
@update:model-value="setKeyValue('httpRequestUrl', $event)" @update:model-value="setKeyValue('httpNodeUrl', $event)"
/> />
</N8nInputLabel> </N8nInputLabel>
</div> </div>