mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix: Fix issue with icon themes not loading for preview nodes (#17869)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -57,6 +57,29 @@ describe('util: Node Icon', () => {
|
|||||||
getNodeIconUrl(mock<IconNodeType>({ icon: 'foo', iconUrl: undefined })),
|
getNodeIconUrl(mock<IconNodeType>({ icon: 'foo', iconUrl: undefined })),
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return the iconUrl from nodeType when using https', () => {
|
||||||
|
expect(
|
||||||
|
getNodeIconUrl(
|
||||||
|
mock<IconNodeType>({
|
||||||
|
iconUrl: 'https://my-site.com/icon.svg',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
).toBe('https://my-site.com/icon.svg');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the iconUrl from nodeType when using https with themed values', () => {
|
||||||
|
expect(
|
||||||
|
getNodeIconUrl(
|
||||||
|
mock<IconNodeType>({
|
||||||
|
iconUrl: {
|
||||||
|
light: 'https://my-site.com/light-icon.svg',
|
||||||
|
dark: 'https://my-site.com/dark-icon.svg',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
).toBe('https://my-site.com/light-icon.svg');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getBadgeIconUrl', () => {
|
describe('getBadgeIconUrl', () => {
|
||||||
|
|||||||
@@ -73,13 +73,25 @@ export function getNodeIconSource(nodeType?: IconNodeType | null): NodeIconSourc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeType.name && isNodePreviewKey(nodeType.name) && typeof nodeType.iconUrl === 'string') {
|
if (nodeType.name && isNodePreviewKey(nodeType.name)) {
|
||||||
// If node type is a node preview it would have full icon url
|
// Handle both string and object iconUrl for preview nodes
|
||||||
|
if (typeof nodeType.iconUrl === 'string') {
|
||||||
return {
|
return {
|
||||||
type: 'file',
|
type: 'file',
|
||||||
src: nodeType.iconUrl,
|
src: nodeType.iconUrl,
|
||||||
badge: undefined,
|
badge: undefined,
|
||||||
};
|
};
|
||||||
|
} else if (nodeType.iconUrl && typeof nodeType.iconUrl === 'object') {
|
||||||
|
// Use getThemedValue to get the appropriate theme URL
|
||||||
|
const themedUrl = getThemedValue(nodeType.iconUrl, useUIStore().appliedTheme);
|
||||||
|
if (themedUrl) {
|
||||||
|
return {
|
||||||
|
type: 'file',
|
||||||
|
src: themedUrl,
|
||||||
|
badge: undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconUrl = getNodeIconUrl(nodeType);
|
const iconUrl = getNodeIconUrl(nodeType);
|
||||||
|
|||||||
Reference in New Issue
Block a user