fix(editor): Show used credentials names as links in a tooltip and send IDs with the request

This commit is contained in:
Csaba Tuncsik 2025-01-09 12:18:30 +01:00
parent 32c6768271
commit 3eeea284f9
No known key found for this signature in database
3 changed files with 25 additions and 2 deletions

View file

@ -19,8 +19,10 @@ export async function moveWorkflowToProject(
context: IRestApiContext,
id: string,
destinationProjectId: string,
shareCredentials?: string[],
): Promise<void> {
return await makeRestApiRequest(context, 'PUT', `/workflows/${id}/transfer`, {
destinationProjectId,
shareCredentials,
});
}

View file

@ -82,6 +82,7 @@ const moveResource = async () => {
props.data.resourceType,
props.data.resource.id,
selectedProject.value.id,
shareUsedCredentials.value ? usedCredentials.value.map((c) => c.id) : undefined,
);
closeModal();
telemetry.track(`User successfully moved ${props.data.resourceType}`, {
@ -221,7 +222,7 @@ onMounted(async () => {
}}
</span>
<template #content>
<ul>
<ul :class="$style.credentialsList">
<li v-for="credential in usedCredentials" :key="credential.id">
<router-link
target="_blank"
@ -276,4 +277,18 @@ onMounted(async () => {
display: block;
margin-top: var(--spacing-s);
}
.credentialsList {
list-style-type: none;
padding: 0;
margin: 0;
li {
padding: 0 0 var(--spacing-3xs);
&:last-child {
padding-bottom: 0;
}
}
}
</style>

View file

@ -162,9 +162,15 @@ export const useProjectsStore = defineStore(STORES.PROJECTS, () => {
resourceType: 'workflow' | 'credential',
resourceId: string,
projectId: string,
shareCredentials?: string[],
) => {
if (resourceType === 'workflow') {
await workflowsEEApi.moveWorkflowToProject(rootStore.restApiContext, resourceId, projectId);
await workflowsEEApi.moveWorkflowToProject(
rootStore.restApiContext,
resourceId,
projectId,
shareCredentials,
);
await workflowsStore.fetchAllWorkflows(currentProjectId.value);
} else {
await credentialsEEApi.moveCredentialToProject(