feat(editor): Add "Change owner" option to editor (#15792)

This commit is contained in:
Raúl Gómez Morales
2025-06-03 09:59:07 +02:00
committed by GitHub
parent e76c45d46d
commit 5bc4e5d846
7 changed files with 116 additions and 53 deletions

View File

@@ -1,28 +1,28 @@
<script lang="ts" setup>
import { ref, computed, onMounted, h } from 'vue';
import { truncate } from '@n8n/utils/string/truncate';
import type { ICredentialsResponse, IUsedCredential, IWorkflowDb } from '@/Interface';
import { useI18n } from '@n8n/i18n';
import { useUIStore } from '@/stores/ui.store';
import { useProjectsStore } from '@/stores/projects.store';
import Modal from '@/components/Modal.vue';
import { VIEWS } from '@/constants';
import {
splitName,
getTruncatedProjectName,
ResourceType,
MAX_NAME_LENGTH,
} from '@/utils/projects.utils';
import { useTelemetry } from '@/composables/useTelemetry';
import { ProjectTypes } from '@/types/projects.types';
import ProjectMoveSuccessToastMessage from '@/components/Projects/ProjectMoveSuccessToastMessage.vue';
import ProjectMoveResourceModalCredentialsList from '@/components/Projects/ProjectMoveResourceModalCredentialsList.vue';
import ProjectMoveSuccessToastMessage from '@/components/Projects/ProjectMoveSuccessToastMessage.vue';
import { useTelemetry } from '@/composables/useTelemetry';
import { useToast } from '@/composables/useToast';
import { VIEWS } from '@/constants';
import type { ICredentialsResponse, IUsedCredential, IWorkflowDb } from '@/Interface';
import { getResourcePermissions } from '@/permissions';
import { sortByProperty } from '@n8n/utils/sort/sortByProperty';
import type { EventBus } from '@n8n/utils/event-bus';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useCredentialsStore } from '@/stores/credentials.store';
import { useProjectsStore } from '@/stores/projects.store';
import { useUIStore } from '@/stores/ui.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { ProjectTypes } from '@/types/projects.types';
import {
getTruncatedProjectName,
MAX_NAME_LENGTH,
ResourceType,
splitName,
} from '@/utils/projects.utils';
import { useI18n } from '@n8n/i18n';
import type { EventBus } from '@n8n/utils/event-bus';
import { sortByProperty } from '@n8n/utils/sort/sortByProperty';
import { truncate } from '@n8n/utils/string/truncate';
import { computed, h, onMounted, ref } from 'vue';
const props = defineProps<{
modalName: string;
@@ -177,6 +177,8 @@ onMounted(async () => {
project_from_type: projectsStore.currentProject?.type ?? projectsStore.personalProject?.type,
});
await projectsStore.getAvailableProjects();
if (isResourceWorkflow.value) {
const [workflow, credentials] = await Promise.all([
workflowsStore.fetchWorkflow(props.data.resource.id),