Add settling basin node, fixed issue with object assignment
This commit is contained in:
57
additional_nodes/settling-basin.html
Normal file
57
additional_nodes/settling-basin.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType("settling-basin", {
|
||||
category: "WWTP",
|
||||
color: "#e4a363",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
SVI: { value: 0.1, required: true },
|
||||
inlet: { value: 1, required: true }
|
||||
},
|
||||
inputs: 1,
|
||||
outputs: 2,
|
||||
outputLabels: ["Main effluent", "Sludge effluent"],
|
||||
icon: "font-awesome/fa-random",
|
||||
label: function() {
|
||||
return this.name || "Settling basin";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
$("#node-input-SVI").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
$("#node-input-inlet").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
let SVI = parseFloat($("#node-input-SVI").typedInput("value"));
|
||||
if (isNaN(SVI) || SVI < 0) {
|
||||
RED.notify("SVI is not set correctly", {type: "error"});
|
||||
}
|
||||
let inlet = parseInt($("#node-input-n_inlets").typedInput("value"));
|
||||
if (inlet < 1) {
|
||||
RED.notify("Number of inlets not set correctly", {type: "error"});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="settling-basin">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-SVI"><i class="fa fa-tag"></i> SVI (alternate)</label>
|
||||
<input type="text" id="node-input-SVI" placeholder="">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-inlet"><i class="fa fa-tag"></i> Assigned inlet return line</label>
|
||||
<input type="text" id="node-input-inlet" placeholder="#">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="settling-basin">
|
||||
<p>Settling tank</p>
|
||||
</script>
|
||||
Reference in New Issue
Block a user