From 9d0ded7ecc840fbdbb7b5360308a76ea37e47d9a Mon Sep 17 00:00:00 2001 From: bennykok Date: Sat, 24 Feb 2024 23:56:08 -0800 Subject: [PATCH] feat(plugin): display workflow name on deploy - remove 2 seconds delay - use comfy deploy for dependency viewer - display user / org label - when login with comfy deploy, ensure save and re load the current url --- web-plugin/index.js | 65 ++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index e909c70..cc2b758 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -59,8 +59,8 @@ const ext = { return; } - // Adding a delay to wait for the intial graph to load - await new Promise((resolve) => setTimeout(resolve, 2000)); + // // Adding a delay to wait for the intial graph to load + // await new Promise((resolve) => setTimeout(resolve, 2000)); workflow?.nodes.forEach((x) => { if (x?.type === "ComfyDeploy") { @@ -285,12 +285,37 @@ function addButton() { return; } + let deployMeta = graph.findNodesByType("ComfyDeploy"); + + if (deployMeta.length == 0) { + const text = await inputDialog.input( + "Create your deployment", + "Workflow name", + ); + if (!text) return; + console.log(text); + app.graph.beforeChange(); + var node = LiteGraph.createNode("ComfyDeploy"); + node.configure({ + widgets_values: [text], + }); + node.pos = [0, 0]; + app.graph.add(node); + app.graph.afterChange(); + deployMeta = [node]; + } + + const deployMetaNode = deployMeta[0]; + + const workflow_name = deployMetaNode.widgets[0].value; + const workflow_id = deployMetaNode.widgets[1].value; + const ok = await confirmDialog.confirm( `Confirm deployment`, `
- A new version will be deployed, do you confirm? + A new version of will be deployed, do you confirm?

@@ -332,31 +357,6 @@ function addButton() { const title = deploy.querySelector("#button-title"); - let deployMeta = graph.findNodesByType("ComfyDeploy"); - - if (deployMeta.length == 0) { - const text = await inputDialog.input( - "Create your deployment", - "Workflow name", - ); - if (!text) return; - console.log(text); - app.graph.beforeChange(); - var node = LiteGraph.createNode("ComfyDeploy"); - node.configure({ - widgets_values: [text], - }); - node.pos = [0, 0]; - app.graph.add(node); - app.graph.afterChange(); - deployMeta = [node]; - } - - const deployMetaNode = deployMeta[0]; - - const workflow_name = deployMetaNode.widgets[0].value; - const workflow_id = deployMetaNode.widgets[1].value; - const prompt = await app.graphToPrompt(); let deps = undefined; @@ -474,7 +474,7 @@ function addButton() {
${loadingIcon}