Skip to content

Commit

Permalink
fix(editor): Remove template creds setup from workflow when copied (n…
Browse files Browse the repository at this point in the history
…o-changelog) (#9673)
  • Loading branch information
tomi authored Jun 10, 2024
1 parent b0b4093 commit 1e15f73
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cypress/e2e/34-template-credentials-setup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export interface IWorkflowDataUpdate {
}

export interface IWorkflowToShare extends IWorkflowDataUpdate {
meta?: WorkflowMetadata;
meta: WorkflowMetadata;
}

export interface NewWorkflowResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1e15f73

Please sign in to comment.