mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51:14 +00:00
feat: Community Nodes in the Nodes Panel (#13923)
Co-authored-by: Dana Lee <dana@n8n.io> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -3,6 +3,7 @@ import type { IVersionNode } from '../Interface';
|
||||
import { useRootStore } from '../stores/root.store';
|
||||
import { useUIStore } from '../stores/ui.store';
|
||||
import { getThemedValue } from './nodeTypesUtils';
|
||||
import { isNodePreviewKey } from '../components/Node/NodeCreator/utils';
|
||||
|
||||
type NodeIconSourceIcon = { type: 'icon'; name: string; color?: string };
|
||||
type NodeIconSourceFile = {
|
||||
@@ -17,9 +18,9 @@ export type NodeIconType = 'file' | 'icon' | 'unknown';
|
||||
|
||||
type IconNodeTypeDescription = Pick<
|
||||
INodeTypeDescription,
|
||||
'icon' | 'iconUrl' | 'iconColor' | 'defaults' | 'badgeIconUrl'
|
||||
'icon' | 'iconUrl' | 'iconColor' | 'defaults' | 'badgeIconUrl' | 'name'
|
||||
>;
|
||||
type IconVersionNode = Pick<IVersionNode, 'icon' | 'iconUrl' | 'iconData' | 'defaults'>;
|
||||
type IconVersionNode = Pick<IVersionNode, 'icon' | 'iconUrl' | 'iconData' | 'defaults' | 'name'>;
|
||||
export type IconNodeType = IconNodeTypeDescription | IconVersionNode;
|
||||
|
||||
export const getNodeIcon = (nodeType: IconNodeType): string | null => {
|
||||
@@ -72,6 +73,15 @@ export function getNodeIconSource(nodeType?: IconNodeType | null): NodeIconSourc
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeType.name && isNodePreviewKey(nodeType.name) && typeof nodeType.iconUrl === 'string') {
|
||||
// If node type is a node preview it would have full icon url
|
||||
return {
|
||||
type: 'file',
|
||||
src: nodeType.iconUrl,
|
||||
badge: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
const iconUrl = getNodeIconUrl(nodeType);
|
||||
if (iconUrl) {
|
||||
return createFileIconSource(prefixBaseUrl(iconUrl));
|
||||
|
||||
Reference in New Issue
Block a user