forked from p.vanderwilt/settler
Add register child function and fix whitespace
This commit is contained in:
144
settler.html
144
settler.html
@@ -1,86 +1,86 @@
|
||||
<script src="/reactor/menu.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType("settler", {
|
||||
category: "WWTP",
|
||||
color: "#e4a363",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
TS_set: { value: 0.1, required: true },
|
||||
inlet: { value: 1, required: true }
|
||||
},
|
||||
inputs: 1,
|
||||
outputs: 3,
|
||||
outputLabels: ["process", "dbase", "parent"],
|
||||
icon: "font-awesome/fa-random",
|
||||
label: function() {
|
||||
return this.name || "Settling basin";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
// wait for the menu scripts to load
|
||||
const waitForMenuData = () => {
|
||||
if (window.EVOLV?.nodes?.reactor?.initEditor) {
|
||||
window.EVOLV.nodes.reactor.initEditor(this);
|
||||
} else {
|
||||
setTimeout(waitForMenuData, 50);
|
||||
}
|
||||
};
|
||||
waitForMenuData();
|
||||
|
||||
$("#node-input-TS_set").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
$("#node-input-inlet").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
// save logger fields
|
||||
if (window.EVOLV?.nodes?.reactor?.loggerMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.reactor.loggerMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
// save position field
|
||||
if (window.EVOLV?.nodes?.measurement?.positionMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.rotatingMachine.positionMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
let TS_set = parseFloat($("#node-input-TS_set").typedInput("value"));
|
||||
if (isNaN(TS_set) || TS_set < 0) {
|
||||
RED.notify("TS 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"});
|
||||
}
|
||||
RED.nodes.registerType("settler", {
|
||||
category: "WWTP",
|
||||
color: "#e4a363",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
TS_set: { value: 0.1, required: true },
|
||||
inlet: { value: 1, required: true }
|
||||
},
|
||||
inputs: 1,
|
||||
outputs: 3,
|
||||
outputLabels: ["process", "dbase", "parent"],
|
||||
icon: "font-awesome/fa-random",
|
||||
label: function() {
|
||||
return this.name || "Settling basin";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
// wait for the menu scripts to load
|
||||
const waitForMenuData = () => {
|
||||
if (window.EVOLV?.nodes?.reactor?.initEditor) {
|
||||
window.EVOLV.nodes.reactor.initEditor(this);
|
||||
} else {
|
||||
setTimeout(waitForMenuData, 50);
|
||||
}
|
||||
});
|
||||
};
|
||||
waitForMenuData();
|
||||
|
||||
$("#node-input-TS_set").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
$("#node-input-inlet").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
// save logger fields
|
||||
if (window.EVOLV?.nodes?.reactor?.loggerMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.reactor.loggerMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
// save position field
|
||||
if (window.EVOLV?.nodes?.measurement?.positionMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.rotatingMachine.positionMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
const TS_set = parseFloat($("#node-input-TS_set").typedInput("value"));
|
||||
if (isNaN(TS_set) || TS_set < 0) {
|
||||
RED.notify("TS is not set correctly", {type: "error"});
|
||||
}
|
||||
const 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="settler">
|
||||
<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-TS_set"><i class="fa fa-tag"></i> Total Solids set point [g m-3]</label>
|
||||
<input type="text" id="node-input-TS_set" 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>
|
||||
<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-TS_set"><i class="fa fa-tag"></i> Total Solids set point [g m-3]</label>
|
||||
<input type="text" id="node-input-TS_set" 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>
|
||||
|
||||
<!-- Logger fields injected here -->
|
||||
<div id="logger-fields-placeholder"></div>
|
||||
<!-- Logger fields injected here -->
|
||||
<div id="logger-fields-placeholder"></div>
|
||||
|
||||
<!-- Position fields will be injected here -->
|
||||
<div id="position-fields-placeholder"></div>
|
||||
<!-- Position fields will be injected here -->
|
||||
<div id="position-fields-placeholder"></div>
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="settler">
|
||||
<p>Settling tank</p>
|
||||
<p>Settling tank</p>
|
||||
</script>
|
||||
Reference in New Issue
Block a user