feat: restart ComfyUI when update/install

This commit is contained in:
Dr.Lt.Data
2023-11-26 18:36:56 +09:00
parent a1e497dc92
commit de85111a40
7 changed files with 105 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
import { app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js"
import { ComfyDialog, $el } from "../../scripts/ui.js";
import { install_checked_custom_node, manager_instance } from "./common.js";
import { install_checked_custom_node, manager_instance, rebootAPI } from "./common.js";
async function install_model(target) {
if(ModelInstaller.instance) {
@@ -55,8 +55,9 @@ export class ModelInstaller extends ComfyDialog {
this.data = null;
}
constructor() {
constructor(app, manager_dialog) {
super();
this.manager_dialog = manager_dialog;
this.search_keyword = '';
this.element = $el("div.comfy-modal", { parent: document.body }, []);
}
@@ -126,8 +127,18 @@ export class ModelInstaller extends ComfyDialog {
this.apply_searchbox(this.data);
}
updateMessage(msg) {
updateMessage(msg, btn_id) {
this.message_box.innerHTML = msg;
if(btn_id) {
const rebootButton = document.getElementById(btn_id);
const self = this;
rebootButton.onclick = function() {
if(rebootAPI()) {
self.close();
self.manager_dialog.close();
}
};
}
}
async createGrid(models_json) {