Merge pull request #4879 from node-red/fix-link-quick-add

Do not include Junction type in quick-add for virtual links
This commit is contained in:
Nick O'Leary 2024-09-13 14:58:47 +01:00 committed by GitHub
commit e6882337c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -335,13 +335,25 @@ RED.typeSearch = (function() {
}
}
function applyFilter(filter,type,def) {
return !def || !filter ||
(
(!filter.spliceMultiple) &&
(!filter.type || type === filter.type) &&
(!filter.input || type === 'junction' || def.inputs > 0) &&
(!filter.output || type === 'junction' || def.outputs > 0)
)
if (!filter) {
// No filter; allow everything
return true
}
if (type === 'junction') {
// Only allow Junction is there's no specific type filter
return !filter.type
}
if (filter.type) {
// Handle explicit type filter
return filter.type === type
}
if (!def) {
// No node definition available - allow it
return true
}
// Check if the filter is for input/outputs and apply
return (!filter.input || def.inputs > 0) &&
(!filter.output || def.outputs > 0)
}
function refreshTypeList(opts) {
var i;