diff --git a/cypress/e2e/7-workflow-actions.cy.ts b/cypress/e2e/7-workflow-actions.cy.ts index 0ba151f4cc3fd..362b86ee8971c 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('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'); }); diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 3cd20391760da..8189058d27ced 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; }