mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(editor): Fix loading of error workflows in settings (#18126)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useToast } from '@/composables/useToast';
|
import { useToast } from '@/composables/useToast';
|
||||||
import type { ITimeoutHMS, IWorkflowSettings, IWorkflowShortResponse } from '@/Interface';
|
import type { ITimeoutHMS, IWorkflowSettings, IWorkflowShortResponse } from '@/Interface';
|
||||||
@@ -23,6 +23,7 @@ import { ProjectTypes } from '@/types/projects.types';
|
|||||||
import { getResourcePermissions } from '@n8n/permissions';
|
import { getResourcePermissions } from '@n8n/permissions';
|
||||||
import { useI18n } from '@n8n/i18n';
|
import { useI18n } from '@n8n/i18n';
|
||||||
import { useTelemetry } from '@/composables/useTelemetry';
|
import { useTelemetry } from '@/composables/useTelemetry';
|
||||||
|
import { useDebounce } from '@/composables/useDebounce';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
@@ -262,12 +263,6 @@ const loadTimezones = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadWorkflows = async (searchTerm?: string) => {
|
const loadWorkflows = async (searchTerm?: string) => {
|
||||||
// Do not call the API if the search term is empty
|
|
||||||
// Call it if searchTerm is undefined for initial load
|
|
||||||
if (searchTerm === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const workflowsData = (await workflowsStore.searchWorkflows({
|
const workflowsData = (await workflowsStore.searchWorkflows({
|
||||||
name: searchTerm,
|
name: searchTerm,
|
||||||
})) as IWorkflowShortResponse[];
|
})) as IWorkflowShortResponse[];
|
||||||
@@ -289,6 +284,9 @@ const loadWorkflows = async (searchTerm?: string) => {
|
|||||||
workflows.value = workflowsData;
|
workflows.value = workflowsData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { debounce } = useDebounce();
|
||||||
|
const debouncedLoadWorkflows = debounce(loadWorkflows, { debounceTime: 300, trailing: true });
|
||||||
|
|
||||||
const convertToHMS = (num: number): ITimeoutHMS => {
|
const convertToHMS = (num: number): ITimeoutHMS => {
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
const hours = Math.floor(num / 3600);
|
const hours = Math.floor(num / 3600);
|
||||||
@@ -478,6 +476,10 @@ onMounted(async () => {
|
|||||||
workflow_id: workflowsStore.workflowId,
|
workflow_id: workflowsStore.workflowId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
debouncedLoadWorkflows.cancel?.();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -536,7 +538,7 @@ onMounted(async () => {
|
|||||||
placeholder="Select Workflow"
|
placeholder="Select Workflow"
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
remote-method="loadWorkflows"
|
:remote-method="debouncedLoadWorkflows"
|
||||||
remote-show-suffix
|
remote-show-suffix
|
||||||
:disabled="readOnlyEnv || !workflowPermissions.update"
|
:disabled="readOnlyEnv || !workflowPermissions.update"
|
||||||
:limit-popper-width="true"
|
:limit-popper-width="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user