From 4aeaca8a3c8dd640b21cecdb5dafc3a11e12325a Mon Sep 17 00:00:00 2001 From: cmfl37 <christopher.fullarton@mni.thm.de> Date: Wed, 27 Jul 2016 12:56:11 +0200 Subject: [PATCH] Tweak connection indication color steps --- arsnova.click/client/layout/global/scripts/helpers.js | 10 ++++++++-- arsnova.click/client/layout/global/scripts/lib.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arsnova.click/client/layout/global/scripts/helpers.js b/arsnova.click/client/layout/global/scripts/helpers.js index 8b09fd2c3..537490abc 100644 --- a/arsnova.click/client/layout/global/scripts/helpers.js +++ b/arsnova.click/client/layout/global/scripts/helpers.js @@ -37,6 +37,7 @@ Template.connectionQualityHeader.helpers({ } const result = { ready: true, + failures: [], errors: [], warnings: [] }; @@ -49,12 +50,17 @@ Template.connectionQualityHeader.helpers({ if (!Session.get("connectionStatus").sessionStorage) { result.errors.push("sessionStorage"); } - if (Session.get("connectionStatus").dbConnection.serverRTT > 2000) { + if (Session.get("connectionStatus").dbConnection.serverRTT > 150) { + result.failures.push("dbConnection"); + } else if (Session.get("connectionStatus").dbConnection.serverRTT > 100) { result.errors.push("dbConnection"); - } else if (Session.get("connectionStatus").dbConnection.serverRTT > 1000) { + } else if (Session.get("connectionStatus").dbConnection.serverRTT > 50) { result.warnings.push("dbConnection"); } lib.stopPendingAnimation(); + if (result.failures.length > 0) { + return $.extend({resultString: "region.header.connection_status.finished_with_errors"}, result, {finishedWithErrors: true, statusColor: "grey"}); + } if (result.errors.length > 0) { return $.extend({resultString: "region.header.connection_status.finished_with_errors"}, result, {finishedWithErrors: true, statusColor: "red"}); } diff --git a/arsnova.click/client/layout/global/scripts/lib.js b/arsnova.click/client/layout/global/scripts/lib.js index ef1fce03d..53803e5d2 100644 --- a/arsnova.click/client/layout/global/scripts/lib.js +++ b/arsnova.click/client/layout/global/scripts/lib.js @@ -28,7 +28,7 @@ export const connectionStatus = { localStorage: false, sessionStorage: false, dbConnection: { - totalCount: 2, + totalCount: 5, currentCount: 1, serverRTT: 0, serverRTTtotal: 0 -- GitLab