X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.gui.js;h=8c6da7ad5887b5f577ed4266191825c74f5af7f2;hb=826791abc3a3bb383c2908d7d39618b99ad7665c;hp=478e9ad30c8789f6a936c4fffd4a94b1b2737221;hpb=9fd77a6c5fdf277d6d5c17e3ced66f65f94a36f4;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 478e9ad..8c6da7a 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -3,16 +3,35 @@ */ mctx = {}; -//mctx.api = location.protocol + "/" + location.host + "/api/"; -mctx.api = "http://mctx.us.to:8080/api/"; +//Don't use this in the final version +mctx.location = window.location.pathname; +mctx.location = mctx.location.substring(0, mctx.location.lastIndexOf('/')) + "/"; +//mctx.location = location.protocol + "//" + location.host + "/"; +mctx.api = location.protocol + "//" + location.host + "/" + "api/"; mctx.expected_api_version = 0; +mctx.has_control = false; +//mctx.debug = true; + +mctx.statusCodes = { + STATUS_OK : 1 +} + +mctx.statusCodesDescription = { + "1" : "Ok", + "-1" : "General error", + "-2" : "Unauthorized", + "-3" : "Not running", + "-4" : "Already exists" +}; + mctx.sensors = { 0 : {name : "Strain gauge 1"}, 1 : {name : "Strain gauge 2"}, 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 = { @@ -22,39 +41,104 @@ mctx.actuators = { 3 : {name : "Pressure regulator"} }; +mctx.strain_gauges = {}; +mctx.strain_gauges.ids = [0, 1, 2, 3]; +mctx.strain_gauges.time_limit = 20; + +function debugLog (msg) { + if (typeof console === "undefined" || typeof console.log === "undefined") { + alert(msg); + } else { + console.log(msg); + } +} + +/** + * Writes the current date to wherever it's called. + */ function getDate(){ document.write((new Date()).toDateString()); } -/** - * Populates the navigation bar +/** + * Should be run before the load of any GUI page. + * To hook events to be called after this function runs, + * use the 'always' method, e.g runBeforeLoad().always(function() {my stuff}); + * @param {type} isLoginPage + * @returns The return value of calling $.ajax */ -$.fn.populateNavbar = function () { - var menu = $("