From 48dc7b25ca6b4eba5998a1720f9e5232c1d0627e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Pu=C5=A1nik?= Date: Mon, 14 Dec 2015 18:07:18 +0100 Subject: about page minor enhancements --- res/en.json | 2 +- res/sl.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/en.json b/res/en.json index 1fcb894..65d68bc 100644 --- a/res/en.json +++ b/res/en.json @@ -67,5 +67,5 @@ "upgrade_to_aai_no_button": "No, make new", "upgrade_to_aai_yes_button": "Yes, upgrade to AAI", "about": "About", - "about_html" : "

CodeQ™ is the ...


Programming by Guru Ltd, Ljubljana, Slovenia. Design by Loni DBS Ltd, Ljubljana, Slovenia.


The project was co-funded by European Regional Development Fund and Slovenian Ministry of Education, Science, and Sport.


Contact

Aleksander Sadikov, PhD, project leader.


Minimal requirements

Android: version 3.1, iOS: version 5, Windows Phone: version 8

" + "about_html" : "

CodeQ™ is an e-service and a mobile app for teaching programming. The application enables the user to work on his or her own by solving a number of carefully prepared programming exercises and by guiding the user with automatically generated hints and test. ...


The project was co-funded by European Regional Development Fund and Slovenian Ministry of Education, Science, and Sport.


Contact

Aleksander Sadikov, PhD, project leader.


Mobile applications - minimum requirements

Android: version 3.1, iOS: version 5, Windows Phone: version 8


Programming by Guru Ltd, Ljubljana, Slovenia.

" } diff --git a/res/sl.json b/res/sl.json index b97cc1f..1a72aca 100644 --- a/res/sl.json +++ b/res/sl.json @@ -67,5 +67,5 @@ "upgrade_to_aai_no_button": "Ne, naredi nov račun", "upgrade_to_aai_yes_button": "Da, nadgradi na AAI", "about": "O aplikaciji", - "about_html" : "

Naziv operacije

Učenje programiranja s samodejno generiranimi namigi.


Kratek opis operacije

Razvita je bila e-storitev in mobilna aplikacija za inteligentni sistem za poučevanje programiranja. Samostojno učenje programiranja prek reševanja programerskih nalog smo nadgradili z ekspertnim modulom, ki opozarja na napake in samodejno generira namige, in modulom za testiranje programov (uporabnikovih rešitev) s samodejno generiranimi testnimi primeri. Poleg tega je bil razvit modul za povezavo z mobilnimi roboti, ki bo omogočil poganjanje programov na le-teh.


Upravičenci

Univerza v Ljubljani (Fakulteta za računalništvo in informatiko, Laboratorij za umetno inteligenco)


Stroški operacije

X EUR od tega Y EUR iz javnih virov financiranja (85% Evropska unija, 15% Ministrstvo za izobraževanje, znanost in šport).


Datum operacije

Operacija je potekala od 3.11.2014 do 30.9.2015.


Kontaktna oseba

dr. Aleksander Sadikov, vodja projekta.

Operacijo delno financira Evropska unija iz Evropskega sklada za regionalni razvoj ter Ministrstvo za izobraževanje, znanost in šport. Operacija se izvaja v okviru Operativnega programa krepitve regionalnih razvojnih potencialov v obdobju 2007-2013, razvojne prioritete: gospodarska razvojna infrastruktura; prednostne usmeritve: Informacijska družba.


Mobilna aplikacija - minimalne zahteve

Android: verzija 3.1, iOS: verzija 5, Windows Phone: verzija 8.


Razvoj aplikacije: Guru d.o.o. Oblikovanje: LONI DBS d.o.o.

" + "about_html" : "

Naziv operacije

Učenje programiranja s samodejno generiranimi namigi.


Kratek opis operacije

Razvita je bila e-storitev in mobilna aplikacija za inteligentni sistem za poučevanje programiranja. Samostojno učenje programiranja prek reševanja programerskih nalog smo nadgradili z ekspertnim modulom, ki opozarja na napake in samodejno generira namige in modulom za testiranje programov (uporabnikovih rešitev) s samodejno generiranimi testnimi primeri. Poleg tega je bil razvit modul za povezavo z mobilnimi roboti, ki bo omogočil poganjanje programov na le-teh.


Upravičenci

Univerza v Ljubljani (Fakulteta za računalništvo in informatiko, Laboratorij za umetno inteligenco)


Stroški operacije

69.996 EUR (85% Evropska unija, 15% Ministrstvo za izobraževanje, znanost in šport).

Operacijo delno financira Evropska unija iz Evropskega sklada za regionalni razvoj ter Ministrstvo za izobraževanje, znanost in šport. Operacija se izvaja v okviru Operativnega programa krepitve regionalnih razvojnih potencialov v obdobju 2007-2013, razvojne prioritete: gospodarska razvojna infrastruktura; prednostne usmeritve: Informacijska družba.


Datum operacije

Operacija je potekala od 3.11.2014 do 30.9.2015.


Kontaktna oseba

dr. Aleksander Sadikov, vodja projekta.


Mobilna aplikacija - minimalne zahteve

Android: verzija 3.1, iOS: verzija 5, Windows Phone: verzija 8.


Razvoj aplikacije: Guru d.o.o.

" } -- cgit v1.2.1 From a988eedb8308aa327cef5107d2eeeb93d629a99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Pu=C5=A1nik?= Date: Mon, 14 Dec 2015 19:22:03 +0100 Subject: tiny css adjustments --- css/codeq.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/css/codeq.css b/css/codeq.css index c12be4d..4b1bec4 100644 --- a/css/codeq.css +++ b/css/codeq.css @@ -99,6 +99,7 @@ div.vertical-line{ .block.block1 { border-bottom: 1px solid #ddd; + padding-bottom: 1em; } @@ -107,6 +108,9 @@ div.vertical-line{ padding: 0.5em 0.5em 20px 0.5em; } +.block.block4 { + padding-bottom: 1em; +} /* code_editor */ .block > .code_editor { -- cgit v1.2.1 From e7fe28e92a766e0a37cb75d1bee534d476f955ed Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 14 Dec 2015 20:16:58 +0100 Subject: Increase minimum height for editor and console --- css/codeq.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/css/codeq.css b/css/codeq.css index 4b1bec4..3a12b85 100644 --- a/css/codeq.css +++ b/css/codeq.css @@ -114,6 +114,7 @@ div.vertical-line{ /* code_editor */ .block > .code_editor { + min-height: 8em; } .block.block2 { @@ -126,7 +127,7 @@ div.vertical-line{ background: #222; font-size: 14px; padding: 0.5em; - min-height: 4em; + min-height: 8em; } .block-label { -- 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 --- css/codeq.css | 12 ++++++++++++ index.html | 1 + js/codeq/robot.js | 20 +++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/css/codeq.css b/css/codeq.css index 3a12b85..1775c84 100644 --- a/css/codeq.css +++ b/css/codeq.css @@ -159,6 +159,18 @@ div.vertical-line{ padding: 0 4px; } +/* robot connection & sensor info */ +#screen_robot .block3 .status { + background-color: #666; + border: 1px solid #444; + color: yellow; + font-family: monospace; + padding: 0.5em; + position: absolute; + top: 1em; + right: 1em; +} + /* block-toolbar */ .block-toolbar { position: absolute; diff --git a/index.html b/index.html index aff6d4f..d89bdd7 100644 --- a/index.html +++ b/index.html @@ -444,6 +444,7 @@
+
Console
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 From 13c8be3d82350082093df8cd65771f09fcb83c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 15 Dec 2015 11:26:23 +0100 Subject: Fixed the bug about the loss of problem solving screen state when entering a navigation-bar state and getting back. Now every state carries with itself the publicly exposed jqScreen object and isModal boolean information, which is used by the globalStateMachine in the actualTransition method. --- js/codeq/aaiLogin.js | 2 ++ js/codeq/about.js | 3 +++ js/codeq/change_password.js | 3 +++ js/codeq/language.js | 2 ++ js/codeq/login.js | 2 ++ js/codeq/navigation.js | 44 +++++++++++++++++++++++++++++++++++++++----- js/codeq/problem_list.js | 2 ++ js/codeq/profile.js | 10 +++++++--- js/codeq/prolog.js | 3 +++ js/codeq/python.js | 2 ++ js/codeq/robot.js | 2 ++ js/codeq/settings.js | 3 +++ js/codeq/signup.js | 2 ++ js/codeq/upgrade_to_aai.js | 2 ++ 14 files changed, 74 insertions(+), 8 deletions(-) diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js index a0a8e68..abe7283 100644 --- a/js/codeq/aaiLogin.js +++ b/js/codeq/aaiLogin.js @@ -29,6 +29,8 @@ along with this program. If not, see . */ samlLoginUrl = ''; codeq.globalStateMachine.register('aailogin',{ + 'jqScreen': jqScreen, + 'enter': function(){ jqDisabledOverlay.css('display', ''); codeq.samlLogin = true;//set the flag diff --git a/js/codeq/about.js b/js/codeq/about.js index 25fa829..f56d9fd 100644 --- a/js/codeq/about.js +++ b/js/codeq/about.js @@ -23,6 +23,9 @@ along with this program. If not, see . */ jqBtnGoBack = $("#btnAboutGoBack"); codeq.globalStateMachine.register('about',{ + 'jqScreen': jqScreen, + 'isModal': true, + 'enter': function(){ jqBtnGoBack.on('click',function(){ history.back();//forces a transition to the previous state diff --git a/js/codeq/change_password.js b/js/codeq/change_password.js index dc5db39..6ebd6dd 100644 --- a/js/codeq/change_password.js +++ b/js/codeq/change_password.js @@ -26,6 +26,9 @@ along with this program. If not, see . */ jqChangePassForm = $('#formChangePassword'); codeq.globalStateMachine.register('changePassword',{ + 'jqScreen': jqScreen, + 'isModal': true, + 'enter': function(){ jqCancelBtn.on('click',function(){ history.back();//forces a transition to the previous state diff --git a/js/codeq/language.js b/js/codeq/language.js index 5433c84..cacdb32 100644 --- a/js/codeq/language.js +++ b/js/codeq/language.js @@ -28,6 +28,8 @@ along with this program. If not, see . */ }; codeq.globalStateMachine.register('language',{ + 'jqScreen': jqScreen, + 'enter': function(){ jqScreen.css('display', ''); jqProlog.on('click', function (e) { e.preventDefault(); choose('prolog') }); diff --git a/js/codeq/login.js b/js/codeq/login.js index 162e336..f7ddeb3 100644 --- a/js/codeq/login.js +++ b/js/codeq/login.js @@ -78,6 +78,8 @@ along with this program. If not, see . */ formInputs = $('#username, #password'); codeq.globalStateMachine.register('login',{ + 'jqScreen': jqScreen, + 'enter': function(){ jqNavigationHomeBtn.off('click');//remove the click listener of this element here jqNavBarRight.css('display','none');//hide settings etc. diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js index da2b04a..cfff71b 100644 --- a/js/codeq/navigation.js +++ b/js/codeq/navigation.js @@ -49,7 +49,8 @@ along with this program. If not, see . */ //the global state machine is a bit different - so it'll be implemented here var makeGlobalStateMachine = function (def) { - var currState = null; + var currState = null, + waitingState = null; // state hidden with a modal form var stateChangeFun = function historyStateChangeHandler() { var historyState = History.getState(); codeq.globalStateMachine.actualTransition.apply(codeq.globalStateMachine, $.merge([historyState.data.state] ,historyState.data.params)); @@ -77,11 +78,14 @@ along with this program. If not, see . */ } }, 'destroy': function () { + var i; if (currState) currState.exit(); currState = null; + if (waitingState) waitingState.exit(); + waitingState = null; History.Adapter.unbind(window, 'statechange', stateChangeFun); }, - 'register': function (name, state) { + 'register': function (name, state, props) { if (name in def) codeq.log.error('The state ' + name + ' is already registered, overriding'); def[name] = state; }, @@ -93,9 +97,39 @@ along with this program. If not, see . */ 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])); +// if (currState) currState.exit(); +// currState = newState; +// currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1])); + if (currState) { + if (newState.isModal) { + if (currState.isModal) currState.exit(); + else { + waitingState = currState; + waitingState.jqScreen.css('display', 'none'); + } + currState = newState; + currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1])); + } + else { + currState.exit(); + currState = newState; + if (waitingState === newState) { + waitingState.jqScreen.css('display', ''); + waitingState = null; + } + else { + if (waitingState) { + waitingState.exit(); + waitingState = null; + } + currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1])); + } + } + } + else { + currState = newState; + currState.enter.apply(currState, Array.prototype.slice.apply(arguments, [1])); + } } } }; diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js index 8c3808e..e3ce255 100644 --- a/js/codeq/problem_list.js +++ b/js/codeq/problem_list.js @@ -382,6 +382,8 @@ along with this program. If not, see . */ // ================================================================================ codeq.globalStateMachine.register('problem_list', { + 'jqScreen': jqScreen, + 'enter': function(language){ var data = languageCache[language]; // language data diff --git a/js/codeq/profile.js b/js/codeq/profile.js index 09a0e05..f863140 100644 --- a/js/codeq/profile.js +++ b/js/codeq/profile.js @@ -20,13 +20,17 @@ along with this program. If not, see . */ (function(){ - var jqBtnChangePass = $("#change_pass_profile"), + var jqScreen = $("#screen_profile"), + jqBtnChangePass = $("#change_pass_profile"), jqBtnGoBack = $("#btnProfileGoBack"); codeq.profile = { }; codeq.globalStateMachine.register('profile',{ + 'jqScreen': jqScreen, + 'isModal': true, + 'enter': function(){ jqBtnChangePass.on('click',function(){ codeq.globalStateMachine.transition('changePassword'); @@ -35,7 +39,7 @@ along with this program. If not, see . */ history.back();//forces a transition to the previous state }); if(codeq.samlLogin) $('#loggedInViaSamlSpan').css("display","");//show the span if we actually logged in with SAML - $("#screen_profile").css('display', ''); + jqScreen.css('display', ''); $('#disabled').css('display', 'none'); codeq.comms.getUserStat() .then(function (data) { @@ -78,7 +82,7 @@ along with this program. If not, see . */ 'exit' : function(){ jqBtnChangePass.off('click'); jqBtnGoBack.off('click'); - $("#screen_profile").css('display', 'none'); + jqScreen.css('display', 'none'); $('#loggedInViaSamlSpan').css("display","none"); } }); diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 7f74aaf..8a6cddc 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -82,6 +82,8 @@ along with this program. If not, see . */ }; var prologHandler; //created when we enter the prolog state and destroyed once we leave it codeq.globalStateMachine.register('prolog', { + 'jqScreen': jqScreen, + 'enter': function (problemDef, commonDef, currentSolution) { $('#navigation-problem_list').css('display', ''); $("#navigation-prolog").addClass("active"); @@ -103,6 +105,7 @@ along with this program. If not, see . */ }); }, 'exit': function () { + codeq.log.info('prolog exit()'); jqAllButtons.off(); // unregister all event handlers jqAllQuadrants.off(); jqScreen.css('display', 'none'); diff --git a/js/codeq/python.js b/js/codeq/python.js index 4033a63..b1f46f5 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -87,6 +87,8 @@ along with this program. If not, see . */ }; var pythonHandler; //created when we enter the python state and destroyed once we leave it codeq.globalStateMachine.register('python', { + 'jqScreen': jqScreen, + 'enter': function (problemDef, commonDef, currentSolution) { $('#navigation-problem_list').css('display', ''); $("#navigation-python").addClass("active"); diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 0dca6f3..cfff13d 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -82,6 +82,8 @@ along with this program. If not, see . */ }; var robotHandler; //created when we enter the robot state and destroyed once we leave it codeq.globalStateMachine.register('robot', { + 'jqScreen': jqScreen, + 'enter': function (problemDef, commonDef, currentSolution) { $('#navigation-problem_list').css('display', ''); $("#navigation-robot").addClass("active"); diff --git a/js/codeq/settings.js b/js/codeq/settings.js index 3e72cbd..6fec614 100644 --- a/js/codeq/settings.js +++ b/js/codeq/settings.js @@ -34,6 +34,9 @@ along with this program. If not, see . */ }); codeq.globalStateMachine.register('settings',{ + 'jqScreen': jqScreenSettings, + 'isModal': true, + 'enter':function(){ jqDisabledOverlay.css('display', ''); robotAddressInput.val(codeq.settings['robot_address']);//set the robot address once we enter the state diff --git a/js/codeq/signup.js b/js/codeq/signup.js index 2667fe4..5f3f2be 100644 --- a/js/codeq/signup.js +++ b/js/codeq/signup.js @@ -32,6 +32,8 @@ along with this program. If not, see . */ jqNavigationHomeBtn = $('#navigation-home'); codeq.globalStateMachine.register('signup',{ + 'jqScreen': jqScreen, + 'enter': function(){ jqNavigationHomeBtn.off('click');//remove the click listener of this element here jqNavBarRight.css('display','none');//hide settings etc. diff --git a/js/codeq/upgrade_to_aai.js b/js/codeq/upgrade_to_aai.js index 6ea5855..5357a29 100644 --- a/js/codeq/upgrade_to_aai.js +++ b/js/codeq/upgrade_to_aai.js @@ -26,6 +26,8 @@ along with this program. If not, see . */ jqLangSelect = jqScreen.find('.lang-select'); codeq.globalStateMachine.register('upgradeToAAI',{ + 'jqScreen': jqScreen, + 'enter': function(){ jqNoBtn.on('click',function(){ codeq.comms.samlLogin(false) -- cgit v1.2.1 From 308fac63793e912c874bf458f8976d0b0f76d650 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 15 Dec 2015 13:10:53 +0100 Subject: Use name instead of slug in Prolog descriptions --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d89bdd7..82c852c 100644 --- a/index.html +++ b/index.html @@ -331,7 +331,7 @@
-

+

-- cgit v1.2.1 From 6d879afe4c423de9bdac9eeb6a8d3f8aa4526378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 15 Dec 2015 16:54:12 +0100 Subject: Remove a diagnostic log line from the prolog screen, which remained there by mistake. --- js/codeq/prolog.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 8a6cddc..23d8cc7 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -105,7 +105,6 @@ along with this program. If not, see . */ }); }, 'exit': function () { - codeq.log.info('prolog exit()'); jqAllButtons.off(); // unregister all event handlers jqAllQuadrants.off(); jqScreen.css('display', 'none'); -- cgit v1.2.1 From 2f1982456f85b156e152864b4d327c46a0adc4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 15 Dec 2015 16:58:13 +0100 Subject: Implement codeq.comms.forceReset() to better handle possible timeouts and resulting blockage in codeq.reset(). --- js/codeq/comms.js | 21 +++++++++++++++++++++ js/codeq/core.js | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/js/codeq/comms.js b/js/codeq/comms.js index e964f20..5e046b7 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -557,6 +557,27 @@ along with this program. If not, see . */ 'samlLogout': function(){ return this.send({'action':'saml_logout'}); + }, + + 'forceReset': function () { + var p; + if (sid !== null) { + p = Q.Promise(function (resolve, reject, notify) { + var t = setTimeout(function () { + t = null; + resolve(); + }, 3000); // 3 seconds + codeq.comms.logout().then(function () { + if (t !== null) { + clearTimeout(t); + t = null; + resolve(); + } + }); + }); + } + else p = Q(); + return p.fin(codeq.comms.disconnect); } }; })(); diff --git a/js/codeq/core.js b/js/codeq/core.js index 22f6a50..c3c657f 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -610,15 +610,16 @@ along with this program. If not, see . */ codeq.log.info('App reset: ' + (reason || 'no reason given')); codeq.globalStateMachine.transition('login'); codeq.wait( - codeq.comms.getSid() == null ? Q() : codeq.comms.logout() +/* codeq.comms.getSid() == null ? Q() : codeq.comms.logout() .finally( codeq.comms.disconnect ) .fail(function (e) { codeq.log.debug(e) - }) // ignore errors + }) // ignore errors*/ + codeq.comms.forceReset ) - .then(function () { + .fin(function () { if (reason) { alert(reason); } -- cgit v1.2.1 From e906718cefc3f5fc7a279c7cae3a76fbdc184961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 15 Dec 2015 17:00:34 +0100 Subject: Add error reporting on uncaught errors. Add "logService" to siteDefinition for sending client logs to the server, commented out by default. --- js/codeq/core.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/codeq/core.js b/js/codeq/core.js index c3c657f..b53ce70 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ (function () { - window.siteDefinition = {logLevel: 'debug'}; // for debug purposes + window.siteDefinition = {logLevel: 'debug'/*, 'logService': '/ws/clientlog'*/}; // for debug purposes // ================================================================================ // JSON-ization (stringification) function @@ -123,7 +123,6 @@ along with this program. If not, see . */ logs = []; $.ajax({ contentType: 'application/json', - dataType: 'application/json', type: 'POST', url: logServiceUrl, data: copyOfLogs, @@ -148,6 +147,12 @@ along with this program. If not, see . */ return logger; })(); + // uncaught error reporting + window.onerror = function (msg, url, lineNumber) { + if ((msg !== null) && (msg instanceof Object)) msg = msg.toString(); + codeq.log.error('Uncaught error at line ' + lineNumber + ' in ' + url + ': ' + msg); + }; + // ================================================================================ // The core CodeQ module // ================================================================================ -- cgit v1.2.1