Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
6944288a
"vscode:/vscode.git/clone" did not exist on "8ad06b7c13871dc08e985a61ef35d69c0a23bd6d"
Unverified
Commit
6944288a
authored
Aug 29, 2023
by
Michael Poutre
Browse files
refactor(ui): Switch statement, and handle other modes in group actions
parent
e30d546e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
52 deletions
+83
-52
web/extensions/core/groupOptions.js
web/extensions/core/groupOptions.js
+83
-52
No files found.
web/extensions/core/groupOptions.js
View file @
6944288a
...
...
@@ -40,15 +40,18 @@ app.registerExtension({
// Modes
// 0: Always
// 1: On Event
// 2: Never
// 3: On Trigger
// 4: Bypass
// If all nodes are the same mode, add a menu option to change the mode
if
(
allNodesAreSameMode
)
{
const
mode
=
nodesInGroup
[
0
].
mode
;
switch
(
mode
)
{
case
0
:
// All nodes are always, option to disable, and bypass
if
(
mode
===
0
)
{
options
.
push
({
content
:
"
Disable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Never
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
2
);
...
...
@@ -62,12 +65,12 @@ app.registerExtension({
setNodeMode
(
node
,
4
);
}
}
})
}
});
break
;
case
2
:
// All nodes are never, option to enable, and bypass
if
(
mode
===
2
)
{
options
.
push
({
content
:
"
Enable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Always
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
0
);
...
...
@@ -81,12 +84,12 @@ app.registerExtension({
setNodeMode
(
node
,
4
);
}
}
})
}
});
break
;
case
4
:
// All nodes are bypass, option to enable, and disable
if
(
mode
===
4
)
{
options
.
push
({
content
:
"
Enable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Always
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
0
);
...
...
@@ -94,18 +97,46 @@ app.registerExtension({
}
});
options
.
push
({
content
:
"
Disable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Never
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
2
);
}
}
})
});
break
;
default
:
// All nodes are On Trigger or On Event(Or other?), option to disable, set to always, or bypass
options
.
push
({
content
:
"
Set Group Nodes to Always
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
0
);
}
}
});
options
.
push
({
content
:
"
Set Group Nodes to Never
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
2
);
}
}
});
options
.
push
({
content
:
"
Bypass Group Nodes
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
4
);
}
}
});
break
;
}
}
else
{
// Nodes are not all the same mode, add a menu option to change the mode to always, never, or bypass
options
.
push
({
content
:
"
Enable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Always
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
0
);
...
...
@@ -113,7 +144,7 @@ app.registerExtension({
}
});
options
.
push
({
content
:
"
Disable
Group Nodes
"
,
content
:
"
Set
Group Nodes
to Never
"
,
callback
:
()
=>
{
for
(
const
node
of
nodesInGroup
)
{
setNodeMode
(
node
,
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment