From 3fbcf26d59e6cd7e8c10cb4f3ae912810c6d8d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Pu=C5=A1nik?= Date: Fri, 11 Dec 2015 18:43:09 +0100 Subject: Fix URL for mobile apps to properly show pictures/resources within hint/plan; raising the pg version to 1.0; --- js/codeq/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/codeq') diff --git a/js/codeq/core.js b/js/codeq/core.js index 28767f7..cb6f54c 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -307,7 +307,7 @@ along with this program. If not, see . */ traversedPath.push(fragment); if (branch[resourceName]) candidate = traversedPath.join('/') + '/' + resourceName; } - if (candidate) return candidate; + if (candidate) return codeq.ajaxPrefix + candidate; codeq.log.error('Resource ' + resourceName + ' was not found; path: "' + resourceBranches.join('/') + '"'); return null; }; -- cgit v1.2.1 From 2d4b5b535c2a3df875a0a3c97cdd25ed67275b29 Mon Sep 17 00:00:00 2001 From: Robert Zorko Date: Mon, 14 Dec 2015 15:55:39 +0100 Subject: fixed the bug with the overlay not beeing hidden after server times out --- js/codeq/core.js | 10 +++++++--- js/codeq/navigation.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'js/codeq') diff --git a/js/codeq/core.js b/js/codeq/core.js index cb6f54c..22f6a50 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -610,9 +610,13 @@ along with this program. If not, see . */ codeq.log.info('App reset: ' + (reason || 'no reason given')); codeq.globalStateMachine.transition('login'); codeq.wait( - codeq.comms.logout() - .finally(codeq.comms.disconnect) - .fail(function () {}) // ignore errors + codeq.comms.getSid() == null ? Q() : codeq.comms.logout() + .finally( + codeq.comms.disconnect + ) + .fail(function (e) { + codeq.log.debug(e) + }) // ignore errors ) .then(function () { if (reason) { diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js index da2b04a..62344e5 100644 --- a/js/codeq/navigation.js +++ b/js/codeq/navigation.js @@ -91,9 +91,9 @@ along with this program. If not, see . */ name = 'login';//this will cause the following code to transition to the login state instead of the original one given } - var newState = def[name];//if the newState is not the same as the old or if it doesn't exist at all is already checked at this point if (currState) currState.exit(); + currState = newState; currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1])); } -- cgit v1.2.1 From 7de6dca9112d292803b801e0d370c45b0ca0eb13 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 14 Dec 2015 20:25:32 +0100 Subject: Improve robot screen --- js/codeq/robot.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'js/codeq') diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 0dca6f3..d4fcfcf 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -134,13 +134,9 @@ along with this program. If not, see . */ var makeRobotTerminalHandler = function (jqConsole, editor, problem_id, activityHandler) { var terminal = codeq.makeConsole(jqConsole, { - 'greeting': 'CodeQ Robot terminal proxy', - 'autoHistory': true + 'greeting': 'Robot messages\n--------------\n\n', }); - - terminal.onInput = function (text) { - terminal.append('Not implemented.\n', 'output'); - }; + terminal.inputDisable(); return terminal; }; @@ -151,7 +147,9 @@ along with this program. If not, see . */ var createRobotHandler = function (problemDef, commonDef, currentSolution) { var jqDescriptionContent = jqDescription.find('.description'), jqEditor = jqCode.find('.code_editor'), + jqTerminal = jqConsole.find('.console'), jqHints = jqInfo.find('.hints'), + jqStatus = jqConsole.find('.status'), editor = codeq.makeEditor(jqEditor[0], { mode: 'python', @@ -162,6 +160,7 @@ along with this program. If not, see . */ jqBtnRun.focus(); }), activityHandler = codeq.makeActivityHandler(editor, problemDef.id), + terminal = makeRobotTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'robot_hints', problemDef, commonDef), commError = function (error) { alert(error); @@ -173,6 +172,7 @@ along with this program. If not, see . */ // set up the websocket events socket.on('close', function (data) { console.log('websocket closed, trying to reopen in 1 s'); + jqStatus.html('Not connected.'); reconnectTimer = setTimeout(function () { reconnectTimer = null; socket.open(); @@ -188,7 +188,11 @@ along with this program. If not, see . */ if (!sensors.hasOwnProperty(sensor)) continue; text += sensor + ': ' + sensors[sensor] + '
\n' } - $('div.console').html('

'+text+'

'); + jqStatus.html(text); + } + else if (json_obj.event == 'output') { + text = json_obj.text; + terminal.append(text, 'output'); } }); @@ -246,10 +250,12 @@ along with this program. If not, see . */ var program = editor.getDoc().getValue(); activityHandler.queueTrace({'typ': 'robot_run', 'program': program}); socket.send(JSON.stringify({action: 'run', program: program})); + terminal.append('\n', 'output'); }); jqBtnStop.on('click', function () { activityHandler.queueTrace({'typ': 'robot_stop'}); socket.send(JSON.stringify({action: 'stop'})); + terminal.append('\n', 'output'); }); codeq.comms.loadProblem(problemDef.id).done(); -- cgit v1.2.1