",
- `A new version will be deployed, are you confirm?
Include dependence`,
+ `Confirm deployment`,
+ `
+
+
+ A new version will be deployed, do you confirm?
+
+
+
+
+
+
+
+
+
+
+
+ `,
);
if (!ok) return;
const includeDeps = document.getElementById("include-deps").checked;
+ const reuseHash = document.getElementById("reuse-hash").checked;
if (endpoint.endsWith("/")) {
endpoint = endpoint.slice(0, -1);
}
- loadingDialog.showLoading("Generating snapshot", "Please wait...");
+ loadingDialog.showLoading("Generating snapshot");
const snapshot = await fetch("/snapshot/get_current").then((x) => x.json());
// console.log(snapshot);
@@ -343,7 +361,7 @@ function addButton() {
let deps = undefined;
if (includeDeps) {
- loadingDialog.showLoading("Fetching existing version", "Please wait...");
+ loadingDialog.showLoading("Fetching existing version");
const existing_workflow = await fetch(
endpoint + "/api/workflow/" + workflow_id,
@@ -362,14 +380,35 @@ function addButton() {
loadingDialog.close();
- loadingDialog.showLoading(
- "Generating dependency graph",
- "Please wait...",
- );
+ loadingDialog.showLoading("Generating dependency graph");
deps = await generateDependencyGraph({
workflow_api: prompt.output,
snapshot: snapshot,
computeFileHash: async (file) => {
+ console.log(existing_workflow?.dependencies?.models);
+
+ // Match previous hash for models
+ if (reuseHash && existing_workflow?.dependencies?.models) {
+ const previousModelHash = Object.entries(
+ existing_workflow?.dependencies?.models,
+ ).flatMap(([key, value]) => {
+ return Object.values(value).map((x) => ({
+ ...x,
+ name: "models/" + key + "/" + x.name,
+ }));
+ });
+ console.log(previousModelHash);
+
+ const match = previousModelHash.find((x) => {
+ console.log(file, x.name);
+ return file == x.name;
+ });
+ console.log(match);
+ if (match && match.hash) {
+ console.log("cached hash used");
+ return match.hash;
+ }
+ }
console.log(file);
loadingDialog.showLoading("Generating hash", file);
const hash = await fetch(
@@ -416,7 +455,14 @@ function addButton() {
const depsOk = await confirmDialog.confirm(
"Check dependencies",
// JSON.stringify(deps, null, 2),
- createDynamicUIHtml(deps),
+ `
+
${loadingIcon}
+
`,
+ // createDynamicUIHtml(deps),
);
if (!depsOk) return;
@@ -570,12 +616,10 @@ export class InfoDialog extends ComfyDialog {
`);
}
- loadingIcon = `
`;
-
showLoading(title, message) {
this.show(`
-
${title} ${this.loadingIcon}
+ ${title} ${loadingIcon}
@@ -620,7 +664,11 @@ export class LoadingDialog extends ComfyDialog {
${title} ${
this.loadingIcon
}
- ${message ? `` : ""}
+ ${
+ message
+ ? ``
+ : ""
+ }
`);
}
@@ -739,11 +787,9 @@ export class ConfirmDialog extends InfoDialog {
return new Promise((resolve, reject) => {
this.callback = resolve;
this.show(`
-
+
${title}
-
+ ${message}
`);
});