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