started updates
This commit is contained in:
+10
-3
@@ -116,7 +116,7 @@ jsPlumb.ready(function() {
|
||||
connection.getOverlay("label").setLabel(connection.endpoints[0].getParameter('name'));
|
||||
};
|
||||
|
||||
var addEndpoints = function(divId, anchors, needConnections) {
|
||||
var addEndpoints = function(divId, anchors, needConnections, needUpdates) {
|
||||
for (var i = 0; i < anchors.length; i++) {
|
||||
var anchor = anchors[i];
|
||||
var anchUUID = divId + anchor.name;
|
||||
@@ -136,10 +136,15 @@ jsPlumb.ready(function() {
|
||||
if (anchor.hasOwnProperty('connectWith') && needConnections) {
|
||||
needConnections.push(new Array(anchUUID).concat(anchor.connectWith)); // to-circuit, to-endpoint[, item-circuit, item-name[, item-parts]]
|
||||
}
|
||||
instance.addEndpoint(divId, endpoint, {
|
||||
var endp = instance.addEndpoint(divId, endpoint, {
|
||||
anchor: anchor.anchor, uuid: anchUUID,
|
||||
parameters:{name:anchor.name, priority:anchor.priority}
|
||||
});
|
||||
if (anchor.hasOwnProperty('update') && needUpdates) {
|
||||
var update = anchor.update;
|
||||
update.endpoint = endp;
|
||||
needUpdates.push(update);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -399,8 +404,9 @@ jsPlumb.ready(function() {
|
||||
}
|
||||
// add endpoints
|
||||
var needConnections = new Array();
|
||||
var needUpdates = new Array();
|
||||
for (var i=0; i<needEndpoints.length; i++) {
|
||||
addEndpoints(needEndpoints[i].name, needEndpoints[i].endpoints, needConnections);
|
||||
addEndpoints(needEndpoints[i].name, needEndpoints[i].endpoints, needConnections, needUpdates);
|
||||
}
|
||||
// establish connections
|
||||
var connectionItems = new Array();
|
||||
@@ -454,6 +460,7 @@ jsPlumb.ready(function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO needUpdates
|
||||
// request all shown values and enable automatic polling
|
||||
for (var i=0; i<needUris.length; i++) {
|
||||
new Ajax.Request('/data/'+needUris[i]+'?exact&poll=2',{
|
||||
|
||||
+14
-14
@@ -20,12 +20,12 @@
|
||||
"image": "valve.svg",
|
||||
"endpoints": [
|
||||
{"name": "Flow", "anchor": "Top", "target": true, "connectWith": ["ehp", "HcFlow", "ehp", "FlowTemp", "0"]},
|
||||
{"name": "HwcFlow", "anchor": "Right", "connectWith": ["storage", "HwcInput"], "updates": [
|
||||
{"name": "HwcFlow", "anchor": "Right", "connectWith": ["storage", "HwcInput"], "update":
|
||||
{"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]}
|
||||
]},
|
||||
{"name": "HcFlow", "anchor": "Left", "connectWith": ["storage", "HcInput", "ehp", "HcFlowTemp", "0"], "updates": [
|
||||
},
|
||||
{"name": "HcFlow", "anchor": "Left", "connectWith": ["storage", "HcInput", "ehp", "HcFlowTemp", "0"], "update":
|
||||
{"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]}
|
||||
]}
|
||||
}
|
||||
],
|
||||
"items": [
|
||||
{"circuit": "ehp", "name": "HwcHcValve", "topc": 0.5, "leftc": 0.5}
|
||||
@@ -88,21 +88,21 @@
|
||||
}
|
||||
],
|
||||
"endpoints": [
|
||||
{"name": "SourceOutput", "anchor": [0.12, 0, 0, -1], "label": "Source", "updates": [
|
||||
{"name": "SourceOutput", "anchor": [0.12, 0, 0, -1], "label": "Source", "update":
|
||||
{"type": ["cold", "off"], "condition": [["ehp", "Source", "on"]]}
|
||||
]},
|
||||
{"name": "SourceInput", "anchor": [0.22, 0, 0, -1], "target": true, "label": "Source", "distance": [0,60], "updates": [
|
||||
},
|
||||
{"name": "SourceInput", "anchor": [0.22, 0, 0, -1], "target": true, "label": "Source", "distance": [0,60], "update":
|
||||
{"type": ["hot", "off"], "condition": [["ehp", "Source", "on"]]}
|
||||
]},
|
||||
{"name": "HwcReturn", "anchor": [0.53, 0, 0, -1], "target": true, "distance": [0,80,0.3], "connectWith": ["storage", "HwcOutput"], "updates": [
|
||||
},
|
||||
{"name": "HwcReturn", "anchor": [0.53, 0, 0, -1], "target": true, "distance": [0,80,0.3], "connectWith": ["storage", "HwcOutput"], "update":
|
||||
{"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]}
|
||||
]},
|
||||
{"name": "HcReturn", "anchor": [0.78, 0, 0, -1], "target": true, "distance": [0,60,0.42], "connectWith": ["storage", "HcOutput", "ehp", "HcReturnTemp", "0"], "updates": [
|
||||
},
|
||||
{"name": "HcReturn", "anchor": [0.78, 0, 0, -1], "target": true, "distance": [0,60,0.42], "connectWith": ["storage", "HcOutput", "ehp", "HcReturnTemp", "0"], "update":
|
||||
{"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]}
|
||||
]},
|
||||
{"name": "HcFlow", "anchor": [0.88, 0, 0, -1], "priority": 1, "updates": [
|
||||
},
|
||||
{"name": "HcFlow", "anchor": [0.88, 0, 0, -1], "priority": 1, "update":
|
||||
{"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"]]}
|
||||
]}
|
||||
}
|
||||
],
|
||||
"items": [
|
||||
{"name": "SourcePress", "parts": "0", "topc": 0.2, "left": 0.01},
|
||||
|
||||
Reference in New Issue
Block a user