mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 21:42:37 +08:00
Added three button locations that are now selectable in the settings menu under 'Change Reboot Server Button Location' locations available are 'Menu Bar Top Icon' this places a small ⚡ in the top right corner next to settings. 'Small Button' This places the button as a small button next to View History. 'Main Menu' This places the button under Load Default on the main menu. I also added a toggle in the Settings Menu so you can choose whether it confirms you wanting to reboot the server
This commit is contained in:
parent
95f7199e14
commit
4aeca626bd
@ -46,6 +46,7 @@ export function $el(tag, propsOrChildren, children) {
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
function dragElement(dragEl, settings) {
|
||||
var posDiffX = 0,
|
||||
posDiffY = 0,
|
||||
@ -165,6 +166,7 @@ function dragElement(dragEl, settings) {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class ComfyDialog {
|
||||
@ -618,6 +620,11 @@ export class ComfyUI {
|
||||
}, [
|
||||
$el("span.drag-handle"),
|
||||
$el("span", {$: (q) => (this.queueSize = q)}),
|
||||
$el("button.comfy-reboot-server-button-icon", {id: "comfy-reboot-server-icon", textContent: "⚡", onclick: () => {
|
||||
if (!confirmReboot.value || confirm("Are you sure you'd like to reboot the server?")) {
|
||||
api.fetchApi("/reboot")
|
||||
}
|
||||
}}),
|
||||
$el("button.comfy-settings-btn", {textContent: "⚙️", onclick: () => this.settings.show()}),
|
||||
]),
|
||||
$el("button.comfy-queue-btn", {
|
||||
@ -704,6 +711,13 @@ export class ComfyUI {
|
||||
this.history.toggle();
|
||||
},
|
||||
}),
|
||||
$el("button", {
|
||||
id: "comfy-reboot-server-button-small", textContent: "Reboot Server", onclick: () => {
|
||||
if (!confirmReboot.value || confirm("Are you sure you'd like to reboot the server?")) {
|
||||
api.fetchApi("/reboot")
|
||||
}
|
||||
}
|
||||
})
|
||||
]),
|
||||
this.queue.element,
|
||||
this.history.element,
|
||||
@ -789,14 +803,16 @@ export class ComfyUI {
|
||||
}
|
||||
}),
|
||||
$el("button", {
|
||||
id: "comfy-reboot-server-button", textContent: "Reboot Server", onclick: () => {
|
||||
if (!confirmClear.value || confirm("Are you sure you'd like to reboot the server?")) {
|
||||
id: "comfy-reboot-server-button-large", textContent: "Reboot Server", onclick: () => {
|
||||
if (!confirmReboot.value || confirm("Are you sure you'd like to reboot the server?")) {
|
||||
api.fetchApi("/reboot")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
]);
|
||||
|
||||
|
||||
const devMode = this.settings.addSetting({
|
||||
id: "Comfy.DevMode",
|
||||
name: "Enable Dev mode Options",
|
||||
@ -805,6 +821,38 @@ export class ComfyUI {
|
||||
onChange: function(value) { document.getElementById("comfy-dev-save-api-button").style.display = value ? "block" : "none"},
|
||||
});
|
||||
|
||||
const changeRebootLocation = this.settings.addSetting({
|
||||
id: "Comfy.RebootLocation",
|
||||
name: "Change Reboot Server Button Location",
|
||||
type: "combo",
|
||||
options: ['Menu Bar Top Icon', 'Small Button', 'Main Menu'],
|
||||
defaultValue: 'Main Menu',
|
||||
onChange: (value) => {
|
||||
if( value == 'Menu Bar Top Icon') {
|
||||
document.querySelector('#comfy-reboot-server-icon').style.display = ""
|
||||
} else {
|
||||
document.querySelector('#comfy-reboot-server-icon').style.display = "none"
|
||||
}
|
||||
if(value == 'Small Button') {
|
||||
document.querySelector('#comfy-reboot-server-button-small').style.display = ""
|
||||
} else {
|
||||
document.querySelector('#comfy-reboot-server-button-small').style.display = "none"
|
||||
}
|
||||
if(value == 'Main Menu') {
|
||||
document.querySelector('#comfy-reboot-server-button-large').style.display = ""
|
||||
} else {
|
||||
document.querySelector('#comfy-reboot-server-button-large').style.display = "none"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const confirmReboot = this.settings.addSetting({
|
||||
id: "Comfy.ConfirmReboot",
|
||||
name: "Require confirmation when rebooting server",
|
||||
type: "boolean",
|
||||
defaultValue: true,
|
||||
});
|
||||
|
||||
dragElement(this.menuContainer, this.settings);
|
||||
|
||||
this.setStatus({exec_info: {queue_remaining: "X"}});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user