X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.control.js;h=f414a82fc327dd88fec5d67c1aee328945808bed;hb=710a022bd34d8d72bc588fca421ad25658fabd5b;hp=24b0448f204380cba8e63d6205888b066f73998d;hpb=19c48bb0707a0a92aa713e125cbd070295621383;p=matches%2FMCTX3420.git diff --git a/testing/MCTXWeb/public_html/static/mctx.control.js b/testing/MCTXWeb/public_html/static/mctx.control.js index 24b0448..f414a82 100644 --- a/testing/MCTXWeb/public_html/static/mctx.control.js +++ b/testing/MCTXWeb/public_html/static/mctx.control.js @@ -26,6 +26,43 @@ function toggleControls(running) { } } +function setSampleRate(id, val, result) { + var n = Number(val); + if (isNaN(n) || n < 0) { + result.text("You must give positive numeric values.").addClass("fail"); + return; + } + + $.ajax({ + url : mctx.api + 'sensors', + data : {id : id, sample_s : n} + }).done(function(data) { + if (!result.checkStatus(data)) { + return; + } + + result.text("Set ok!").removeClass("fail").addClass("pass"); + }); +}; + +$.fn.loadSensorList = function (result, input) { + var select = this; + select.empty(); //Reset list + + $.ajax({ + url : mctx.api + 'identify', + data : {'sensors' : 1} + }).done(function(data) { + if (!result.checkStatus(data)) { + return; + } + for (var id in data.sensors) { + var option = $("