Browse Source

fix: components loading

pull/347/head
Dr.Lt.Data 10 months ago
parent
commit
f8cf927f6d
  1. 2
      __init__.py
  2. 20
      js/components-manager.js

2
__init__.py

@ -28,7 +28,7 @@ except:
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.") print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
version = [2, 2, 4] version = [2, 2, 5]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})") print(f"### Loading: ComfyUI-Manager ({version_str})")

20
js/components-manager.js

@ -86,9 +86,8 @@ export async function load_components() {
await config.registerType(category); await config.registerType(category);
register_pack_map(name, data); register_pack_map(name, data);
break; continue;
} }
continue;
} }
let nodeData = components[name]; let nodeData = components[name];
@ -198,7 +197,7 @@ export async function load_components() {
} }
} }
async function save_as_component(node, version, prefix, nodename, packname, category) { async function save_as_component(node, version, author, prefix, nodename, packname, category) {
let component_name = `${prefix}::${nodename}`; let component_name = `${prefix}::${nodename}`;
let subgraph = app.graph.extra?.groupNodes?.[component_name]; let subgraph = app.graph.extra?.groupNodes?.[component_name];
@ -207,6 +206,7 @@ async function save_as_component(node, version, prefix, nodename, packname, cate
} }
subgraph.version = version; subgraph.version = version;
subgraph.author = author;
subgraph.datetime = Date.now(); subgraph.datetime = Date.now();
subgraph.packname = packname; subgraph.packname = packname;
subgraph.category = category; subgraph.category = category;
@ -455,7 +455,7 @@ export class ComponentBuilderDialog extends ComfyDialog {
this.element.style.display = "block"; this.element.style.display = "block";
this.element.style.zIndex = 10001; this.element.style.zIndex = 10001;
this.element.style.width = "500px"; this.element.style.width = "500px";
this.element.style.height = "450px"; this.element.style.height = "480px";
} }
invalidateControl() { invalidateControl() {
@ -467,7 +467,7 @@ export class ComponentBuilderDialog extends ComfyDialog {
this.save_button = $el("button", this.save_button = $el("button",
{ id: "cm-save-button", type: "button", textContent: "Save", onclick: () => { id: "cm-save-button", type: "button", textContent: "Save", onclick: () =>
{ {
save_as_component(self.target_node, self.version_string.value.trim(), self.node_prefix.value.trim(), save_as_component(self.target_node, self.version_string.value.trim(), self.author.value.trim(), self.node_prefix.value.trim(),
self.getNodeName(), self.getPackName(), self.category.value.trim()); self.getNodeName(), self.getPackName(), self.category.value.trim());
} }
}); });
@ -476,7 +476,6 @@ export class ComponentBuilderDialog extends ComfyDialog {
let groupNode = app.graph.extra.groupNodes[default_nodename]; let groupNode = app.graph.extra.groupNodes[default_nodename];
let default_packname = groupNode.packname; let default_packname = groupNode.packname;
if(!default_packname) { if(!default_packname) {
default_packname = ''; default_packname = '';
} }
@ -491,6 +490,11 @@ export class ComponentBuilderDialog extends ComfyDialog {
this.default_ver = '0.0'; this.default_ver = '0.0';
} }
let default_author = groupNode.author;
if(!default_author) {
default_author = '';
}
let delimiterIndex = default_nodename.indexOf('::'); let delimiterIndex = default_nodename.indexOf('::');
let default_prefix = ""; let default_prefix = "";
if(delimiterIndex != -1) { if(delimiterIndex != -1) {
@ -508,6 +512,9 @@ export class ComponentBuilderDialog extends ComfyDialog {
this.version_string = version_string[1]; this.version_string = version_string[1];
this.version_string.disabled = true; this.version_string.disabled = true;
let author = this.createLabeledInput('input author (e.g. Dr.Lt.Data)', 'Author : ', default_author);
this.author = author[1];
let node_prefix = this.createLabeledInput('input node prefix (e.g. mypack)', '*Prefix : ', default_prefix); let node_prefix = this.createLabeledInput('input node prefix (e.g. mypack)', '*Prefix : ', default_prefix);
this.node_prefix = node_prefix[1]; this.node_prefix = node_prefix[1];
@ -537,6 +544,7 @@ export class ComponentBuilderDialog extends ComfyDialog {
author_mode[0], author_mode[0],
author_mode[1], author_mode[1],
category[0], category[0],
author[0],
node_prefix[0], node_prefix[0],
manual_nodename[0], manual_nodename[0],
manual_packname[0], manual_packname[0],

Loading…
Cancel
Save