feat(plugin): improve deploy flow
This commit is contained in:
		
							parent
							
								
									157b126fbf
								
							
						
					
					
						commit
						a6d5bde7fd
					
				@ -139,24 +139,17 @@ function addButton() {
 | 
				
			|||||||
        "Create your deployment",
 | 
					        "Create your deployment",
 | 
				
			||||||
        "Workflow name",
 | 
					        "Workflow name",
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
      if (!text) return
 | 
					      if (!text) return;
 | 
				
			||||||
      console.log(text);
 | 
					      console.log(text);
 | 
				
			||||||
      app.graph.beforeChange();
 | 
					      app.graph.beforeChange();
 | 
				
			||||||
      var node = LiteGraph.createNode("ComfyDeploy");
 | 
					      var node = LiteGraph.createNode("ComfyDeploy");
 | 
				
			||||||
      node.configure({
 | 
					      node.configure({
 | 
				
			||||||
        widgets_values: [
 | 
					        widgets_values: [text],
 | 
				
			||||||
          text
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      node.pos = [0, 0];
 | 
					      node.pos = [0, 0];
 | 
				
			||||||
      app.graph.add(node);
 | 
					      app.graph.add(node);
 | 
				
			||||||
      app.graph.afterChange();
 | 
					      app.graph.afterChange();
 | 
				
			||||||
      deployMeta=[node]
 | 
					      deployMeta = [node];
 | 
				
			||||||
      // return;
 | 
					 | 
				
			||||||
      // showError(
 | 
					 | 
				
			||||||
      //   "Error when deploying",
 | 
					 | 
				
			||||||
      //   "Unable to to find ComfyDeploy node, please add it first.",
 | 
					 | 
				
			||||||
      // );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const deployMetaNode = deployMeta[0];
 | 
					    const deployMetaNode = deployMeta[0];
 | 
				
			||||||
@ -182,6 +175,9 @@ function addButton() {
 | 
				
			|||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const ok = await confirmDialog.confirm("Confirm deployment", "A new version will be deployed, are you conform?")
 | 
				
			||||||
 | 
					    if (!ok) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    title.innerText = "Deploying...";
 | 
					    title.innerText = "Deploying...";
 | 
				
			||||||
    title.style.color = "orange";
 | 
					    title.style.color = "orange";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -226,7 +222,7 @@ function addButton() {
 | 
				
			|||||||
      graph.change();
 | 
					      graph.change();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      infoDialog.show(
 | 
					      infoDialog.show(
 | 
				
			||||||
        `<span style="color:green;">Deployed successfully!</span>  <a style="color:white;" target="_blank" href=${endpoint}/workflows/${data.workflow_id}>View here -></a> <br/> <br/> Workflow ID: ${data.workflow_id} <br/> Workflow Name: ${workflow_name} <br/> Workflow Version: ${data.version} <br/>`,
 | 
					        `<span style="color:green;">Deployed successfully!</span>  <a style="color:white;" target="_blank" href=${endpoint}/workflows/${data.workflow_id}>-> View here</a> <br/> <br/> Workflow ID: ${data.workflow_id} <br/> Workflow Name: ${workflow_name} <br/> Workflow Version: ${data.version} <br/>`,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      setTimeout(() => {
 | 
					      setTimeout(() => {
 | 
				
			||||||
@ -328,6 +324,14 @@ export class InputDialog extends InfoDialog {
 | 
				
			|||||||
          },
 | 
					          },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        [
 | 
					        [
 | 
				
			||||||
 | 
					          $el("button", {
 | 
				
			||||||
 | 
					            type: "button",
 | 
				
			||||||
 | 
					            textContent: "Close",
 | 
				
			||||||
 | 
					            onclick: () => {
 | 
				
			||||||
 | 
					              this.callback?.(undefined);
 | 
				
			||||||
 | 
					              this.close();
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          }),
 | 
				
			||||||
          $el("button", {
 | 
					          $el("button", {
 | 
				
			||||||
            type: "button",
 | 
					            type: "button",
 | 
				
			||||||
            textContent: "Save",
 | 
					            textContent: "Save",
 | 
				
			||||||
@ -342,14 +346,6 @@ export class InputDialog extends InfoDialog {
 | 
				
			|||||||
              }
 | 
					              }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
          }),
 | 
					          }),
 | 
				
			||||||
          $el("button", {
 | 
					 | 
				
			||||||
            type: "button",
 | 
					 | 
				
			||||||
            textContent: "Close",
 | 
					 | 
				
			||||||
            onclick: () => {
 | 
					 | 
				
			||||||
              this.callback?.(undefined);
 | 
					 | 
				
			||||||
              this.close()
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
          }),
 | 
					 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
@ -371,9 +367,70 @@ export class InputDialog extends InfoDialog {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const inputDialog = new InputDialog();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class ConfirmDialog extends InfoDialog {
 | 
				
			||||||
 | 
					  callback = undefined;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor() {
 | 
				
			||||||
 | 
					    super();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  createButtons() {
 | 
				
			||||||
 | 
					    return [
 | 
				
			||||||
 | 
					      $el(
 | 
				
			||||||
 | 
					        "div",
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          type: "div",
 | 
				
			||||||
 | 
					          style: {
 | 
				
			||||||
 | 
					            display: "flex",
 | 
				
			||||||
 | 
					            gap: "6px",
 | 
				
			||||||
 | 
					            justifyContent: "flex-end",
 | 
				
			||||||
 | 
					            width: "100%",
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        [
 | 
				
			||||||
 | 
					          $el("button", {
 | 
				
			||||||
 | 
					            type: "button",
 | 
				
			||||||
 | 
					            textContent: "Close",
 | 
				
			||||||
 | 
					            onclick: () => {
 | 
				
			||||||
 | 
					              this.callback?.(false);
 | 
				
			||||||
 | 
					              this.close();
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          }),
 | 
				
			||||||
 | 
					          $el("button", {
 | 
				
			||||||
 | 
					            type: "button",
 | 
				
			||||||
 | 
					            textContent: "Confirm",
 | 
				
			||||||
 | 
					            style: {
 | 
				
			||||||
 | 
					              color: "green",
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            onclick: () => {
 | 
				
			||||||
 | 
					              this.callback?.(true);
 | 
				
			||||||
 | 
					              this.close();
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          }),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					      ),
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  confirm(title, message) {
 | 
				
			||||||
 | 
					    return new Promise((resolve, reject) => {
 | 
				
			||||||
 | 
					      this.callback = resolve;
 | 
				
			||||||
 | 
					      this.show(`
 | 
				
			||||||
 | 
					      <div style="width: 400px; display: flex; gap: 18px; flex-direction: column; overflow: unset">
 | 
				
			||||||
 | 
					        <h3 style="margin: 0px;">${title}</h3>
 | 
				
			||||||
 | 
					        <label>
 | 
				
			||||||
 | 
					          ${message}
 | 
				
			||||||
 | 
					        </label>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      `);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const inputDialog = new InputDialog();
 | 
				
			||||||
export const infoDialog = new InfoDialog();
 | 
					export const infoDialog = new InfoDialog();
 | 
				
			||||||
 | 
					export const confirmDialog = new ConfirmDialog();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getData(environment) {
 | 
					function getData(environment) {
 | 
				
			||||||
  const deployOption =
 | 
					  const deployOption =
 | 
				
			||||||
@ -426,13 +483,13 @@ export class ConfigDialog extends ComfyDialog {
 | 
				
			|||||||
        [
 | 
					        [
 | 
				
			||||||
          $el("button", {
 | 
					          $el("button", {
 | 
				
			||||||
            type: "button",
 | 
					            type: "button",
 | 
				
			||||||
            textContent: "Save",
 | 
					            textContent: "Close",
 | 
				
			||||||
            onclick: () => this.save(),
 | 
					            onclick: () => this.close(),
 | 
				
			||||||
          }),
 | 
					          }),
 | 
				
			||||||
          $el("button", {
 | 
					          $el("button", {
 | 
				
			||||||
            type: "button",
 | 
					            type: "button",
 | 
				
			||||||
            textContent: "Close",
 | 
					            textContent: "Save",
 | 
				
			||||||
            onclick: () => this.close(),
 | 
					            onclick: () => this.save(),
 | 
				
			||||||
          }),
 | 
					          }),
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user