X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.gui.js;h=82f823cccebac137c102c43099cc253c87d3d082;hb=b689ffa3feec695339b9946a4a36c928da7114eb;hp=7c87c3790f75460345114cf573d0ab8ee1a4562a;hpb=7805efadd8cfde75fafc29a3bfa23cd3023121dc;p=matches%2FMCTX3420.git
diff --git a/testing/MCTXWeb/public_html/static/mctx.gui.js b/testing/MCTXWeb/public_html/static/mctx.gui.js
index 7c87c37..82f823c 100644
--- a/testing/MCTXWeb/public_html/static/mctx.gui.js
+++ b/testing/MCTXWeb/public_html/static/mctx.gui.js
@@ -22,7 +22,8 @@ mctx.sensors = {
2 : {name : "Strain gauge 3"},
3 : {name : "Strain gauge 4"},
4 : {name : "Pressure sensor 1"},
- 5 : {name : "Pressure sensor 2"}
+ 5 : {name : "Pressure sensor 2"},
+ 6 : {name : "Pressure sensor 3"}
};
mctx.actuators = {
@@ -55,7 +56,7 @@ $.fn.populateSubmenu = function(header, items, translator) {
var submenuHeader = $("
").append($("", {text : header, href : "#"}));
var submenu = $("", {"class" : "submenu"});
- for (item in items) {
+ for (var item in items) {
var info = translator(item, items);
submenu.append($("").append(
$("", {text : info.text,
@@ -92,7 +93,7 @@ $.fn.populateNavbar = function () {
* @returns {$.fn}
*/
$.fn.setCamera = function () {
- var url = mctx.api + "image";
+ var url = mctx.api + "image"; //http://beaglebone/api/image
var update = true;
//Stop updating if we can't retrieve an image!
@@ -178,4 +179,24 @@ $.fn.login = function () {
mctx.has_control = false;
alert("no");
});
-};
\ No newline at end of file
+};
+
+$.fn.setErrorLog = function () {
+ var url = mctx.api + "errorlog";
+ var outdiv = this;
+
+ var updater = function () {
+ $.ajax({url : url}).done(function (data) {
+ outdiv.text(data);
+ setTimeout(updater, 1000);
+ }).fail(function (jqXHR) {
+ outdiv.text("Failed to retrieve the error log.");
+ });
+ };
+
+ updater();
+};
+
+$(document).ajaxError(function (event, jqXHR) {
+ //console.log("AJAX query failed with: " + jqXHR.status + " (" + jqXHR.statusText + ")");
+});
\ No newline at end of file