diff --git a/packages/editor-ui/src/components/Node/NodeCreator/CategorizedItems.vue b/packages/editor-ui/src/components/Node/NodeCreator/CategorizedItems.vue index 987861fa7bd67..37ab34721d69a 100644 --- a/packages/editor-ui/src/components/Node/NodeCreator/CategorizedItems.vue +++ b/packages/editor-ui/src/components/Node/NodeCreator/CategorizedItems.vue @@ -90,6 +90,7 @@ import { INodeCreateElement, INodeItemProps, ISubcategoryItemProps, ICategoriesW import { WEBHOOK_NODE_TYPE, HTTP_REQUEST_NODE_TYPE, ALL_NODE_FILTER, TRIGGER_NODE_FILTER, REGULAR_NODE_FILTER, NODE_TYPE_COUNT_MAPPER } from '@/constants'; import { matchesNodeType, matchesSelectType } from './helpers'; import { BaseTextKey } from '@/plugins/i18n'; +import { intersection } from '@/utils'; import { sublimeSearch } from './sortUtils'; export default mixins(externalHooks, globalLinkActions).extend({ @@ -181,7 +182,10 @@ export default mixins(externalHooks, globalLinkActions).extend({ }, filteredNodeTypes(): INodeCreateElement[] { const filter = this.searchFilter; - const searchableNodes = this.subcategorizedNodes.length > 0 ? this.subcategorizedNodes : this.searchItems; + + const searchableNodes = this.subcategorizedNodes.length > 0 && this.activeSubcategory?.key !== '*' + ? this.subcategorizedNodes + : this.searchItems; let returnItems: INodeCreateElement[] = []; if (this.defaultLocale !== 'en') { @@ -196,15 +200,19 @@ export default mixins(externalHooks, globalLinkActions).extend({ } + const filteredNodeTypes = this.excludedCategories.length === 0 + ? returnItems + : this.filterOutNodexFromExcludedCategories(returnItems); + setTimeout(() => { this.$externalHooks().run('nodeCreateList.filteredNodeTypesComputed', { nodeFilter: this.nodeFilter, - result: returnItems, + result: filteredNodeTypes, selectedType: this.selectedType, }); }, 0); - return returnItems; + return filteredNodeTypes; }, filteredAllNodeTypes(): INodeCreateElement[] { if(this.filteredNodeTypes.length > 0) return []; @@ -334,6 +342,16 @@ export default mixins(externalHooks, globalLinkActions).extend({ }, }, methods: { + filterOutNodexFromExcludedCategories(nodes: INodeCreateElement[]) { + return nodes.filter(node => { + const excludedCategoriesIntersect = intersection( + this.excludedCategories, + ((node.properties as INodeItemProps)?.nodeType.codex?.categories || []), + ); + + return excludedCategoriesIntersect.length === 0; + }); + }, switchToAllTabAndFilter() { const currentFilter = this.nodeFilter; this.$store.commit('nodeCreator/setShowTabs', true); diff --git a/packages/editor-ui/src/components/Node/NodeCreator/TriggerHelperPanel.vue b/packages/editor-ui/src/components/Node/NodeCreator/TriggerHelperPanel.vue index 5d885c84e6d55..5690d536ee7bd 100644 --- a/packages/editor-ui/src/components/Node/NodeCreator/TriggerHelperPanel.vue +++ b/packages/editor-ui/src/components/Node/NodeCreator/TriggerHelperPanel.vue @@ -8,7 +8,7 @@ :initialActiveIndex="0" :searchItems="searchItems" :firstLevelItems="isRoot ? items : []" - :excludedCategories="[CORE_NODES_CATEGORY]" + :excludedCategories="isRoot ? [] : [CORE_NODES_CATEGORY]" :initialActiveCategories="[COMMUNICATION_CATEGORY]" >