diff --git a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs index 1897a934..2c39f387 100644 --- a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs +++ b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs @@ -60,6 +60,24 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to Operations have returned to nominal.. + /// + internal static string AllClear_Text { + get { + return ResourceManager.GetString("AllClear_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All Clear. + /// + internal static string AllClear_Title { + get { + return ResourceManager.GetString("AllClear_Title", resourceCulture); + } + } + /// /// Looks up a localized string similar to The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time.. /// diff --git a/Logic/Resources/Logic.Support.ErrorMessages.resx b/Logic/Resources/Logic.Support.ErrorMessages.resx index 3607ea86..2ee0f00f 100644 --- a/Logic/Resources/Logic.Support.ErrorMessages.resx +++ b/Logic/Resources/Logic.Support.ErrorMessages.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Operations have returned to nominal. + + + All Clear + The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time. diff --git a/Site/Master-v5.master b/Site/Master-v5.master index c669f5f3..7c260081 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -780,6 +780,7 @@ var _errorDisplay_clientSocketLost = SwarmopsJS.unescape('<%=this.Localized_ClientError_SocketFail%>'); var _errorDisplay_clientHeartbeatLost = SwarmopsJS.unescape('<%=this.Localized_ClientError_HeartbeatFail%>'); + var _errorDisplay_allClear = SwarmopsJS.unescape('<%=this.Localized_AllErrorsClear%>'); diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index 29cdb0e5..59f6fcc7 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -535,6 +535,11 @@ namespace Swarmops.Frontend get { return CommonV5.JavascriptEscape(ErrorMessages.Localized("Client_ServerHeartbeatLost")); } } + public string Localized_AllErrorsClear + { + get { return CommonV5.JavascriptEscape(ErrorMessages.Localized("AllClear")); } + } + public string GenerateBitIdToken { get diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 9ca4e3dd..46c81b10 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -6,7 +6,6 @@ var _masterWatchingHeartbeat = false; var _masterSocketLastHeartbeat = -1; var _masterAuthenticationTicket = ""; - function _masterInitializeSocket(authenticationTicket) { // Our first call should always be with an auth ticket; save this for later use @@ -38,13 +37,13 @@ function _masterInitializeSocket(authenticationTicket) { if (_error_ClientSocketLost) { _error_ClientSocketLost = false; - updateMalfunctions(); + _master_updateMalfunctions(); } // If this is the first .open, start the heartbeat watcher if (!_masterWatchingHeartbeat) { - watchHeartbeat(); + _master_watchHeartbeat(); } }; @@ -52,10 +51,10 @@ function _masterInitializeSocket(authenticationTicket) { console.log("MasterSocket.OnClose();"); _error_ClientSocketLost = true; - updateMalfunctions(); + _master_updateMalfunctions(); if (!_masterWatchingHeartbeat) { - watchHeartbeat(); // begin watch heartbeat if open never happened + _master_watchHeartbeat(); // begin watch heartbeat if open never happened } }; @@ -65,7 +64,7 @@ function _masterInitializeSocket(authenticationTicket) { if (!_error_ClientSocketLost) { alertify.error("WARNING: Socket connection error - realtime updates will not be available"); _error_ClientSocketLost = true; - updateMalfunctions(); + _master_updateMalfunctions(); } }; @@ -82,7 +81,7 @@ function _masterInitializeSocket(authenticationTicket) { if (_masterSocketHeartbeatsLost) { console.log(" - receiving heartbeats again"); _masterSocketHeartbeatsLost = false; - updateMalfunctions(); + _master_updateMalfunctions(); } } else if (message.MessageType == "BitcoinReceived") { @@ -100,7 +99,7 @@ function _masterInitializeSocket(authenticationTicket) { } } else if (message.MessageType == "Malfunctions") { - updateMalfunctions (message.MalfunctionsList); + _master_updateMalfunctions (message.MalfunctionsList); } else if (message.MessageType == "SandboxUpdate") { if (odoLocalParticipation != undefined) { // Real ugly accessing specific page elements here, but it's temporary @@ -113,7 +112,7 @@ function _masterInitializeSocket(authenticationTicket) { }; } -function watchHeartbeat() { +function _master_watchHeartbeat() { console.log("WatchHeartbeat()"); _masterWatchingHeartbeat = true; @@ -121,7 +120,7 @@ function watchHeartbeat() { // Check again for a new heartbeat in ten seconds setTimeout(function () { - watchHeartbeat(); + _master_watchHeartbeat(); }, 10000); // Have we lost the socket connection? If so, take this cadence opportunity to try reconnecting @@ -142,7 +141,7 @@ function watchHeartbeat() { if (diff > 15) { console.log(" - Heartbeats LOST"); _masterSocketHeartbeatsLost = true; - updateMalfunctions(); + _master_updateMalfunctions(); } } else { console.log(" - no previous heartbeat received"); @@ -160,7 +159,7 @@ function getMasterSocketAddress() { } -function updateMalfunctions(issueList) { +function _master_updateMalfunctions(issueList) { console.log("UpdateMalfunctions();"); @@ -176,16 +175,16 @@ function updateMalfunctions(issueList) { } if (_error_ClientSocketLost) { - issueList.push(constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); + issueList.push(_master_constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); } else if (_masterSocketHeartbeatsLost) { - issueList.push(constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); + issueList.push(_master_constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); } - updateListBox($('#divMalfunctionsList'), issueList); + _master_updateListBox($('#divMalfunctionsList'), issueList); } -function constructMalfunctionData(id, text, icon, link) { +function _master_constructMalfunctionData(id, text, icon, link) { var newItem = {}; newItem.Id = id; newItem.Text = text; @@ -202,13 +201,29 @@ var _error_ClientSocketLost = false; // ------------------- List updating -------------------------- -function updateListBox(box, listArray) { +function _master_updateListBox(box, listArray) { // list is an array of object { id, text } // box is a div-div-ul-li nest containing the li:s with the id // the function syncs the box to the list with some nice fades console.log("UpdateListBox();"); + var listContainer = $(box).parent().parent(); + var listElements = $(box).children(); + + // If the list is empty but the box wasn't, add an "all clear" message + // to the list of items and set timer to remove it + + // TODO: Make the "all clear" message dependent on which box we're dealing with + + if (listElements.length > 0 && listArray.length == 0) { + listContainer.attr("allClear", "true"); + listArray.push(_master_constructMalfunctionData("AllClear", _errorDisplay_allClear, "/Images/Icons/iconshock-greentick-16px.png")); + setTimeout(function() { _master_removeAllClearMessage(listContainer, listElements); }, 10000); + } else { + listContainer.attr("allClear", "false"); + } + // Is the box visible right now? var boxVisible = $(box).is(":visible"); @@ -231,8 +246,6 @@ function updateListBox(box, listArray) { console.log(" - step 2"); var idBoxLookup = {}; - var listContainer = $(box).parent().parent(); - var listElements = $(box).children(); if (listElements.length > 0) { listElements.children().each(function (index) { @@ -269,7 +282,14 @@ function updateListBox(box, listArray) { listArray.forEach(function(item, index) { if (idBoxLookup[item.Id] != true) { - var newItem = $("
  • " + item.Text + "
  • ").hide(); + var html = "
  • "; + var newItem = $(html).hide(); $(listElements).append(newItem); newItem.slideDown(); } @@ -291,6 +311,15 @@ function updateListBox(box, listArray) { } +function _master_removeAllClearMessage(domIssueContainer, domIssuesList) { + if ($(domIssueContainer).attr("allClear") == "true") { + $(domIssueContainer).fadeOut(500).slideUp(300); + $(domIssuesList).children().each(function() { + $(this).slideUp(400, function() { $(this).remove(); }); + }); + } +} + // ------------------- SwarmopsJS object ---------------------- diff --git a/Site/Style/style-v5.css b/Site/Style/style-v5.css index a7b19ac8..34961033 100644 --- a/Site/Style/style-v5.css +++ b/Site/Style/style-v5.css @@ -1158,6 +1158,7 @@ div#divMalfunctionsList > ul > li { padding-left: 30px; padding-bottom: 5px; line-height: 140%; + background-size: 24px 24px; } div#divMalfunctionsList > ul > li+li {