Fix node controls so they behave independently across nodes

If one node was busy performing an action, any other nodes controls
would also be in a 'blocked and waiting' state.
This commit is contained in:
Simon Howe
2016-01-05 19:17:10 +01:00
parent 6850e840bd
commit 5b390994b8
7 changed files with 46 additions and 43 deletions

View File

@@ -155,23 +155,23 @@ export function getApiDetails() {
});
}
export function doControl(probeId, nodeId, control) {
export function doControlRequest(nodeId, control) {
clearTimeout(controlErrorTimer);
const url = `api/control/${encodeURIComponent(probeId)}/`
+ `${encodeURIComponent(nodeId)}/${control}`;
const url = `api/control/${encodeURIComponent(control.probeId)}/`
+ `${encodeURIComponent(control.nodeId)}/${control.id}`;
reqwest({
method: 'POST',
url: url,
success: function(res) {
receiveControlSuccess();
receiveControlSuccess(nodeId);
if (res && res.pipe) {
receiveControlPipe(res.pipe, nodeId, res.raw_tty, true);
}
},
error: function(err) {
receiveControlError(err.response);
receiveControlError(nodeId, err.response);
controlErrorTimer = setTimeout(function() {
clearControlError();
clearControlError(nodeId);
}, 10000);
}
});