Skip to content
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

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading