Skip to content
/ qp-n8n Public
forked from n8n-io/n8n

Commit

Permalink
feat(editor): Do not show actions panel for single-action nodes (n8n-…
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegIvaniv authored and sunilrr committed Apr 24, 2023
1 parent 5251c60 commit 17c21e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/4-node-creator.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions packages/editor-ui/src/stores/nodeCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 17c21e1

Please sign in to comment.