Fix group node bookmarking (#950)

* Resolves #926 group node bookmark

* Remove expect outside scope of test

* Update unit tests

* Update group node manager path separators

* Update group node path sepator in fixture
This commit is contained in:
bymyself
2024-09-24 00:26:02 -07:00
committed by GitHub
parent b21c0f59f9
commit 6b9c1b70ba
5 changed files with 77 additions and 32 deletions

View File

@@ -15,7 +15,7 @@ const Workflow = {
InWorkflow: 2
},
isInUseGroupNode(name) {
const id = `workflow/${name}`
const id = `workflow>${name}`
// Check if lready registered/in use in this workflow
if (app.graph.extra?.groupNodes?.[name]) {
if (app.graph.nodes.find((n) => n.type === id)) {
@@ -191,9 +191,9 @@ export class GroupNodeConfig {
output_name: [],
output_is_list: [],
output_is_hidden: [],
name: source + '/' + this.name,
name: source + '>' + this.name,
display_name: this.name,
category: 'group nodes' + ('/' + source),
category: 'group nodes' + ('>' + source),
input: { required: {} },
description: `Group node combining ${this.nodeData.nodes
.map((n) => n.type)
@@ -216,7 +216,7 @@ export class GroupNodeConfig {
p()
}
this.#convertedToProcess = null
await app.registerNodeDef('workflow/' + this.name, this.nodeDef)
await app.registerNodeDef('workflow>' + this.name, this.nodeDef)
useNodeDefStore().addNodeDef(this.nodeDef)
}
@@ -1380,7 +1380,7 @@ export class GroupNodeHandler {
const config = new GroupNodeConfig(name, nodeData)
await config.registerType()
const groupNode = LiteGraph.createNode(`workflow/${name}`)
const groupNode = LiteGraph.createNode(`workflow>${name}`)
// Reuse the existing nodes for this instance
groupNode.setInnerNodes(builder.nodes)
groupNode[GROUP].populateWidgets()

View File

@@ -102,7 +102,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
getGroupData() {
this.groupNodeType =
LiteGraph.registered_node_types['workflow/' + this.selectedGroup]
LiteGraph.registered_node_types['workflow>' + this.selectedGroup]
this.groupNodeDef = this.groupNodeType.nodeData
this.groupData = GroupNodeHandler.getGroupData(this.groupNodeType)
}
@@ -367,7 +367,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
groupNodes.map((g) =>
$el('option', {
textContent: g,
selected: 'workflow/' + g === type,
selected: 'workflow>' + g === type,
value: g
})
)
@@ -389,7 +389,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
{
onclick: (e) => {
const node = app.graph.nodes.find(
(n) => n.type === 'workflow/' + this.selectedGroup
(n) => n.type === 'workflow>' + this.selectedGroup
)
if (node) {
alert(
@@ -403,7 +403,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
)
) {
delete app.graph.extra.groupNodes[this.selectedGroup]
LiteGraph.unregisterNodeType('workflow/' + this.selectedGroup)
LiteGraph.unregisterNodeType('workflow>' + this.selectedGroup)
}
this.show()
}
@@ -476,7 +476,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
}, {})
}
const nodes = nodesByType['workflow/' + g]
const nodes = nodesByType['workflow>' + g]
if (nodes) recreateNodes.push(...nodes)
}
@@ -503,7 +503,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
this.element.replaceChildren(outer)
this.changeGroup(
type ? groupNodes.find((g) => 'workflow/' + g === type) : groupNodes[0]
type ? groupNodes.find((g) => 'workflow>' + g === type) : groupNodes[0]
)
this.element.showModal()