From 1ba656ef4aae97c78162114ad8de533b275db280 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Mon, 24 Jun 2024 15:08:24 +0200 Subject: [PATCH] fix(editor): Properly update workflow info in main header (#9789) --- cypress/e2e/20-workflow-executions.cy.ts | 78 ++- .../src/components/MainHeader/MainHeader.vue | 328 +++++------ .../workflow/WorkflowExecutionsList.vue | 6 +- .../workflow/WorkflowExecutionsPreview.vue | 3 +- .../src/composables/useNodeHelpers.ts | 458 ++++++++++++++- .../src/composables/useWorkflowHelpers.ts | 22 + .../editor-ui/src/stores/workflows.store.ts | 26 +- packages/editor-ui/src/views/NodeView.vue | 524 ++---------------- .../src/views/WorkflowExecutionsView.vue | 36 +- 9 files changed, 780 insertions(+), 701 deletions(-) diff --git a/cypress/e2e/20-workflow-executions.cy.ts b/cypress/e2e/20-workflow-executions.cy.ts index 8a867afe1bed4..2431289761111 100644 --- a/cypress/e2e/20-workflow-executions.cy.ts +++ b/cypress/e2e/20-workflow-executions.cy.ts @@ -2,6 +2,7 @@ import type { RouteHandler } from 'cypress/types/net-stubbing'; import { WorkflowPage } from '../pages'; import { WorkflowExecutionsTab } from '../pages/workflow-executions-tab'; import executionOutOfMemoryServerResponse from '../fixtures/responses/execution-out-of-memory-server-response.json'; +import { getVisibleSelect } from '../utils'; const workflowPage = new WorkflowPage(); const executionsTab = new WorkflowExecutionsTab(); @@ -136,15 +137,90 @@ describe('Current Workflow Executions', () => { executionsTab.getters.executionListItems().eq(14).should('not.be.visible'); }); - it('should show workflow data in executions tab after hard reload', () => { + it('should show workflow data in executions tab after hard reload and modify name and tags', () => { executionsTab.actions.switchToExecutionsTab(); checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 2); + + workflowPage.getters.workflowTags().click(); + getVisibleSelect().find('li:contains("Manage tags")').click(); + cy.get('button:contains("Add new")').click(); + cy.getByTestId('tags-table').find('input').type('nutag').type('{enter}'); + cy.get('button:contains("Done")').click(); cy.reload(); checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.workflowTags().click(); + workflowPage.getters.tagsInDropdown().first().should('have.text', 'nutag').click(); + workflowPage.getters.tagPills().should('have.length', 3); + + let newWorkflowName = 'Renamed workflow'; + workflowPage.actions.renameWorkflow(newWorkflowName); + workflowPage.getters.isWorkflowSaved(); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); + + executionsTab.actions.switchToEditorTab(); + checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 3); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); + + executionsTab.actions.switchToExecutionsTab(); + checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 3); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); + + executionsTab.actions.switchToEditorTab(); + checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 3); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); + + newWorkflowName = 'New workflow'; + workflowPage.actions.renameWorkflow(newWorkflowName); + workflowPage.getters.isWorkflowSaved(); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); + workflowPage.getters.workflowTags().click(); + workflowPage.getters.tagsDropdown().find('.el-tag__close').first().click(); + cy.get('body').click(0, 0); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 2); + + executionsTab.actions.switchToExecutionsTab(); + checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 2); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); executionsTab.actions.switchToEditorTab(); checkMainHeaderELements(); + workflowPage.getters.saveButton().find('button').should('not.exist'); + workflowPage.getters.tagPills().should('have.length', 2); + workflowPage.getters + .workflowNameInputContainer() + .invoke('attr', 'title') + .should('eq', newWorkflowName); }); }); diff --git a/packages/editor-ui/src/components/MainHeader/MainHeader.vue b/packages/editor-ui/src/components/MainHeader/MainHeader.vue index 8f484042cb92d..f402412de2093 100644 --- a/packages/editor-ui/src/components/MainHeader/MainHeader.vue +++ b/packages/editor-ui/src/components/MainHeader/MainHeader.vue @@ -1,24 +1,7 @@ - - - + +