2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- Load the dynamic menu & config endpoints -->
|
|
|
|
|
|
<script src="/monster/menu.js"></script>
|
|
|
|
|
|
<script src="/monster/configData.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
RED.nodes.registerType("monster", {
|
|
|
|
|
|
category: "EVOLV",
|
|
|
|
|
|
color: "#4f8582",
|
|
|
|
|
|
defaults: {
|
|
|
|
|
|
|
|
|
|
|
|
// Define specific properties
|
|
|
|
|
|
samplingtime: { value: 0 },
|
|
|
|
|
|
minvolume: { value: 5 },
|
|
|
|
|
|
maxweight: { value: 22 },
|
|
|
|
|
|
emptyWeightBucket: { value: 3 },
|
|
|
|
|
|
aquon_sample_name: { value: "" },
|
|
|
|
|
|
|
|
|
|
|
|
//define asset properties
|
|
|
|
|
|
uuid: { value: "" },
|
|
|
|
|
|
supplier: { value: "" },
|
|
|
|
|
|
category: { value: "" },
|
|
|
|
|
|
assetType: { value: "" },
|
|
|
|
|
|
model: { value: "" },
|
|
|
|
|
|
unit: { value: "" },
|
|
|
|
|
|
|
|
|
|
|
|
//logger properties
|
|
|
|
|
|
enableLog: { value: false },
|
|
|
|
|
|
logLevel: { value: "error" },
|
|
|
|
|
|
|
|
|
|
|
|
//physicalAspect
|
|
|
|
|
|
positionVsParent: { value: "" },
|
|
|
|
|
|
positionIcon: { value: "" },
|
|
|
|
|
|
hasDistance: { value: false },
|
|
|
|
|
|
distance: { value: 0 },
|
|
|
|
|
|
distanceUnit: { value: "m" },
|
|
|
|
|
|
distanceDescription: { value: "" }
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
inputs: 1,
|
2025-10-13 10:06:08 +02:00
|
|
|
|
outputs: 3,
|
|
|
|
|
|
inputLabels: ["Input"],
|
|
|
|
|
|
outputLabels: ["process", "dbase", "parent"],
|
|
|
|
|
|
icon: "font-awesome/fa-tachometer",
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
label: function () {
|
|
|
|
|
|
return this.positionIcon + " " + this.category.slice(0, -1) || "Monster";
|
2025-05-14 10:08:34 +02:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
oneditprepare: function() {
|
2025-10-13 10:06:08 +02:00
|
|
|
|
// wait for the menu scripts to load
|
|
|
|
|
|
const waitForMenuData = () => {
|
|
|
|
|
|
if (window.EVOLV?.nodes?.monster?.initEditor) {
|
|
|
|
|
|
window.EVOLV.nodes.monster.initEditor(this);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setTimeout(waitForMenuData, 50);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
waitForMenuData();
|
|
|
|
|
|
|
|
|
|
|
|
// your existing project‐settings & asset dropdown logic can remain here
|
|
|
|
|
|
document.getElementById("node-input-samplingtime");
|
|
|
|
|
|
document.getElementById("node-input-minvolume");
|
|
|
|
|
|
document.getElementById("node-input-maxweight");
|
|
|
|
|
|
document.getElementById("node-input-emptyWeightBucket");
|
|
|
|
|
|
document.getElementById("node-input-aquon_sample_name");
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
oneditsave: function() {
|
2025-10-13 10:06:08 +02:00
|
|
|
|
const node = this;
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
// save asset fields
|
|
|
|
|
|
if (window.EVOLV?.nodes?.monster?.assetMenu?.saveEditor) {
|
|
|
|
|
|
window.EVOLV.nodes.monster.assetMenu.saveEditor(this);
|
2025-05-14 10:08:34 +02:00
|
|
|
|
}
|
2025-10-13 10:06:08 +02:00
|
|
|
|
// save logger fields
|
|
|
|
|
|
if (window.EVOLV?.nodes?.monster?.loggerMenu?.saveEditor) {
|
|
|
|
|
|
window.EVOLV.nodes.monster.loggerMenu.saveEditor(this);
|
2025-05-14 10:08:34 +02:00
|
|
|
|
}
|
2025-10-13 10:06:08 +02:00
|
|
|
|
// save position field
|
|
|
|
|
|
if (window.EVOLV?.nodes?.monster?.positionMenu?.saveEditor) {
|
|
|
|
|
|
window.EVOLV.nodes.monster.positionMenu.saveEditor(this);
|
2025-05-14 10:08:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
["samplingtime", "minvolume", "maxweight", "emptyWeightBucket"].forEach((field) => {
|
|
|
|
|
|
const element = document.getElementById(`node-input-${field}`);
|
|
|
|
|
|
const value = parseFloat(element?.value) || 0;
|
|
|
|
|
|
console.log(`----------------> Saving ${field}: ${value}`);
|
|
|
|
|
|
node[field] = value;
|
|
|
|
|
|
});
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
["aquon_sample_name"].forEach((field) => {
|
|
|
|
|
|
const element = document.getElementById(`node-input-${field}`);
|
|
|
|
|
|
const value = element?.value || "";
|
|
|
|
|
|
console.log(`----------------> Saving ${field}: ${value}`);
|
|
|
|
|
|
node[field] = value;
|
|
|
|
|
|
});
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
}
|
2025-10-13 10:06:08 +02:00
|
|
|
|
});
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- Main UI Template -->
|
2025-05-14 10:08:34 +02:00
|
|
|
|
<script type="text/html" data-template-name="monster">
|
|
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- speficic input -->
|
2025-05-14 10:08:34 +02:00
|
|
|
|
<div class="form-row">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<label for="node-input-samplingtime"><i class="fa fa-clock-o"></i> Sampling time (h)</label>
|
|
|
|
|
|
<input type="number" id="node-input-samplingtime" style="width:60%;" />
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-row">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<label for="node-input-minvolume"><i class="fa fa-clock-o"></i> Min volume (L)</label>
|
|
|
|
|
|
<input type="number" id="node-input-minvolume" style="width:60%;" />
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-row">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<label for="node-input-maxweight"><i class="fa fa-clock-o"></i> Max weight (kg)</label>
|
|
|
|
|
|
<input type="number" id="node-input-maxweight" style="width:60%;" />
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-row">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<label for="node-input-emptyWeightBucket"><i class="fa fa-clock-o"></i> Empty weight of bucket (kg)</label>
|
|
|
|
|
|
<input type="number" id="node-input-emptyWeightBucket" style="width:60%;" />
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="form-row">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<label for="node-input-aquon_sample_name"><i class="fa fa-clock-o"></i> Aquon sample name</label>
|
|
|
|
|
|
<input type="text" id="node-input-aquon_sample_name" style="width:60%;" />
|
2025-05-14 10:08:34 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- Asset fields injected here -->
|
|
|
|
|
|
<div id="asset-fields-placeholder"></div>
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- Logger fields injected here -->
|
|
|
|
|
|
<div id="logger-fields-placeholder"></div>
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<!-- Position fields injected here -->
|
|
|
|
|
|
<div id="position-fields-placeholder"></div>
|
2025-05-14 10:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/html" data-help-name="monster">
|
2025-10-13 10:06:08 +02:00
|
|
|
|
<p><b>Monster node</b>: Configure a monster asset.</p>
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</script>
|