From de1db927cbdc5fc8ef7d697cccbd8603f66391ea Mon Sep 17 00:00:00 2001 From: OlegIvaniv Date: Tue, 14 Mar 2023 16:41:49 +0100 Subject: [PATCH] feat(editor): Do not show actions panel for single-action nodes (#5683) --- cypress/e2e/4-node-creator.cy.ts | 25 ++++++++++++++++++++ packages/editor-ui/src/stores/nodeCreator.ts | 2 ++ 2 files changed, 27 insertions(+) diff --git a/cypress/e2e/4-node-creator.cy.ts b/cypress/e2e/4-node-creator.cy.ts index 2ef7a41c99..0057afd93c 100644 --- a/cypress/e2e/4-node-creator.cy.ts +++ b/cypress/e2e/4-node-creator.cy.ts @@ -105,6 +105,31 @@ describe('Node Creator', () => { NDVModal.getters.parameterInput('operation').should('contain.text', 'Rename'); }) + it('should not show actions for single action nodes', () => { + const singleActionNodes = [ + 'DHL', + 'iCalendar', + 'LingvaNex', + 'Mailcheck', + 'MSG91', + 'OpenThesaurus', + 'Spontit', + 'Vonage', + 'Send Email', + 'Toggl Trigger' + ] + const doubleActionNode = 'OpenWeatherMap' + + nodeCreatorFeature.actions.openNodeCreator(); + singleActionNodes.forEach((node) => { + nodeCreatorFeature.getters.searchBar().find('input').clear().type(node); + nodeCreatorFeature.getters.getCreatorItem(node).find('button[class*="panelIcon"]').should('not.exist'); + }) + nodeCreatorFeature.getters.searchBar().find('input').clear().type(doubleActionNode); + nodeCreatorFeature.getters.getCreatorItem(doubleActionNode).click(); + nodeCreatorFeature.getters.creatorItem().should('have.length', 2); + }) + describe('should correctly append manual trigger for regular actions', () => { // For these sources, manual node should be added const sourcesWithAppend = [ diff --git a/packages/editor-ui/src/stores/nodeCreator.ts b/packages/editor-ui/src/stores/nodeCreator.ts index 824f17754f..49bf4e0a58 100644 --- a/packages/editor-ui/src/stores/nodeCreator.ts +++ b/packages/editor-ui/src/stores/nodeCreator.ts @@ -56,6 +56,8 @@ const customNodeActionsParsers: { }; function filterActions(actions: INodeActionTypeDescription[]) { + // Do not show single action nodes + if (actions.length <= 1) return []; return actions.filter( (action: INodeActionTypeDescription, _: number, arr: INodeActionTypeDescription[]) => { const isApiCall = action.actionKey === CUSTOM_API_CALL_KEY;