-
Notifications
You must be signed in to change notification settings - Fork 49.3k
fix: Prevent multiple api requests when changing workflow owner #21335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ireneea
merged 7 commits into
master
from
pay-2994-moving-workflow-to-project-with-credentials-causes-errors
Nov 3, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5d8b09f
feat: add loading state to project move modal
ireneea cdd3f7e
test: Test duplicate submissions prevention in ProjectMoveResourceModal
ireneea b0f57f6
feat(editor): Enhance ProjectMoveResourceModal with router integratio…
ireneea b394e6e
fix(editor): Add comment for navigation handling in ProjectMoveSucces…
ireneea 61e1cb8
fix: Fix error toast message display
ireneea 380c5d3
Merge branch 'master' into pay-2994-moving-workflow-to-project-with-c…
ireneea f539ae2
Merge branch 'master' into pay-2994-moving-workflow-to-project-with-c…
ireneea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ import { sortByProperty } from '@n8n/utils/sort/sortByProperty'; | |
| import { truncate } from '@n8n/utils/string/truncate'; | ||
| import { computed, h, onMounted, ref } from 'vue'; | ||
| import { I18nT } from 'vue-i18n'; | ||
| import { useRouter } from 'vue-router'; | ||
|
|
||
| import { | ||
| N8nButton, | ||
|
|
@@ -52,6 +53,7 @@ const props = defineProps<{ | |
| const i18n = useI18n(); | ||
| const uiStore = useUIStore(); | ||
| const toast = useToast(); | ||
| const router = useRouter(); | ||
| const projectsStore = useProjectsStore(); | ||
| const workflowsStore = useWorkflowsStore(); | ||
| const credentialsStore = useCredentialsStore(); | ||
|
|
@@ -62,6 +64,7 @@ const projectId = ref<string | null>(null); | |
| const shareUsedCredentials = ref(false); | ||
| const usedCredentials = ref<IUsedCredential[]>([]); | ||
| const allCredentials = ref<ICredentialsResponse[]>([]); | ||
| const loading = ref(false); | ||
| const shareableCredentials = computed(() => | ||
| allCredentials.value.filter( | ||
| (credential) => | ||
|
|
@@ -133,7 +136,9 @@ const setFilter = (query: string) => { | |
| }; | ||
|
|
||
| const moveResource = async () => { | ||
| if (!selectedProject.value) return; | ||
| if (!selectedProject.value || loading.value) return; | ||
|
|
||
| loading.value = true; | ||
| try { | ||
| await projectsStore.moveResourceToProject( | ||
| props.data.resourceType, | ||
|
|
@@ -163,6 +168,15 @@ const moveResource = async () => { | |
| areAllUsedCredentialsShareable: | ||
| shareableCredentials.value.length === usedCredentials.value.length, | ||
| }), | ||
| onClick: (event: MouseEvent | undefined) => { | ||
| if (event?.target instanceof HTMLAnchorElement && selectedProject.value) { | ||
| event.preventDefault(); | ||
| void router.push({ | ||
| name: isResourceWorkflow.value ? VIEWS.PROJECTS_WORKFLOWS : VIEWS.PROJECTS_CREDENTIALS, | ||
| params: { projectId: selectedProject.value.id }, | ||
| }); | ||
| } | ||
| }, | ||
| type: 'success', | ||
| duration: 8000, | ||
| }); | ||
|
|
@@ -175,14 +189,16 @@ const moveResource = async () => { | |
| } | ||
| } catch (error) { | ||
| toast.showError( | ||
| error.message, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what was causing the error modal to show |
||
| error, | ||
| i18n.baseText('projects.move.resource.error.title', { | ||
| interpolate: { | ||
| resourceTypeLabel: props.data.resourceTypeLabel, | ||
| resourceName: resourceName.value, | ||
| }, | ||
| }), | ||
| ); | ||
| } finally { | ||
| loading.value = false; | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -337,11 +353,12 @@ onMounted(async () => { | |
| </template> | ||
| <template #footer> | ||
| <div :class="$style.buttons"> | ||
| <N8nButton type="secondary" text class="mr-2xs" @click="closeModal"> | ||
| <N8nButton type="secondary" text class="mr-2xs" :disabled="loading" @click="closeModal"> | ||
| {{ i18n.baseText('generic.cancel') }} | ||
| </N8nButton> | ||
| <N8nButton | ||
| :disabled="!projectId" | ||
| :loading="loading" | ||
| :disabled="!projectId || loading" | ||
| type="primary" | ||
| data-test-id="project-move-resource-modal-button" | ||
| @click="moveResource" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using onClick because
RouterLinkdoesn't work in the toast (Also see change in theProjectMoveSuccessToastMessagecomponent)