mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 04:44:30 +08:00
fix: 🐛 simplify set/get alerts
Now use the builtin toast api
This commit is contained in:
parent
cdbd38213f
commit
3c6bb87083
@ -28,16 +28,17 @@ function setColorAndBgColor(type) {
|
||||
this.bgcolor = colors.bgcolor;
|
||||
}
|
||||
}
|
||||
let isAlertShown = false;
|
||||
let disablePrefix = app.ui.settings.getSettingValue("KJNodes.disablePrefix")
|
||||
const LGraphNode = LiteGraph.LGraphNode
|
||||
|
||||
function showAlertWithThrottle(message, delay) {
|
||||
if (!isAlertShown) {
|
||||
isAlertShown = true;
|
||||
alert(message);
|
||||
setTimeout(() => isAlertShown = false, delay);
|
||||
}
|
||||
function showAlert(message) {
|
||||
message = message || "Set node input undefined."
|
||||
app.extensionManager.toast.add({
|
||||
severity: 'warn',
|
||||
summary: "KJ Get/Set",
|
||||
detail: `${message}. Most likely you're missing custom nodes`,
|
||||
life: 5000,
|
||||
})
|
||||
}
|
||||
app.registerExtension({
|
||||
name: "SetNode",
|
||||
@ -122,7 +123,7 @@ app.registerExtension({
|
||||
setColorAndBgColor.call(this, type);
|
||||
}
|
||||
} else {
|
||||
alert("Error: Set node input undefined. Most likely you're missing custom nodes");
|
||||
showAlert("missing link info")
|
||||
}
|
||||
}
|
||||
if (link_info && node.graph && slotType == 2 && isChangeConnect) {
|
||||
@ -134,7 +135,7 @@ app.registerExtension({
|
||||
this.outputs[0].type = type;
|
||||
this.outputs[0].name = type;
|
||||
} else {
|
||||
alert("Error: Get Set node output undefined. Most likely you're missing custom nodes");
|
||||
showAlert('node output undefined');
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,7 +486,7 @@ app.registerExtension({
|
||||
return link;
|
||||
} else {
|
||||
const errorMessage = "No SetNode found for " + this.widgets[0].value + "(" + this.type + ")";
|
||||
showAlertWithThrottle(errorMessage, 5000);
|
||||
showAlert(errorMessage);
|
||||
//throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user