fix(editor): Remove template creds setup from workflow when copied (no-changelog) (#9673)

This commit is contained in:
Tomi Turtiainen 2024-06-10 13:36:42 +03:00 committed by GitHub
parent b0b4093072
commit 1e15f73b0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View file

@ -34,7 +34,7 @@ describe('Template credentials setup', () => {
});
cy.intercept('GET', '**/rest/settings', (req) => {
// Disable cache
delete req.headers['if-none-match']
delete req.headers['if-none-match'];
req.reply((res) => {
if (res.body.data) {
// Disable custom templates host if it has been overridden by another intercept
@ -117,6 +117,7 @@ describe('Template credentials setup', () => {
const workflow = JSON.parse(workflowJSON);
expect(workflow.meta).to.haveOwnProperty('templateId', testTemplate.id.toString());
expect(workflow.meta).not.to.haveOwnProperty('templateCredsSetupCompleted');
workflow.nodes.forEach((node: any) => {
expect(Object.keys(node.credentials ?? {})).to.have.lengthOf(1);
});

View file

@ -260,7 +260,7 @@ export interface IWorkflowDataUpdate {
}
export interface IWorkflowToShare extends IWorkflowDataUpdate {
meta?: WorkflowMetadata;
meta: WorkflowMetadata;
}
export interface NewWorkflowResponse {

View file

@ -403,7 +403,7 @@ async function onWorkflowMenuSelect(action: WORKFLOW_MENU_ACTIONS): Promise<void
const exportData: IWorkflowToShare = {
...data,
meta: {
...(props.workflow.meta ?? {}),
...props.workflow.meta,
instanceId: rootStore.instanceId,
},
tags: (tags ?? []).map((tagId) => {

View file

@ -1997,12 +1997,14 @@ export default defineComponent({
void this.getNodesToSave(nodes).then((data) => {
const workflowToCopy: IWorkflowToShare = {
meta: {
...(this.workflowsStore.workflow.meta ?? {}),
...this.workflowsStore.workflow.meta,
instanceId: this.rootStore.instanceId,
},
...data,
};
delete workflowToCopy.meta.templateCredsSetupCompleted;
this.workflowHelpers.removeForeignCredentialsFromWorkflow(
workflowToCopy,
this.credentialsStore.allCredentials,