* VRFS-1804 - 'prime the pump' stage done
This commit is contained in:
parent
6cee38df70
commit
1e4e9bd90e
|
|
@ -20,6 +20,10 @@
|
|||
unfreezeInteractions();
|
||||
}
|
||||
|
||||
function networkTestCancel() {
|
||||
unfreezeInteractions();
|
||||
}
|
||||
|
||||
function networkTestStart() {
|
||||
freezeInteractions();
|
||||
}
|
||||
|
|
@ -47,10 +51,10 @@
|
|||
return false;
|
||||
})
|
||||
|
||||
$btnHelp.on('click', function(e) {
|
||||
/** $btnHelp.on('click', function(e) {
|
||||
context.JK.Banner.showAlert('No help is yet available for the network test.');
|
||||
return false;
|
||||
})
|
||||
})*/
|
||||
}
|
||||
|
||||
function beforeShow() {
|
||||
|
|
@ -81,6 +85,7 @@
|
|||
$(networkTest)
|
||||
.on(networkTest.NETWORK_TEST_DONE, networkTestDone)
|
||||
.on(networkTest.NETWORK_TEST_FAIL, networkTestFail)
|
||||
.on(networkTest.NETWORK_TEST_CANCEL, networkTestCancel)
|
||||
.on(networkTest.NETWORK_TEST_START, networkTestStart)
|
||||
|
||||
events();
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
context.JK.NetworkTest = function (app) {
|
||||
|
||||
var NETWORK_TEST_TYPES = {
|
||||
RestPhase : 0,
|
||||
PktTest100NormalLatency : 1,
|
||||
PktTest200MediumLatency : 2,
|
||||
PktTest400LowLatency : 3,
|
||||
PktTestRateSweep : 4,
|
||||
RcvOnly : 5
|
||||
RestPhase: 0,
|
||||
PktTest100NormalLatency: 1,
|
||||
PktTest200MediumLatency: 2,
|
||||
PktTest400LowLatency: 3,
|
||||
PktTestRateSweep: 4,
|
||||
RcvOnly: 5
|
||||
}
|
||||
var STARTING_NUM_CLIENTS = 4;
|
||||
var PAYLOAD_SIZE = 100;
|
||||
|
|
@ -37,11 +37,13 @@
|
|||
var $subscore = null;
|
||||
var $watchVideo = null;
|
||||
var backendGuardTimeout = null;
|
||||
var primeGuardTimeout = null;
|
||||
var primeDeferred = null;
|
||||
|
||||
var serverClientId = '';
|
||||
var scoring = false;
|
||||
var numClientsToTest = STARTING_NUM_CLIENTS;
|
||||
var testSummary = {attempts : [], final:null}
|
||||
var testSummary = {attempts: [], final: null}
|
||||
var $self = $(this);
|
||||
var scoringZoneWidth = 100;//px
|
||||
var inGearWizard = false;
|
||||
|
|
@ -52,36 +54,57 @@
|
|||
var lastNetworkFailure = null;
|
||||
var bandwidthSamples = [];
|
||||
|
||||
var NETWORK_TEST_START = 'network_test.start';
|
||||
var NETWORK_TEST_DONE = 'network_test.done';
|
||||
var NETWORK_TEST_FAIL = 'network_test.fail';
|
||||
var NETWORK_TEST_START = 'network_test.start';
|
||||
var NETWORK_TEST_DONE = 'network_test.done';
|
||||
var NETWORK_TEST_FAIL = 'network_test.fail';
|
||||
var NETWORK_TEST_CANCEL = 'network_test.cancel';
|
||||
|
||||
function createSuccessCallbackName() {
|
||||
if(inGearWizard) {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForGearWizard';
|
||||
function createSuccessCallbackName(priming) {
|
||||
if (priming) {
|
||||
if (inGearWizard) {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForPumpPrimingGW';
|
||||
}
|
||||
else {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForPumpPrimingDialog';
|
||||
}
|
||||
}
|
||||
else {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForDialog';
|
||||
if (inGearWizard) {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForGearWizard';
|
||||
}
|
||||
else {
|
||||
return TEST_SUCCESS_CALLBACK + 'ForDialog';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createTimeoutCallbackName() {
|
||||
if(inGearWizard) {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForGearWizard';
|
||||
function createTimeoutCallbackName(priming) {
|
||||
if (priming) {
|
||||
if (inGearWizard) {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForPumpPrimingGW';
|
||||
}
|
||||
else {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForPumpPrimingDialog';
|
||||
}
|
||||
}
|
||||
else {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForDialog';
|
||||
if (inGearWizard) {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForGearWizard';
|
||||
}
|
||||
else {
|
||||
return TEST_TIMEOUT_CALLBACK + 'ForDialog';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this averages bandwidthSamples; this method is meant just for GA data
|
||||
function avgBandwidth(num_others) {
|
||||
if(bandwidthSamples.length == 0) {
|
||||
if (bandwidthSamples.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
var total = 0;
|
||||
context._.each(bandwidthSamples, function(sample) {
|
||||
context._.each(bandwidthSamples, function (sample) {
|
||||
total += (sample * num_others * 400 * (100 + 28)); // sample is a percentage of 400. So sample * 400 gives us how many packets/sec. 100 is payload; 28 is UDP+ETHERNET overhead, to give us bandwidth
|
||||
})
|
||||
return total / bandwidthSamples.length;
|
||||
|
|
@ -98,7 +121,7 @@
|
|||
serverClientId = '';
|
||||
scoring = false;
|
||||
numClientsToTest = STARTING_NUM_CLIENTS;
|
||||
testSummary = {attempts : []};
|
||||
testSummary = {attempts: []};
|
||||
configureStartButton();
|
||||
$scoredClients.empty();
|
||||
$testResults.removeClass('good acceptable bad testing');
|
||||
|
|
@ -125,12 +148,12 @@
|
|||
function postDiagnostic() {
|
||||
rest.createDiagnostic({
|
||||
type: 'NETWORK_TEST_RESULT',
|
||||
data: {client_type: context.JK.clientType(), client_id: context.JK.JamServer.clientID, summary:testSummary}
|
||||
data: {client_type: context.JK.clientType(), client_id: context.JK.JamServer.clientID, summary: testSummary}
|
||||
});
|
||||
}
|
||||
|
||||
function appendContextualStatement() {
|
||||
if(inGearWizard) {
|
||||
if (inGearWizard) {
|
||||
return "You can skip this step for now."
|
||||
}
|
||||
else {
|
||||
|
|
@ -143,37 +166,37 @@
|
|||
}
|
||||
|
||||
function storeLastNetworkFailure(reason, data) {
|
||||
if(!trackedPass) {
|
||||
lastNetworkFailure = {reason:reason, data:data};
|
||||
if (!trackedPass) {
|
||||
lastNetworkFailure = {reason: reason, data: data};
|
||||
}
|
||||
}
|
||||
|
||||
function testFinished() {
|
||||
var attempt = getCurrentAttempt();
|
||||
|
||||
if(!testSummary.final) {
|
||||
testSummary.final = {reason : attempt.reason};
|
||||
if (!testSummary.final) {
|
||||
testSummary.final = {reason: attempt.reason};
|
||||
}
|
||||
|
||||
var reason = testSummary.final.reason;
|
||||
var success = false;
|
||||
|
||||
if(reason == "success") {
|
||||
if (reason == "success") {
|
||||
renderStopTest(attempt.num_clients, "Your router and Internet service will support sessions of up to " + attempt.num_clients + " JamKazam musicians.")
|
||||
testedSuccessfully = true;
|
||||
if(!testSummary.final.num_clients) {
|
||||
if (!testSummary.final.num_clients) {
|
||||
testSummary.final.num_clients = attempt.num_clients;
|
||||
}
|
||||
|
||||
// context.jamClient.GetNetworkTestScore() == 0 is a rough approximation if the user has passed the FTUE before
|
||||
if(inGearWizard || context.jamClient.GetNetworkTestScore() == 0) {
|
||||
if (inGearWizard || context.jamClient.GetNetworkTestScore() == 0) {
|
||||
trackedPass = true;
|
||||
lastNetworkFailure = null;
|
||||
context.JK.GA.trackNetworkTest(context.JK.detectOS(), testSummary.final.num_clients);
|
||||
}
|
||||
|
||||
context.jamClient.SetNetworkTestScore(attempt.num_clients);
|
||||
if(testSummary.final.num_clients == 2) {
|
||||
if (testSummary.final.num_clients == 2) {
|
||||
$testResults.addClass('acceptable');
|
||||
}
|
||||
else {
|
||||
|
|
@ -181,63 +204,63 @@
|
|||
}
|
||||
success = true;
|
||||
}
|
||||
else if(reason == "minimum_client_threshold") {
|
||||
else if (reason == "minimum_client_threshold") {
|
||||
context.jamClient.SetNetworkTestScore(0);
|
||||
renderStopTest('', "We're sorry, but your router and Internet service will not effectively support JamKazam sessions. Please click the HELP button for more information.")
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.bandwidth, avgBandwidth(attempt.num_clients - 1));
|
||||
}
|
||||
else if(reason == "unreachable" || reason == "no-transmit") {
|
||||
else if (reason == "unreachable" || reason == "no-transmit") {
|
||||
context.jamClient.SetNetworkTestScore(0);
|
||||
renderStopTest('', "We're sorry, but your router will not support JamKazam in its current configuration. Please click the HELP button for more information.");
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.stun, attempt.num_clients);
|
||||
}
|
||||
else if(reason == "internal_error") {
|
||||
else if (reason == "internal_error") {
|
||||
context.JK.alertSupportedNeeded("The JamKazam client software had an unexpected problem while scoring your Internet connection.");
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == "remote_peer_cant_test") {
|
||||
else if (reason == "remote_peer_cant_test") {
|
||||
context.JK.alertSupportedNeeded("The JamKazam service is experiencing technical difficulties.");
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == "server_comm_timeout") {
|
||||
else if (reason == "server_comm_timeout") {
|
||||
gearUtils.skipNetworkTest();
|
||||
context.JK.alertSupportedNeeded("Communication with the JamKazam network service has timed out." + appendContextualStatement());
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == 'backend_gone') {
|
||||
else if (reason == 'backend_gone') {
|
||||
context.JK.alertSupportedNeeded("The JamKazam client is experiencing technical difficulties.");
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == "invalid_response") {
|
||||
else if (reason == "invalid_response") {
|
||||
gearUtils.skipNetworkTest();
|
||||
context.JK.alertSupportedNeeded("The JamKazam client software had an unexpected problem while scoring your Internet connection.<br/><br/>Reason: " + attempt.backend_data.reason + '.');
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == 'no_servers') {
|
||||
else if (reason == 'no_servers') {
|
||||
gearUtils.skipNetworkTest();
|
||||
context.JK.alertSupportedNeeded("No network test servers are available." + appendContextualStatement());
|
||||
renderStopTest('', '');
|
||||
testedSuccessfully = true;
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == 'no_network') {
|
||||
else if (reason == 'no_network') {
|
||||
context.JK.Banner.showAlert("Please try again later. Your network appears down.");
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.noNetwork);
|
||||
}
|
||||
else if(reason == "rest_api_error") {
|
||||
else if (reason == "rest_api_error") {
|
||||
gearUtils.skipNetworkTest();
|
||||
context.JK.alertSupportedNeeded("Unable to acquire a network test server." + appendContextualStatement());
|
||||
testedSuccessfully = true;
|
||||
renderStopTest('', '');
|
||||
storeLastNetworkFailure(context.JK.GA.NetworkTestFailReasons.jamerror);
|
||||
}
|
||||
else if(reason == "timeout") {
|
||||
else if (reason == "timeout") {
|
||||
gearUtils.skipNetworkTest();
|
||||
context.JK.alertSupportedNeeded("Communication with the JamKazam network service timed out." + appendContextualStatement());
|
||||
testedSuccessfully = true;
|
||||
|
|
@ -256,7 +279,7 @@
|
|||
configureStartButton();
|
||||
postDiagnostic();
|
||||
|
||||
if(success) {
|
||||
if (success) {
|
||||
$self.triggerHandler(NETWORK_TEST_DONE)
|
||||
}
|
||||
else {
|
||||
|
|
@ -268,6 +291,12 @@
|
|||
return testSummary.attempts[testSummary.attempts.length - 1];
|
||||
}
|
||||
|
||||
function primeTimedOut() {
|
||||
logger.warn("backend never completed priming pump phase");
|
||||
scoring = false;
|
||||
primeDeferred.reject();
|
||||
}
|
||||
|
||||
function backendTimedOut() {
|
||||
testSummary.final = {reason: 'backend_gone'}
|
||||
testFinished();
|
||||
|
|
@ -278,15 +307,31 @@
|
|||
}
|
||||
|
||||
function clearBackendGuard() {
|
||||
if(backendGuardTimeout) {
|
||||
if (backendGuardTimeout) {
|
||||
clearTimeout(backendGuardTimeout);
|
||||
backendGuardTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
function clearPrimeGuard() {
|
||||
if (primeGuardTimeout) {
|
||||
clearTimeout(primeGuardTimeout);
|
||||
primeGuardTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
function setPrimeGuard() {
|
||||
clearPrimeGuard();
|
||||
primeGuardTimeout = setTimeout(function () {
|
||||
primeTimedOut()
|
||||
}, 2 * 1000);
|
||||
}
|
||||
|
||||
function setBackendGuard() {
|
||||
clearBackendGuard();
|
||||
backendGuardTimeout = setTimeout(function(){backendTimedOut()}, (gon.ftue_network_test_duration + 1) * 1000);
|
||||
backendGuardTimeout = setTimeout(function () {
|
||||
backendTimedOut()
|
||||
}, (gon.ftue_network_test_duration + 1) * 1000);
|
||||
}
|
||||
|
||||
function attemptTestPass() {
|
||||
|
|
@ -308,7 +353,7 @@
|
|||
|
||||
setBackendGuard();
|
||||
|
||||
context.jamClient.TestNetworkPktBwRate(serverClientId, createSuccessCallbackName(), createTimeoutCallbackName(),
|
||||
context.jamClient.TestNetworkPktBwRate(serverClientId, createSuccessCallbackName(false), createTimeoutCallbackName(false),
|
||||
NETWORK_TEST_TYPES.PktTest400LowLatency,
|
||||
gon.ftue_network_test_duration,
|
||||
numClientsToTest,
|
||||
|
|
@ -316,53 +361,78 @@
|
|||
}
|
||||
|
||||
|
||||
function startNetworkTest(checkWireless) {
|
||||
// you have to score a little to 'prime' the logic to know whether it's on wireless or not
|
||||
function primePump() {
|
||||
scoring = true;
|
||||
primeDeferred = new $.Deferred();
|
||||
|
||||
if(scoring) return false;
|
||||
setPrimeGuard();
|
||||
|
||||
if(checkWireless) {
|
||||
// check if on Wifi 1st
|
||||
var isWireless = context.jamClient.IsMyNetworkWireless();
|
||||
if(isWireless == -1) {
|
||||
logger.warn("unable to determine if the user is on wireless or not for network test. skipping prompt.")
|
||||
}
|
||||
else if(isWireless == 1) {
|
||||
context.JK.Banner.showAlert({buttons: [
|
||||
{name: 'CANCEL', click: function() {}},
|
||||
{name: 'RUN NETWORK TEST ANYWAY', click: function() {startNetworkTest(false)}}],
|
||||
html: "<p>It appears that your computer is connected to your network using WiFi.</p>" +
|
||||
"<p>We strongly advise against running the JamKazam application on a WiFi connection. " +
|
||||
"We recommend using a wired Ethernet connection from your computer to your router. " +
|
||||
"A WiFi connection is likely to cause significant issues in both latency and audio quality.</p>"})
|
||||
return false;
|
||||
}
|
||||
}
|
||||
context.jamClient.TestNetworkPktBwRate(serverClientId, createSuccessCallbackName(true), createTimeoutCallbackName(true),
|
||||
NETWORK_TEST_TYPES.PktTest400LowLatency,
|
||||
1, // minimum time needed to prime pump
|
||||
2,
|
||||
PAYLOAD_SIZE);
|
||||
|
||||
|
||||
return primeDeferred;
|
||||
}
|
||||
|
||||
function prepareNetworkTest() {
|
||||
|
||||
if (scoring) return false;
|
||||
logger.info("starting network test");
|
||||
resetTestState();
|
||||
scoring = true;
|
||||
$self.triggerHandler(NETWORK_TEST_START);
|
||||
renderStartTest();
|
||||
rest.getLatencyTester()
|
||||
.done(function(response) {
|
||||
.done(function (response) {
|
||||
// ensure there are no tests ongoing
|
||||
|
||||
serverClientId = response.client_id;
|
||||
|
||||
|
||||
testSummary.serverClientId = serverClientId;
|
||||
|
||||
logger.info("beginning network test against client_id: " + serverClientId);
|
||||
|
||||
attemptTestPass();
|
||||
primePump()
|
||||
.done(function () {
|
||||
// check if on Wifi 1st
|
||||
var isWireless = context.jamClient.IsMyNetworkWireless();
|
||||
if (isWireless == -1) {
|
||||
logger.warn("unable to determine if the user is on wireless or not for network test. skipping prompt.")
|
||||
}
|
||||
else if (isWireless == 1) {
|
||||
context.JK.Banner.showAlert({buttons: [
|
||||
{name: 'CANCEL', click: function () {
|
||||
scoring = false;
|
||||
configureStartButton();
|
||||
renderStopTest();
|
||||
$self.triggerHandler(NETWORK_TEST_CANCEL)
|
||||
}},
|
||||
{name: 'RUN NETWORK TEST ANYWAY', click: function () {
|
||||
attemptTestPass();;
|
||||
}}
|
||||
],
|
||||
html: "<p>It appears that your computer is connected to your network using WiFi.</p>" +
|
||||
"<p>We strongly advise against running the JamKazam application on a WiFi connection. " +
|
||||
"We recommend using a wired Ethernet connection from your computer to your router. " +
|
||||
"A WiFi connection is likely to cause significant issues in both latency and audio quality.</p>"})
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
context.JK.Banner.showAlert("Network Test Failure", "Unable to determine internet connection type.")
|
||||
});
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
if(jqXHR.status == 404) {
|
||||
.fail(function (jqXHR) {
|
||||
if (jqXHR.status == 404) {
|
||||
// means there are no network testers available.
|
||||
// we have to skip this part of the UI
|
||||
testSummary.final = {reason: 'no_servers'}
|
||||
}
|
||||
else {
|
||||
if(context.JK.isNetworkError(arguments)) {
|
||||
if (context.JK.isNetworkError(arguments)) {
|
||||
testSummary.final = {reason: 'no_network'}
|
||||
}
|
||||
else {
|
||||
|
|
@ -371,7 +441,7 @@
|
|||
}
|
||||
testFinished();
|
||||
})
|
||||
logger.info("starting network test");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +451,7 @@
|
|||
|
||||
$currentScore.stop().data('showSubscore', showSubscore);
|
||||
|
||||
if(!showSubscore) {
|
||||
if (!showSubscore) {
|
||||
$subscore.text('');
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +460,7 @@
|
|||
width: width + '%'
|
||||
}, {
|
||||
step: function (now, fx) {
|
||||
if(showSubscore) {
|
||||
if (showSubscore) {
|
||||
var newWidth = ( 100 * parseFloat($currentScore.css('width')) / parseFloat($currentScore.parent().css('width')) );
|
||||
$subscore.text((Math.round(newWidth * 10) / 10) + '%');
|
||||
}
|
||||
|
|
@ -399,12 +469,37 @@
|
|||
;
|
||||
}
|
||||
|
||||
function primePumpTimeout(data) {
|
||||
clearPrimeGuard();
|
||||
scoring = false;
|
||||
primeDeferred.reject();
|
||||
}
|
||||
|
||||
function primePumpComplete(data) {
|
||||
if (data.progress === true) {
|
||||
// waiting...
|
||||
logger.debug("pump prime progress report");
|
||||
setPrimeGuard();
|
||||
}
|
||||
else {
|
||||
clearPrimeGuard();
|
||||
// we could check for errors, but it's confusing to do so. we just want to let the backend figure out if
|
||||
// the interface is wireless, or not
|
||||
setTimeout(function () {
|
||||
logger.debug("pump primed");
|
||||
scoring = false;
|
||||
primeDeferred.resolve();
|
||||
}, 500); // give backend room to breath for timing/race issues
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function networkTestComplete(data) {
|
||||
var attempt = getCurrentAttempt();
|
||||
|
||||
function refineTest(up) {
|
||||
if(up) {
|
||||
if(numClientsToTest == gon.ftue_network_test_max_clients) {
|
||||
if (up) {
|
||||
if (numClientsToTest == gon.ftue_network_test_max_clients) {
|
||||
attempt.reason = "success";
|
||||
testFinished();
|
||||
}
|
||||
|
|
@ -416,15 +511,15 @@
|
|||
}
|
||||
else {
|
||||
// reduce numclients if we can
|
||||
if(numClientsToTest == MINIMUM_ACCEPTABLE_SESSION_SIZE) {
|
||||
if (numClientsToTest == MINIMUM_ACCEPTABLE_SESSION_SIZE) {
|
||||
// we are too low already. fail the user
|
||||
attempt.reason = "minimum_client_threshold";
|
||||
testFinished();
|
||||
}
|
||||
else if(numClientsToTest > STARTING_NUM_CLIENTS) {
|
||||
else if (numClientsToTest > STARTING_NUM_CLIENTS) {
|
||||
// this means we've gone up before... so don't go back down (i.e., creating a loop)
|
||||
attempt.reason = "success";
|
||||
testSummary.final = { reason:'success', num_clients: numClientsToTest - 1 }
|
||||
testSummary.final = { reason: 'success', num_clients: numClientsToTest - 1 }
|
||||
testFinished();
|
||||
}
|
||||
else {
|
||||
|
|
@ -437,21 +532,21 @@
|
|||
|
||||
attempt.backend_data = data;
|
||||
|
||||
if(data.progress === true) {
|
||||
if (data.progress === true) {
|
||||
|
||||
setBackendGuard();
|
||||
|
||||
var animate = true;
|
||||
if(data.downthroughput && data.upthroughput) {
|
||||
if (data.downthroughput && data.upthroughput) {
|
||||
|
||||
if(data.downthroughput > 0 || data.upthroughput > 0) {
|
||||
if (data.downthroughput > 0 || data.upthroughput > 0) {
|
||||
attempt.received_progress = true;
|
||||
animate = true;
|
||||
}
|
||||
|
||||
if(attempt.received_progress) {
|
||||
if (attempt.received_progress) {
|
||||
// take the lower
|
||||
var throughput= data.downthroughput < data.upthroughput ? data.downthroughput : data.upthroughput;
|
||||
var throughput = data.downthroughput < data.upthroughput ? data.downthroughput : data.upthroughput;
|
||||
|
||||
bandwidthSamples.push(data.upthroughput);
|
||||
|
||||
|
|
@ -463,36 +558,36 @@
|
|||
clearBackendGuard();
|
||||
logger.debug("network test pass success. data: ", data);
|
||||
|
||||
if(data.reason == "unreachable") {
|
||||
if (data.reason == "unreachable") {
|
||||
// STUN
|
||||
logger.debug("network test: unreachable (STUN issue or similar)");
|
||||
attempt.reason = data.reason;
|
||||
testFinished();
|
||||
}
|
||||
else if(data.reason == "no-transmit") {
|
||||
else if (data.reason == "no-transmit") {
|
||||
logger.debug("network test: no-transmit (STUN issue or similar)");
|
||||
attempt.reason = data.reason;
|
||||
testFinished();
|
||||
}
|
||||
else if(data.reason == "internal_error") {
|
||||
else if (data.reason == "internal_error") {
|
||||
// oops
|
||||
logger.debug("network test: internal_error (client had a unexpected problem)");
|
||||
attempt.reason = data.reason;
|
||||
testFinished();
|
||||
}
|
||||
else if(data.reason == "remote_peer_cant_test") {
|
||||
else if (data.reason == "remote_peer_cant_test") {
|
||||
// old client
|
||||
logger.debug("network test: remote_peer_cant_test (old client)")
|
||||
attempt.reason = data.reason;
|
||||
testFinished();
|
||||
}
|
||||
else if(data.reason == "server_comm_timeout") {
|
||||
else if (data.reason == "server_comm_timeout") {
|
||||
logger.debug("network test: server_comm_timeout (communication with server problem)")
|
||||
attempt.reason = data.reason;
|
||||
testFinished();
|
||||
}
|
||||
else {
|
||||
if(!data.downthroughput || !data.upthroughput) {
|
||||
if (!data.downthroughput || !data.upthroughput) {
|
||||
// we have to assume this is bad. just not a reason we know about in code
|
||||
logger.debug("network test: no test data (unknown issue? " + data.reason + ")")
|
||||
attempt.reason = "invalid_response";
|
||||
|
|
@ -500,11 +595,11 @@
|
|||
}
|
||||
else {
|
||||
// success... but we still have to verify if this data is within threshold
|
||||
if(data.downthroughput < gon.ftue_packet_rate_treshold) {
|
||||
if (data.downthroughput < gon.ftue_packet_rate_treshold) {
|
||||
logger.debug("network test: downthroughput too low. downthroughput: " + data.downthroughput + ", threshold: " + gon.ftue_packet_rate_treshold);
|
||||
refineTest(false);
|
||||
}
|
||||
else if(data.upthroughput < gon.ftue_packet_rate_treshold) {
|
||||
else if (data.upthroughput < gon.ftue_packet_rate_treshold) {
|
||||
logger.debug("network test: upthroughput too low. upthroughput: " + data.upthroughput + ", threshold: " + gon.ftue_packet_rate_treshold);
|
||||
refineTest(false);
|
||||
}
|
||||
|
|
@ -538,7 +633,7 @@
|
|||
}
|
||||
|
||||
function configureStartButton() {
|
||||
if(scoring) {
|
||||
if (scoring) {
|
||||
$startNetworkTestBtn.text('NETWORK TEST RUNNING...').removeClass('button-orange').addClass('button-grey')
|
||||
}
|
||||
else {
|
||||
|
|
@ -560,48 +655,75 @@
|
|||
}
|
||||
|
||||
function initializeVideoWatchButton() {
|
||||
if(operatingSystem == "Win32") {
|
||||
if (operatingSystem == "Win32") {
|
||||
$watchVideo.attr('href', 'https://www.youtube.com/watch?v=rhAdCVuwhBc');
|
||||
}
|
||||
else {
|
||||
$watchVideo.attr('href', 'https://www.youtube.com/watch?v=0r1py0AYJ4Y');
|
||||
}
|
||||
}
|
||||
|
||||
function initialize(_$step, _inGearWizard) {
|
||||
$step = _$step;
|
||||
inGearWizard = _inGearWizard;
|
||||
|
||||
$startNetworkTestBtn = $step.find('.start-network-test');
|
||||
|
||||
if($startNetworkTestBtn.length == 0) throw 'no start network test button found in network-test'
|
||||
if ($startNetworkTestBtn.length == 0) throw 'no start network test button found in network-test'
|
||||
|
||||
$testResults = $step.find('.network-test-results');
|
||||
$testScore = $step.find('.network-test-score');
|
||||
$testText = $step.find('.network-test-text');
|
||||
$scoringBar = $step.find('.scoring-bar');
|
||||
$goodMarker = $step.find('.good-marker');
|
||||
$goodLine =$step.find('.good-line');
|
||||
$goodLine = $step.find('.good-line');
|
||||
$currentScore = $step.find('.current-score');
|
||||
$scoredClients= $step.find('.scored-clients');
|
||||
$scoredClients = $step.find('.scored-clients');
|
||||
$subscore = $step.find('.subscore');
|
||||
$watchVideo = $step.find('.watch-video');
|
||||
$startNetworkTestBtn.on('click', startNetworkTest);
|
||||
$startNetworkTestBtn.on('click', function () {
|
||||
prepareNetworkTest();
|
||||
});
|
||||
operatingSystem = context.JK.GetOSAsString();
|
||||
|
||||
initializeVideoWatchButton();
|
||||
|
||||
|
||||
// if this network test is instantiated anywhere else than the gearWizard, or a dialog, then this will have to be expanded
|
||||
if(inGearWizard) {
|
||||
context.JK.HandleNetworkTestSuccessForGearWizard = function(data) { networkTestComplete(data)}; // pin to global for bridge callback
|
||||
context.JK.HandleNetworkTestTimeoutForGearWizard = function(data) { networkTestTimeout(data)}; // pin to global for bridge callback
|
||||
if (inGearWizard) {
|
||||
context.JK.HandleNetworkTestSuccessForPumpPrimingGW = function (data) {
|
||||
primePumpComplete(data)
|
||||
};
|
||||
context.JK.HandleNetworkTestTimeoutForPumpPrimingGW = function (data) {
|
||||
primePumpTimeout(data)
|
||||
};
|
||||
context.JK.HandleNetworkTestSuccessForGearWizard = function (data) {
|
||||
networkTestComplete(data)
|
||||
}; // pin to global for bridge callback
|
||||
context.JK.HandleNetworkTestTimeoutForGearWizard = function (data) {
|
||||
networkTestTimeout(data)
|
||||
}; // pin to global for bridge callback
|
||||
}
|
||||
else {
|
||||
context.JK.HandleNetworkTestSuccessForDialog = function(data) { networkTestComplete(data)}; // pin to global for bridge callback
|
||||
context.JK.HandleNetworkTestTimeoutForDialog = function(data) { networkTestTimeout(data)}; // pin to global for bridge callback
|
||||
context.JK.HandleNetworkTestSuccessForPumpPrimingDialog = function (data) {
|
||||
primePumpComplete(data)
|
||||
};
|
||||
context.JK.HandleNetworkTestTimeoutForPumpPrimingDialog = function (data) {
|
||||
primePumpTimeout(data)
|
||||
};
|
||||
context.JK.HandleNetworkTestSuccessForDialog = function (data) {
|
||||
networkTestComplete(data)
|
||||
}; // pin to global for bridge callback
|
||||
context.JK.HandleNetworkTestTimeoutForDialog = function (data) {
|
||||
networkTestTimeout(data)
|
||||
}; // pin to global for bridge callback
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.isScoring = function () { return scoring; };
|
||||
this.isScoring = function () {
|
||||
return scoring;
|
||||
};
|
||||
this.hasScoredNetworkSuccessfully = hasScoredNetworkSuccessfully;
|
||||
this.initialize = initialize;
|
||||
this.reset = reset;
|
||||
|
|
@ -611,6 +733,7 @@
|
|||
this.NETWORK_TEST_START = NETWORK_TEST_START;
|
||||
this.NETWORK_TEST_DONE = NETWORK_TEST_DONE;
|
||||
this.NETWORK_TEST_FAIL = NETWORK_TEST_FAIL;
|
||||
this.NETWORK_TEST_CANCEL = NETWORK_TEST_CANCEL;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
updateButtons();
|
||||
}
|
||||
|
||||
function networkTestCancel() {
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
function networkTestStart() {
|
||||
updateButtons();
|
||||
}
|
||||
|
|
@ -63,6 +67,7 @@
|
|||
$(networkTest)
|
||||
.on(networkTest.NETWORK_TEST_DONE, networkTestDone)
|
||||
.on(networkTest.NETWORK_TEST_FAIL, networkTestFail)
|
||||
.on(networkTest.NETWORK_TEST_CANCEL, networkTestCancel)
|
||||
.on(networkTest.NETWORK_TEST_START, networkTestStart)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@
|
|||
.clearall
|
||||
.buttons
|
||||
%a.button-grey.btn-cancel{href:'#'} CANCEL
|
||||
%a.button-orange.btn-help{href: '#'} HELP
|
||||
%a.button-grey.btn-help{rel: 'external', href: 'https://jamkazam.desk.com/customer/portal/articles/1599969-first-time-setup---step-6---test-your-network'} HELP
|
||||
%a.button-orange.btn-close{href:'#'} CLOSE
|
||||
Loading…
Reference in New Issue