Added restart button into the PresentationTab node so we don't have to

go to the settings menu.
This commit is contained in:
niknah
2025-10-29 09:32:32 +11:00
parent 299ad9d256
commit 2d5e6375cd
+33
View File
@@ -603,6 +603,23 @@ class PresentationTab {
});
}
restartNuxt() {
if ( this.restartingNuxt) {
console.warn('Already restarting');
return;
}
this.restartingNuxt = true;
return fetch('/custom_nodes/presentation-ComfyUI/restart', {
}).then((resp) => {
if (!resp.ok) {
return {ok:false, message:resp.statusText};
}
return resp.json();
}).finally(() => {
this.restartingNuxt = false;
});
}
checkChanges() {
return window.app.pres_origGraphToPrompt().then((promptObj) => {
if (promptObj.output) {
@@ -700,6 +717,22 @@ class PresentationTab {
console.log('presentation.save');
return t.checkChanges();
});
const restartName = 'Restart';
const restartButton = node.addWidget('button', restartName, "", async () => {
console.log('presentation.restart');
restartButton.name = '⟳ ' + restartName;
const result = await t.restartNuxt();
if (!result.ok) {
console.error('restart failed', result.message);
} else {
restartButton.name = '✓ ' + restartName;
setTimeout(() => {
restartButton.name = restartName;
}, 5000);
}
});
t.presentationNodes[node.id] = node;
node.onRemoved = () => {
delete t.presentationNodes[node.id];