fix loading

This commit is contained in:
cenfun 2024-06-05 21:13:46 +08:00
parent 3a7f495c96
commit da5b12aa2d

View File

@ -430,7 +430,7 @@ export class CustomNodesManager {
const installGroups = { const installGroups = {
"Disabled": ["enable", "uninstall"], "Disabled": ["enable", "uninstall"],
"Update": ["update", "disable", "uninstall"], "Update": ["update", "disable", "uninstall"],
"Fail": ["try-fix"], "Fail": ["try-fix", "uninstall"],
"True": ["try-update", "disable", "uninstall"], "True": ["try-update", "disable", "uninstall"],
"False": ["install"], "False": ["install"],
'None': ["try-install"] 'None': ["try-install"]
@ -982,6 +982,14 @@ export class CustomNodesManager {
const res = await api.fetchApi(route, options).catch(e => { const res = await api.fetchApi(route, options).catch(e => {
err = e; err = e;
}); });
if (!res) {
return {
status: 400,
error: new Error("Unknown Error")
}
}
const { status, statusText } = res; const { status, statusText } = res;
if (err) { if (err) {
return { return {
@ -993,7 +1001,7 @@ export class CustomNodesManager {
if (status !== 200) { if (status !== 200) {
return { return {
status, status,
error: new Error(statusText) error: new Error(statusText || "Unknown Error")
} }
} }
@ -1340,9 +1348,13 @@ export class CustomNodesManager {
$elem.setAttribute("disabled", "disabled"); $elem.setAttribute("disabled", "disabled");
} else { } else {
$elem.removeAttribute("disabled"); $elem.removeAttribute("disabled");
$elem.classList.remove("cn-btn-loading");
} }
}); });
Array.from(this.element.querySelectorAll(".cn-btn-loading")).forEach($elem => {
$elem.classList.remove("cn-btn-loading");
});
} }
showRestart() { showRestart() {