diff --git a/web/app/assets/javascripts/gear/step_network_test.js b/web/app/assets/javascripts/gear/step_network_test.js index 7cbc6fea1..34f6710ee 100644 --- a/web/app/assets/javascripts/gear/step_network_test.js +++ b/web/app/assets/javascripts/gear/step_network_test.js @@ -34,6 +34,7 @@ var $currentScore = null; var $scoredClients = null; var $subscore = null; + var backendGuardTimeout = null; var serverClientId = ''; var isScoring = false; @@ -113,6 +114,10 @@ context.JK.alertSupportedNeeded("JamKazam is experiencing technical difficulties."); renderStopTest('', ''); } + else if(reason == 'backend_gone') { + context.JK.alertSupportedNeeded("The JamKazam client is experiencing technical difficulties."); + renderStopTest('', ''); + } else if(reason == "invalid_response") { context.JK.alertSupportedNeeded("The JamKazam client software had an unexpected problem while scoring your Internet connection. Reason=" + attempt.backend_data.reason + '.'); renderStopTest('', ''); @@ -151,6 +156,17 @@ return testSummary.attempts[testSummary.attempts.length - 1]; } + function backendTimedOut() { + testSummary.final = {reason: 'backend_gone'} + testFinished(); + } + + function clearBackendGuard() { + if(backendGuardTimeout) { + clearTimeout(backendGuardTimeout); + backendGuardTimeout = null; + } + } function attemptTestPass() { @@ -162,7 +178,6 @@ attempt.server_client_id = serverClientId; attempt.received_progress = false; testSummary.attempts.push(attempt); - console.log("pushing attempt: " + testSummary.attempts.length) //context.jamClient.StopNetworkTest(''); @@ -170,6 +185,8 @@ updateProgress(0, false); + backendGuardTimeout = setTimeout(function(){backendTimedOut()}, gon.ftue_network_test_duration + 1000); + context.jamClient.TestNetworkPktBwRate(serverClientId, TEST_SUCCESS_CALLBACK, TEST_TIMEOUT_CALLBACK, NETWORK_TEST_TYPES.PktTest400LowLatency, gon.ftue_network_test_duration, @@ -257,6 +274,8 @@ } function networkTestSuccess(data) { + clearBackendGuard(); + var attempt = getCurrentAttempt(); function refineTest(up) { @@ -366,6 +385,8 @@ } function networkTestTimeout(data) { + clearBackendGuard(); + logger.warn("network timeout when testing latency test: " + data); var attempt = getCurrentAttempt(); @@ -410,6 +431,10 @@ reset(); } + function afterHide() { + + } + function initialize(_$step) { $step = _$step; @@ -427,6 +452,7 @@ } this.newSession = newSession; + this.afterHide = afterHide; this.beforeShow = beforeShow; this.initialize = initialize; diff --git a/web/app/assets/javascripts/gear/step_select_gear.js b/web/app/assets/javascripts/gear/step_select_gear.js index ba8260460..9f1afd38c 100644 --- a/web/app/assets/javascripts/gear/step_select_gear.js +++ b/web/app/assets/javascripts/gear/step_select_gear.js @@ -1056,7 +1056,8 @@ clearOutputPorts(); resetFrameBuffers(); } - function beforeHide() { + function afterHide() { + logger.debug("unregistering focus watch") $(window).off('focus', onFocus); } @@ -1098,7 +1099,7 @@ this.handleNext = handleNext; this.beforeShow = beforeShow; - this.beforeHide = beforeHide; + this.afterHide = afterHide; this.initialize = initialize; self = this; diff --git a/web/app/assets/javascripts/textMessageDialog.js b/web/app/assets/javascripts/textMessageDialog.js index 8099da112..a00a65671 100644 --- a/web/app/assets/javascripts/textMessageDialog.js +++ b/web/app/assets/javascripts/textMessageDialog.js @@ -201,11 +201,13 @@ } function renderNotConnected() { + console.log("RENDER NOT CONNECTED!!!!!!!!!") $interactionBlocker.addClass('active'); $disconnectedMsg.addClass('active'); } function renderConnected() { + console.log("RENDER CONNECTED!!!!!!!!!") $interactionBlocker.removeClass('active'); $disconnectedMsg.removeClass('active'); } diff --git a/web/app/views/clients/index.html.erb b/web/app/views/clients/index.html.erb index 74ca23a43..513d49d75 100644 --- a/web/app/views/clients/index.html.erb +++ b/web/app/views/clients/index.html.erb @@ -253,7 +253,7 @@ } JK.app = JK.JamKazam(); - var jamServer = new JK.JamServer(JK.app, function(event_type) {}); + var jamServer = new JK.JamServer(JK.app, function(event_type) {JK.app.activeElementEvent(event_type)}); jamServer.initialize(); JK.initJamClient(); diff --git a/web/app/views/shared/_ga.html.erb b/web/app/views/shared/_ga.html.erb index 5c1a9c07f..f22ac3a63 100644 --- a/web/app/views/shared/_ga.html.erb +++ b/web/app/views/shared/_ga.html.erb @@ -1,4 +1,4 @@ -<% if current_user.nil? || !Rails.application.config.ga_suppress_admin || !current_user.admin? || request.user_agent != 'monitor' %> +<% if request.user_agent != "monitor" && (current_user.nil? || !Rails.application.config.ga_suppress_admin || !current_user.admin?) # remove admin users from GA %>