diff --git a/custom_routes.py b/custom_routes.py
index e397ee7..9fba6a7 100644
--- a/custom_routes.py
+++ b/custom_routes.py
@@ -849,7 +849,7 @@ async def proxy_to_comfydeploy(request):
# Construct the full target URL with query parameters
target_url = f"{base_url}?{query_params}" if query_params else base_url
- print(f"Proxying request to: {target_url}")
+ # print(f"Proxying request to: {target_url}")
try:
# Create a new ClientSession for each request
diff --git a/web-plugin/index.js b/web-plugin/index.js
index 4d2c82c..d269693 100644
--- a/web-plugin/index.js
+++ b/web-plugin/index.js
@@ -498,6 +498,7 @@ function createDynamicUIHtml(data) {
return html;
}
+// Modify the existing deployWorkflow function
async function deployWorkflow() {
const deploy = document.getElementById("deploy-button");
@@ -770,6 +771,14 @@ async function deployWorkflow() {
`Deployed successfully! -> View here
Workflow ID: ${data.workflow_id}
Workflow Name: ${workflow_name}
Workflow Version: ${data.version}
`,
);
+ // // Refresh the workflows list in the sidebar
+ // const sidebarEl = document.querySelector(
+ // '.comfy-sidebar-tab[data-id="search"]',
+ // );
+ // if (sidebarEl) {
+ // refreshWorkflowsList(sidebarEl);
+ // }
+
setTimeout(() => {
title.textContent = "Deploy";
title.style.color = "white";
@@ -787,6 +796,85 @@ async function deployWorkflow() {
}
}
+// Add this function to refresh the workflows list
+function refreshWorkflowsList(el) {
+ const workflowsList = el.querySelector("#workflows-list");
+ const workflowsLoading = el.querySelector("#workflows-loading");
+
+ workflowsLoading.style.display = "flex";
+ workflowsList.style.display = "none";
+ workflowsList.innerHTML = "";
+
+ client.workflows
+ .getAll({
+ page: "1",
+ pageSize: "10",
+ })
+ .then((result) => {
+ workflowsLoading.style.display = "none";
+ workflowsList.style.display = "block";
+
+ if (result.length === 0) {
+ workflowsList.innerHTML =
+ "
No workflows found";
+ return;
+ }
+
+ result.forEach((workflow) => {
+ const li = document.createElement("li");
+ li.style.marginBottom = "15px";
+ li.style.padding = "15px";
+ li.style.backgroundColor = "#2a2a2a";
+ li.style.borderRadius = "8px";
+ li.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)";
+
+ const lastRun = workflow.runs[0];
+ const lastRunStatus = lastRun ? lastRun.status : "No runs";
+ const statusColor =
+ lastRunStatus === "success"
+ ? "#4CAF50"
+ : lastRunStatus === "error"
+ ? "#F44336"
+ : "#FFC107";
+
+ const timeAgo = getTimeAgo(new Date(workflow.updatedAt));
+
+ li.innerHTML = `
+
+
+ ${workflow.name}
+
+
Last run: ${lastRunStatus}
+
+ Last updated ${timeAgo}
+
+
+
+
+ `;
+
+ const openCloudBtn = li.querySelector(".open-cloud-btn");
+ openCloudBtn.onclick = () =>
+ window.open(
+ `${getData().endpoint}/workflows/${workflow.id}?workspace=true`,
+ "_blank",
+ );
+
+ const loadApiBtn = li.querySelector(".load-api-btn");
+ loadApiBtn.onclick = () => loadWorkflowApi(workflow.versions[0].id);
+
+ workflowsList.appendChild(li);
+ });
+ })
+ .catch((error) => {
+ console.error("Error fetching workflows:", error);
+ workflowsLoading.style.display = "none";
+ workflowsList.style.display = "block";
+ workflowsList.innerHTML =
+ "Error fetching workflows";
+ });
+}
+
function addButton() {
const menu = document.querySelector(".comfy-menu");
@@ -1299,7 +1387,10 @@ app.extensionManager.registerSidebarTab({
Your Workflows
-
+
+ ${loadingIcon}
+
+
@@ -1325,6 +1416,8 @@ app.extensionManager.registerSidebarTab({
deployButton.innerHTML = ``;
deployButton.onclick = async () => {
await deployWorkflow();
+ // Refresh the workflows list after deployment
+ refreshWorkflowsList(el);
};
deployContainer.appendChild(deployButton);
@@ -1350,63 +1443,9 @@ app.extensionManager.registerSidebarTab({
// Fetch and display workflows
const workflowsList = el.querySelector("#workflows-list");
- client.workflows
- .getAll({
- page: "1",
- pageSize: "10",
- })
- .then((result) => {
- result.forEach((workflow) => {
- const li = document.createElement("li");
- li.style.marginBottom = "15px";
- li.style.padding = "15px";
- li.style.backgroundColor = "#2a2a2a";
- li.style.borderRadius = "8px";
- li.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)";
+ const workflowsLoading = el.querySelector("#workflows-loading");
- const lastRun = workflow.runs[0];
- const lastRunStatus = lastRun ? lastRun.status : "No runs";
- const statusColor =
- lastRunStatus === "success"
- ? "#4CAF50"
- : lastRunStatus === "error"
- ? "#F44336"
- : "#FFC107";
-
- const timeAgo = getTimeAgo(new Date(workflow.updatedAt));
-
- li.innerHTML = `
-
-
- ${workflow.name}
-
-
Last run: ${lastRunStatus}
-
- Last updated ${timeAgo}
-
-
-
-
- `;
-
- const openCloudBtn = li.querySelector(".open-cloud-btn");
- openCloudBtn.onclick = () =>
- window.open(
- `${getData().endpoint}/workflows/${workflow.id}?workspace=true`,
- "_blank",
- );
-
- const loadApiBtn = li.querySelector(".load-api-btn");
- loadApiBtn.onclick = () => loadWorkflowApi(workflow.versions[0].id);
-
- workflowsList.appendChild(li);
- });
- })
- .catch((error) => {
- console.error("Error fetching workflows:", error);
- workflowsList.innerHTML =
- "Error fetching workflows";
- });
+ refreshWorkflowsList(el);
},
});