From d3b01ff64c58a50ea2c9dded0e731ff8cebd87cd Mon Sep 17 00:00:00 2001 From: BennyKok Date: Fri, 22 Dec 2023 16:07:29 +0800 Subject: [PATCH] fix(plugin): keep the config button when deploying --- web-plugin/index.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index 4fcc3f7..cdee7be 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -108,11 +108,13 @@ function addButton() { const deploy = document.createElement("button"); deploy.style.position = "relative"; deploy.style.display = "block"; - deploy.textContent = "Deploy"; + deploy.innerHTML = "
Deploy
"; deploy.onclick = async () => { /** @type {LGraph} */ const graph = app.graph; + const title = deploy.querySelector("#button-title") + const deployMeta = graph.findNodesByType("ComfyDeploy"); const deployMetaNode = deployMeta[0]; @@ -140,8 +142,8 @@ function addButton() { return; } - deploy.textContent = "Deploying..."; - deploy.style.color = "orange"; + title.innerText = "Deploying..."; + title.style.color = "orange"; console.log(prompt); @@ -170,8 +172,8 @@ function addButton() { data = await data.json(); } - deploy.textContent = "Done"; - deploy.style.color = "green"; + title.textContent = "Done"; + title.style.color = "green"; deployMetaNode.widgets[1].value = data.workflow_id; deployMetaNode.widgets[2].value = data.version; @@ -182,17 +184,17 @@ function addButton() { ); setTimeout(() => { - deploy.textContent = "Deploy"; - deploy.style.color = "white"; + title.textContent = "Deploy"; + title.style.color = "white"; }, 1000); } catch (e) { app.ui.dialog.show(e); console.error(e); - deploy.textContent = "Error"; - deploy.style.color = "red"; + title.textContent = "Error"; + title.style.color = "red"; setTimeout(() => { - deploy.textContent = "Deploy"; - deploy.style.color = "white"; + title.textContent = "Deploy"; + title.style.color = "white"; }, 1000); } };