From 85868e2ea4e3ec73d5e7685a1e1251ffcd9337df Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 7 Jun 2024 14:49:24 +0200 Subject: [PATCH 1/3] fix(editor): Prevent saving already saved workflows --- packages/editor-ui/src/views/NodeView.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index b8f068abdfe5a..65c3ef1733621 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -1572,8 +1572,9 @@ export default defineComponent({ if (e.key === 's' && ctrlModifier && !readOnly) { e.stopPropagation(); e.preventDefault(); + const workflowIsSaved = !this.uiStore.stateIsDirty; - if (this.isReadOnlyRoute || this.readOnlyEnv) { + if (this.isReadOnlyRoute || this.readOnlyEnv || workflowIsSaved) { return; } From 358ba1df2e552781659906e8a60d055cbc6ac066 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 7 Jun 2024 15:02:38 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=85=20Adding=20e2e=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress/e2e/7-workflow-actions.cy.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cypress/e2e/7-workflow-actions.cy.ts b/cypress/e2e/7-workflow-actions.cy.ts index c0875d93f73f8..295e1b06b9008 100644 --- a/cypress/e2e/7-workflow-actions.cy.ts +++ b/cypress/e2e/7-workflow-actions.cy.ts @@ -36,6 +36,20 @@ describe('Workflow Actions', () => { WorkflowPage.getters.isWorkflowSaved(); }); + it.only('should not save already saved workflow', () => { + cy.intercept('PATCH', '/rest/workflows/*').as('saveWorkflow'); + WorkflowPage.actions.saveWorkflowOnButtonClick(); + WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME); + WorkflowPage.actions.saveWorkflowOnButtonClick(); + cy.wait('@saveWorkflow'); + WorkflowPage.getters.isWorkflowSaved(); + // Try to save a few times + WorkflowPage.actions.saveWorkflowUsingKeyboardShortcut(); + WorkflowPage.actions.saveWorkflowUsingKeyboardShortcut(); + // Should be saved only once + cy.get('@saveWorkflow.all').should('have.length', 1); + }); + it('should not be able to activate unsaved workflow', () => { WorkflowPage.getters.activatorSwitch().find('input').first().should('be.disabled'); }); From 4e2673874adcea4e8078be35cd746fb88648d0b3 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Mon, 10 Jun 2024 10:34:44 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=94=A5=20Removing=20leftover=20`.only?= =?UTF-8?q?`=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress/e2e/7-workflow-actions.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/7-workflow-actions.cy.ts b/cypress/e2e/7-workflow-actions.cy.ts index 295e1b06b9008..ad5164de907d7 100644 --- a/cypress/e2e/7-workflow-actions.cy.ts +++ b/cypress/e2e/7-workflow-actions.cy.ts @@ -36,7 +36,7 @@ describe('Workflow Actions', () => { WorkflowPage.getters.isWorkflowSaved(); }); - it.only('should not save already saved workflow', () => { + it('should not save already saved workflow', () => { cy.intercept('PATCH', '/rest/workflows/*').as('saveWorkflow'); WorkflowPage.actions.saveWorkflowOnButtonClick(); WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);