mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-01-21 11:30:14 +08:00
Merge 7e2213e9b9 into c792f9277c
This commit is contained in:
commit
e203c2fd33
55
js/common.js
55
js/common.js
@ -95,8 +95,61 @@ function internalCustomConfirm(message, confirmMessage, cancelMessage) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function show_message(msg) {
|
export function addReportButton(dialogEl, options = {}) {
|
||||||
|
const contentEl = dialogEl.querySelector(".comfy-modal-content");
|
||||||
|
const closeBtnEl = contentEl?.querySelector("button");
|
||||||
|
if (!contentEl || !closeBtnEl) return;
|
||||||
|
|
||||||
|
const { msg, errorSubtype, extraFields = [] } = options;
|
||||||
|
|
||||||
|
const button = document.createElement("button");
|
||||||
|
button.textContent = "Report Error";
|
||||||
|
button.style.marginBottom = "0.25rem";
|
||||||
|
|
||||||
|
const cleanText = (text) => (text ? text.replace(/[\r\n\t\s]/g, " ") : text);
|
||||||
|
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
window["app"].extensionManager.dialog.showIssueReportDialog({
|
||||||
|
title: "Report Manager Issue",
|
||||||
|
subtitle: "Please describe the issue you are experiencing",
|
||||||
|
panelProps: {
|
||||||
|
errorType: "ManagerError",
|
||||||
|
exceptionMessage: cleanText(msg),
|
||||||
|
tags: {
|
||||||
|
errorSubtype: cleanText(errorSubtype),
|
||||||
|
isElectron: "electronAPI" in window,
|
||||||
|
},
|
||||||
|
defaultFields: ["Logs", "SystemStats"],
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
label: "ComfyUI-Manager Version",
|
||||||
|
value: "ManagerVersion", // unique ID for the field
|
||||||
|
getData: async () =>
|
||||||
|
(await api.fetchApi(`/manager/version`)).text(),
|
||||||
|
},
|
||||||
|
...extraFields,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
button.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
closeBtnEl.addEventListener("click", () => button.remove(), {
|
||||||
|
once: true,
|
||||||
|
passive: true,
|
||||||
|
});
|
||||||
|
contentEl.insertBefore(button, closeBtnEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function show_message(msg, errorReportOptions) {
|
||||||
app.ui.dialog.show(msg);
|
app.ui.dialog.show(msg);
|
||||||
|
if (errorReportOptions) {
|
||||||
|
try {
|
||||||
|
addReportButton(app.ui.dialog.element, errorReportOptions);
|
||||||
|
} catch {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
app.ui.dialog.element.style.zIndex = 1100;
|
app.ui.dialog.element.style.zIndex = 1100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -650,7 +650,17 @@ export class CustomNodesManager {
|
|||||||
show_message(title+'The information is not available.')
|
show_message(title+'The information is not available.')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
show_message(title+sanitizeHTML(res['msg']).replace(/ /g, ' ').replace(/\n/g, '<BR>'));
|
const errorReportOptions = {
|
||||||
|
msg: `Error importing '${rowItem.title}' module.`,
|
||||||
|
errorSubtype: "importError",
|
||||||
|
extraFields: [{
|
||||||
|
label: "Failed Import Info",
|
||||||
|
value: "FailedImportInfo",
|
||||||
|
getData: () => res['msg']
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
|
||||||
|
show_message(title+sanitizeHTML(res['msg']).replace(/ /g, ' ').replace(/\n/g, '<BR>'), errorReportOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,7 +1618,17 @@ export class CustomNodesManager {
|
|||||||
|
|
||||||
if (errorMsg) {
|
if (errorMsg) {
|
||||||
self.showError(errorMsg);
|
self.showError(errorMsg);
|
||||||
show_message("Installation Error:\n"+errorMsg);
|
show_message("Installation Error:\n"+errorMsg, {
|
||||||
|
msg: `Installation Error: ${errorMsg}`,
|
||||||
|
errorSubtype: `node${label}Error`,
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
label: `${label} Error Trace`,
|
||||||
|
value: `${label}ErrorsTrace`,
|
||||||
|
getData: () => errorMsg,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
self.showStatus(`${label} ${result.length} custom node(s) successfully`);
|
self.showStatus(`${label} ${result.length} custom node(s) successfully`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user