Honor workflow versions for missing node installs

This commit is contained in:
Sam Bourne 2026-04-29 16:17:24 -07:00
parent 03272b1f70
commit 4875c35a5b

View File

@ -1412,25 +1412,30 @@ export class CustomNodesManager {
let default_version; let default_version;
let version_cnt = 0; let version_cnt = 0;
if(!is_enable) { const addVersion = (version) => {
if (!version || rowItem.originalData.active_version == version || versions.includes(version)) {
if(rowItem.cnr_latest != rowItem.originalData.active_version && obj.length > 0) { return;
versions.push('latest');
} }
if(rowItem.originalData.active_version != 'nightly') { default_version = version;
versions.push('nightly'); versions.push(version);
default_version = 'nightly'; version_cnt++;
version_cnt++; };
if(!is_enable) {
addVersion(rowItem.workflow_version);
if(rowItem.cnr_latest && rowItem.cnr_latest != 'nightly' && rowItem.cnr_latest != rowItem.originalData.active_version && obj.length > 0) {
versions.push('latest');
} }
} }
for(let v of obj) { for(let v of obj) {
if(rowItem.originalData.active_version != v.version) { addVersion(v.version);
default_version = v.version; }
versions.push(v.version);
version_cnt++; if(!is_enable && rowItem.originalData.active_version != 'nightly') {
} addVersion('nightly');
} }
this.showVersionSelectorDialog(versions, (selected_version) => { this.showVersionSelectorDialog(versions, (selected_version) => {
@ -1506,7 +1511,7 @@ export class CustomNodesManager {
this.showStatus(`${label} ${item.title} ...`); this.showStatus(`${label} ${item.title} ...`);
const data = item.originalData; const data = item.originalData;
data.selected_version = selected_version; data.selected_version = selected_version ?? item.workflow_version;
data.channel = this.channel; data.channel = this.channel;
data.mode = this.mode; data.mode = this.mode;
data.ui_id = hash; data.ui_id = hash;
@ -1750,7 +1755,7 @@ export class CustomNodesManager {
let item = this.custom_nodes[node.properties.cnr_id]; let item = this.custom_nodes[node.properties.cnr_id];
if(item) { if(item) {
hashMap[item.hash] = true; hashMap[item.hash] = this.getWorkflowVersionData(node);
} }
else { else {
console.log(`CM: cannot find '${node.properties.cnr_id}' from cnr list.`); console.log(`CM: cannot find '${node.properties.cnr_id}' from cnr list.`);
@ -1801,7 +1806,7 @@ export class CustomNodesManager {
for(let k in unresolved_aux_ids) { for(let k in unresolved_aux_ids) {
let nodepack = aux_id_to_pack[k]; let nodepack = aux_id_to_pack[k];
if(nodepack) { if(nodepack) {
hashMap[nodepack.hash] = true; hashMap[nodepack.hash] = this.getWorkflowVersionData(allUsedNodes[unresolved_aux_ids[k]]);
} }
else { else {
unresolved_missing_nodes.add(unresolved_aux_ids[k]); unresolved_missing_nodes.add(unresolved_aux_ids[k]);
@ -1816,6 +1821,18 @@ export class CustomNodesManager {
return hashMap; return hashMap;
} }
getWorkflowVersionData(node) {
const workflow_version = node?.properties?.ver?.trim?.();
if (!workflow_version || !/^\d+\.\d+(\.\d+)?([+-].*)?$/.test(workflow_version)) {
return true;
}
return {
workflow_version,
version: workflow_version,
};
}
async getMissingNodesLegacy(hashMap, missing_nodes) { async getMissingNodesLegacy(hashMap, missing_nodes) {
const mode = manager_instance.datasrc_combo.value; const mode = manager_instance.datasrc_combo.value;
this.showStatus(`Loading missing nodes (${mode}) ...`); this.showStatus(`Loading missing nodes (${mode}) ...`);
@ -2245,4 +2262,4 @@ export class CustomNodesManager {
get isVisible() { get isVisible() {
return this.element?.style?.display !== "none"; return this.element?.style?.display !== "none";
} }
} }