diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml index 635c8c11..aecd2ffd 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml @@ -747,8 +747,6 @@ hub.client.removeAttachment = onRemoveAttachment; $.connection.hub.qs = { DeviceBatchId: '@(Model.DeviceBatch.Id)' }; - $.connection.hub.error(onHubFailed); - $.connection.hub.disconnected(onHubFailed); $.connection.hub.reconnecting(function () { $Attachments.find('span.action.enabled').addClass('disabled'); @@ -756,13 +754,10 @@ $.connection.hub.reconnected(function () { $Attachments.find('span.action.enabled').removeClass('disabled'); }); - - // Start Connection - $.connection.hub.start(function () { - $Attachments.find('span.action.enabled').removeClass('disabled'); - }).fail(onHubFailed); - - function onHubFailed(error) { + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); + }); + $.connection.hub.disconnected(function () { // Disable UI $Attachments.find('span.action.enabled').addClass('disabled'); @@ -787,7 +782,12 @@ } }); } - } + }); + + // Start Connection + $.connection.hub.start(function () { + $Attachments.find('span.action.enabled').removeClass('disabled'); + }); function onAddAttachment(id, quick) { var data = { id: id }; diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs index 47d3e9ce..0d346fa8 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs @@ -2383,42 +2383,43 @@ WriteLiteral(@"> #line default #line hidden -WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n " + -" $.connection.hub.disconnected(onHubFailed);\r\n\r\n " + -" $.connection.hub.reconnecting(function () {\r\n " + -" $Attachments.find(\'span.action.enabled\').addClass(\'disabled\');\r\n " + -" });\r\n $.connection.hub.reconne" + -"cted(function () {\r\n $Attachments.find(\'span.acti" + -"on.enabled\').removeClass(\'disabled\');\r\n });\r\n\r\n " + -" // Start Connection\r\n $.connect" + -"ion.hub.start(function () {\r\n $Attachments.find(\'" + -"span.action.enabled\').removeClass(\'disabled\');\r\n }).f" + -"ail(onHubFailed);\r\n\r\n function onHubFailed(error) {\r\n" + -" // Disable UI\r\n $" + -"Attachments.find(\'span.action.enabled\').addClass(\'disabled\');\r\n\r\n " + -" // Show Dialog Message\r\n if ($(\'" + -".disconnected-dialog\').length == 0) {\r\n $(\'\')\r\n .addClass(\'dialog disconnected-di" + -"alog\')\r\n .html(\'

Disconnected from the Disco ICT Server

This page is not" + -" receiving live updates. Please ensure you are connected to the server, then ref" + -"resh this page to enable features.
\')\r\n " + -" .dialog({\r\n resizable: false,\r\n " + -" title: \'Disconnected\',\r\n " + -" width: 400,\r\n " + -" modal: true,\r\n buttons: {\r\n " + -" \'Refresh Now\': function () {\r\n " + -" $(this).dialog(\'option\', \'buttons" + -"\', null);\r\n window.location.r" + -"eload(true);\r\n },\r\n " + -" \'Close\': function () {\r\n " + -" $(this).dialog(\'destroy\');\r\n " + -" }\r\n }\r\n " + -" });\r\n }\r\n " + -" }\r\n\r\n function onAddAttachmen" + -"t(id, quick) {\r\n var data = { id: id };\r\n " + -" $.ajax({\r\n url: \'"); +WriteLiteral("\' };\r\n\r\n $.connection.hub.reconnecting(function () {\r\n" + +" $Attachments.find(\'span.action.enabled\').addClas" + +"s(\'disabled\');\r\n });\r\n $.c" + +"onnection.hub.reconnected(function () {\r\n $Attach" + +"ments.find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " + +" });\r\n $.connection.hub.error(function (error)" + +" {\r\n console.log(\'Server connection error: \' + er" + +"ror);\r\n });\r\n $.connection" + +".hub.disconnected(function () {\r\n // Disable UI\r\n" + +" $Attachments.find(\'span.action.enabled\').addClas" + +"s(\'disabled\');\r\n\r\n // Show Dialog Message\r\n " + +" if ($(\'.disconnected-dialog\').length == 0) {\r\n " + +" $(\'
\')\r\n " + +".addClass(\'dialog disconnected-dialog\')\r\n " + +" .html(\'

<" + +"i class=\"fa fa-ban fa-stack-2x error\">Disconnected from the Disco ICT" + +" Server

This page is not receiving live updates. Please ensure you are " + +"connected to the server, then refresh this page to enable features.
\')\r\n " + +" .dialog({\r\n " + +" resizable: false,\r\n title" + +": \'Disconnected\',\r\n width: 400,\r\n " + +" modal: true,\r\n " + +" buttons: {\r\n \'R" + +"efresh Now\': function () {\r\n " + +"$(this).dialog(\'option\', \'buttons\', null);\r\n " + +" window.location.reload(true);\r\n " + +" },\r\n \'Close\': func" + +"tion () {\r\n $(this).dialog(\'d" + +"estroy\');\r\n }\r\n " + +" }\r\n });\r\n " + +" }\r\n });\r\n\r\n " + +" // Start Connection\r\n $.connection.hub.st" + +"art(function () {\r\n $Attachments.find(\'span.actio" + +"n.enabled\').removeClass(\'disabled\');\r\n });\r\n\r\n " + +" function onAddAttachment(id, quick) {\r\n " + +" var data = { id: id };\r\n $.ajax({\r\n " + +" url: \'"); #line 795 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -2908,27 +2909,27 @@ WriteLiteral("
  • \r\n WriteLiteral(" type=\"radio\""); -WriteAttribute("id", Tuple.Create(" id=\"", 56824), Tuple.Create("\"", 56894) -, Tuple.Create(Tuple.Create("", 56829), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 56829), true) +WriteAttribute("id", Tuple.Create(" id=\"", 56868), Tuple.Create("\"", 56938) +, Tuple.Create(Tuple.Create("", 56873), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 56873), true) #line 1058 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - , Tuple.Create(Tuple.Create("", 56868), Tuple.Create((int)decommissionReason + , Tuple.Create(Tuple.Create("", 56912), Tuple.Create((int)decommissionReason #line default #line hidden -, 56868), false) +, 56912), false) ); WriteLiteral("\r\n name=\"decommissionReason\""); -WriteAttribute("value", Tuple.Create(" value=\"", 56961), Tuple.Create("\"", 56995) +WriteAttribute("value", Tuple.Create(" value=\"", 57005), Tuple.Create("\"", 57039) #line 1059 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" -, Tuple.Create(Tuple.Create("", 56969), Tuple.Create((int)decommissionReason +, Tuple.Create(Tuple.Create("", 57013), Tuple.Create((int)decommissionReason #line default #line hidden -, 56969), false) +, 57013), false) ); WriteLiteral(" "); @@ -2942,15 +2943,15 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />\r\n ((int)decommissionReason + , Tuple.Create(Tuple.Create("", 57224), Tuple.Create((int)decommissionReason #line default #line hidden -, 57180), false) +, 57224), false) ); WriteLiteral(">"); diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml index fcdcec07..b3ba79a4 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml @@ -5,7 +5,8 @@ Html.BundleDeferred("~/ClientScripts/Modules/Knockout"); Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); } -

    Documents Imported Today +

    + Documents Imported Today

    @Html.AntiForgeryToken() @@ -13,7 +14,7 @@

    No imported documents today

  • \r\n #line default #line hidden WriteLiteral(@"' }; - $.connection.hub.error(connectionError); + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); + }); $.connection.hub.disconnected(connectionError); - $.connection.hub.reconnected(connectionError); // Start Connection $.connection.hub.start().fail(connectionError).done(loadData); @@ -269,7 +270,7 @@ WriteLiteral(@"' }; $.getJSON('"); - #line 144 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" + #line 145 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml" Write(Url.Action(MVC.Public.HeldDevices.HeldDevices())); @@ -399,54 +400,54 @@ WriteLiteral("\', null, function (data) {\r\n\r\n var inProce "ngth > 0)\r\n itemFilters = filters;\r\n e" + "lse\r\n itemFilters = null;\r\n }\r\n " + " }\r\n\r\n function connectionError() {\r\n try {\r\n " + -" $(\'body\').addClass(\'status-error\');\r\n $.connection" + -".hub.stop();\r\n } catch (e) {\r\n // Ignore\r\n " + -" }\r\n\r\n window.setTimeout(function () {\r\n " + -" window.location.reload(true);\r\n }, 10000);\r\n }\r\n" + -"\r\n // Helpers\r\n function rotateArray(koArray, element) {\r\n" + -" var items = koArray();\r\n\r\n if (items.length <= 1)" + -"\r\n return 0;\r\n\r\n if (element.height() < (eleme" + -"nt.parent().height() - 30)) {\r\n\r\n if (findUnsortedArrayTopInd" + -"ex(items) !== 0)\r\n koArray.sort(sortFunction);\r\n\r\n " + -" // Don\'t rotate if small & sorted correctly\r\n re" + -"turn;\r\n }\r\n\r\n // Move Last Item to Top\r\n " + -" var item = koArray.pop();\r\n koArray.unshift(item);\r\n " + -" }\r\n function removeItemFromArray(koArray, deviceSerialNumber) {\r" + -"\n var items = koArray();\r\n for (var i = 0; i < ite" + -"ms.length; i++) {\r\n if (items[i].DeviceSerialNumber == device" + -"SerialNumber) {\r\n koArray.splice(i, 1);\r\n " + -" items = koArray();\r\n i--;\r\n }\r" + -"\n }\r\n }\r\n function findUnsortedArrayTopInde" + -"x(items) {\r\n // Only one Item\r\n if (items.length <" + -"= 1)\r\n return 0;\r\n\r\n for (var i = 1; i < items" + -".length; i++) {\r\n var s = sortFunction(items[i - 1], items[i]" + -");\r\n if (s > 0)\r\n return i;\r\n " + -" }\r\n\r\n return 0;\r\n }\r\n function findS" + -"ortedInsertIndex(koArray, heldDeviceItem) {\r\n var items = koArray" + -"();\r\n var startIndex = findUnsortedArrayTopIndex(items);\r\n " + -" for (var i = startIndex; i < items.length; i++) {\r\n " + -"var s = sortFunction(heldDeviceItem, items[i]);\r\n if (s <= 0)" + -"\r\n return i;\r\n }\r\n if (star" + -"tIndex !== 0) {\r\n for (var i = 0; i < startIndex; i++) {\r\n " + -" var s = sortFunction(heldDeviceItem, items[i]);\r\n " + -" if (s <= 0)\r\n return i;\r\n " + -" }\r\n return startIndex;\r\n } else {\r\n " + -" return -1;\r\n }\r\n }\r\n functio" + -"n sortFunction(l, r) {\r\n return l.DeviceDescription.toLowerCase()" + -" == r.DeviceDescription.toLowerCase() ? 0 : (l.DeviceDescription.toLowerCase() <" + -" r.DeviceDescription.toLowerCase() ? -1 : 1)\r\n }\r\n functio" + -"n isInProcess(i) {\r\n return !i.ReadyForReturn && !i.WaitingForUse" + -"rAction;\r\n }\r\n function isReadyForReturn(i) {\r\n " + -" return i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n " + -" function isWaitingForUserAction(i) {\r\n return i.WaitingForUs" + -"erAction;\r\n }\r\n function getQueryStringParameters() {\r\n\r\n " + -" if (window.location.search.length === 0)\r\n ret" + -"urn null;\r\n\r\n var params = {};\r\n window.location.s" + -"earch.substr(1).split(\"&\").forEach(function (pair) {\r\n if (pa" + -"ir === \"\") return;\r\n var parts = pair.split(\"=\");\r\n " + -" params[parts[0]] = parts[1] && decodeURIComponent(parts[1].replace(/\\+" + -"/g, \" \"));\r\n });\r\n return params;\r\n }\r\n" + -"\r\n init();\r\n });\r\n \r\n\r\n"); +" $(\'body\').addClass(\'status-error\');\r\n } catch (e) {\r\n " + +" // Ignore\r\n }\r\n\r\n window.setTim" + +"eout(function () {\r\n window.location.reload(true);\r\n " + +" }, 10000);\r\n }\r\n\r\n // Helpers\r\n function" + +" rotateArray(koArray, element) {\r\n var items = koArray();\r\n\r\n " + +" if (items.length <= 1)\r\n return 0;\r\n\r\n " + +" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " + +" if (findUnsortedArrayTopIndex(items) !== 0)\r\n koAr" + +"ray.sort(sortFunction);\r\n\r\n // Don\'t rotate if small & sorted" + +" correctly\r\n return;\r\n }\r\n\r\n //" + +" Move Last Item to Top\r\n var item = koArray.pop();\r\n " + +" koArray.unshift(item);\r\n }\r\n function removeItemFromArr" + +"ay(koArray, deviceSerialNumber) {\r\n var items = koArray();\r\n " + +" for (var i = 0; i < items.length; i++) {\r\n if (ite" + +"ms[i].DeviceSerialNumber == deviceSerialNumber) {\r\n koArr" + +"ay.splice(i, 1);\r\n items = koArray();\r\n " + +" i--;\r\n }\r\n }\r\n }\r\n " + +" function findUnsortedArrayTopIndex(items) {\r\n // Only one Item\r\n" + +" if (items.length <= 1)\r\n return 0;\r\n\r\n " + +" for (var i = 1; i < items.length; i++) {\r\n var s = s" + +"ortFunction(items[i - 1], items[i]);\r\n if (s > 0)\r\n " + +" return i;\r\n }\r\n\r\n return 0;\r\n " + +" }\r\n function findSortedInsertIndex(koArray, heldDeviceItem) {\r\n " + +" var items = koArray();\r\n var startIndex = findUnso" + +"rtedArrayTopIndex(items);\r\n for (var i = startIndex; i < items.le" + +"ngth; i++) {\r\n var s = sortFunction(heldDeviceItem, items[i])" + +";\r\n if (s <= 0)\r\n return i;\r\n " + +" }\r\n if (startIndex !== 0) {\r\n for (var " + +"i = 0; i < startIndex; i++) {\r\n var s = sortFunction(held" + +"DeviceItem, items[i]);\r\n if (s <= 0)\r\n " + +" return i;\r\n }\r\n return startIndex" + +";\r\n } else {\r\n return -1;\r\n }\r\n" + +" }\r\n function sortFunction(l, r) {\r\n return" + +" l.DeviceDescription.toLowerCase() == r.DeviceDescription.toLowerCase() ? 0 : (l" + +".DeviceDescription.toLowerCase() < r.DeviceDescription.toLowerCase() ? -1 : 1)\r\n" + +" }\r\n function isInProcess(i) {\r\n return !i." + +"ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n function " + +"isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.WaitingForU" + +"serAction;\r\n }\r\n function isWaitingForUserAction(i) {\r\n " + +" return i.WaitingForUserAction;\r\n }\r\n function" + +" getQueryStringParameters() {\r\n\r\n if (window.location.search.leng" + +"th === 0)\r\n return null;\r\n\r\n var params = {};\r" + +"\n window.location.search.substr(1).split(\"&\").forEach(function (p" + +"air) {\r\n if (pair === \"\") return;\r\n var pa" + +"rts = pair.split(\"=\");\r\n params[parts[0]] = parts[1] && decod" + +"eURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " + +" return params;\r\n }\r\n\r\n init();\r\n });\r\n \r\n\r\n"); } } diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml index 747fbd2e..1c62f28e 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.cshtml @@ -131,9 +131,10 @@ hub.client.setTheme = setTheme; $.connection.hub.qs = { Noticeboard: '@(Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.Name)' }; - $.connection.hub.error(connectionError); + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); + }); $.connection.hub.disconnected(connectionError); - $.connection.hub.reconnected(connectionError); // Start Connection $.connection.hub.start().fail(connectionError).done(loadData); @@ -356,7 +357,6 @@ function connectionError() { try { $('body').addClass('status-error'); - $.connection.hub.stop(); } catch (e) { // Ignore } diff --git a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs index 955c04d1..5493757e 100644 --- a/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs +++ b/Disco.Web/Areas/Public/Views/UserHeldDevices/Noticeboard.generated.cs @@ -257,9 +257,10 @@ WriteLiteral(">\r\n
  • \r\n #line default #line hidden WriteLiteral(@"' }; - $.connection.hub.error(connectionError); + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); + }); $.connection.hub.disconnected(connectionError); - $.connection.hub.reconnected(connectionError); // Start Connection $.connection.hub.start().fail(connectionError).done(loadData); @@ -270,7 +271,7 @@ WriteLiteral(@"' }; $.getJSON('"); - #line 144 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" + #line 145 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml" Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices())); @@ -399,54 +400,53 @@ WriteLiteral("\', null, function (data) {\r\n\r\n var inProce "lters.length > 0)\r\n itemFilters = filters;\r\n " + " else\r\n itemFilters = null;\r\n }\r\n " + " }\r\n\r\n function connectionError() {\r\n try {\r\n " + -" $(\'body\').addClass(\'status-error\');\r\n $.co" + -"nnection.hub.stop();\r\n } catch (e) {\r\n // Igno" + -"re\r\n }\r\n\r\n window.setTimeout(function () {\r\n " + -" window.location.reload(true);\r\n }, 10000);\r\n " + -" }\r\n\r\n // Helpers\r\n function rotateArray(koArray, elem" + -"ent) {\r\n var items = koArray();\r\n\r\n if (items.leng" + -"th <= 1)\r\n return 0;\r\n\r\n if (element.height() " + -"< (element.parent().height() - 30)) {\r\n\r\n if (findUnsortedArr" + -"ayTopIndex(items) !== 0)\r\n koArray.sort(sortFunction);\r\n\r" + -"\n // Don\'t rotate if small & sorted correctly\r\n " + -" return;\r\n }\r\n\r\n // Move Last Item to Top\r\n " + -" var item = koArray.pop();\r\n koArray.unshift(item);\r" + -"\n }\r\n function removeItemFromArray(koArray, UserId) {\r\n " + -" var items = koArray();\r\n for (var i = 0; i < items.l" + -"ength; i++) {\r\n if (items[i].UserId == UserId) {\r\n " + -" koArray.splice(i, 1);\r\n items = koArray();\r\n" + -" i--;\r\n }\r\n }\r\n " + -" }\r\n function findUnsortedArrayTopIndex(items) {\r\n " + -"// Only one Item\r\n if (items.length <= 1)\r\n re" + -"turn 0;\r\n\r\n for (var i = 1; i < items.length; i++) {\r\n " + -" var s = sortFunction(items[i - 1], items[i]);\r\n if (" + -"s > 0)\r\n return i;\r\n }\r\n\r\n " + -"return 0;\r\n }\r\n function findSortedInsertIndex(koArray, he" + -"ldDeviceItem) {\r\n var items = koArray();\r\n var sta" + -"rtIndex = findUnsortedArrayTopIndex(items);\r\n for (var i = startI" + -"ndex; i < items.length; i++) {\r\n var s = sortFunction(heldDev" + -"iceItem, items[i]);\r\n if (s <= 0)\r\n re" + -"turn i;\r\n }\r\n if (startIndex !== 0) {\r\n " + -" for (var i = 0; i < startIndex; i++) {\r\n var s =" + -" sortFunction(heldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " + -" return i;\r\n }\r\n " + -" return startIndex;\r\n } else {\r\n return -1;\r\n " + -" }\r\n }\r\n function sortFunction(l, r) {\r\n " + -" return l.UserIdFriendly.toLowerCase() == r.UserIdFriendly.toLowerCas" + -"e() ? 0 : (l.UserIdFriendly.toLowerCase() < r.UserIdFriendly.toLowerCase() ? -1 " + -": 1)\r\n }\r\n function isInProcess(i) {\r\n retu" + -"rn !i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n fun" + -"ction isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.Waiti" + -"ngForUserAction;\r\n }\r\n function isWaitingForUserAction(i) " + -"{\r\n return i.WaitingForUserAction;\r\n }\r\n fu" + -"nction getQueryStringParameters() {\r\n\r\n if (window.location.searc" + -"h.length === 0)\r\n return null;\r\n\r\n var params " + -"= {};\r\n window.location.search.substr(1).split(\"&\").forEach(funct" + -"ion (pair) {\r\n if (pair === \"\") return;\r\n " + -"var parts = pair.split(\"=\");\r\n params[parts[0]] = parts[1] &&" + -" decodeURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " + -" return params;\r\n }\r\n\r\n init();\r\n });\r\n " + -"\r\n\r\n\r\n"); +" $(\'body\').addClass(\'status-error\');\r\n } catch " + +"(e) {\r\n // Ignore\r\n }\r\n\r\n windo" + +"w.setTimeout(function () {\r\n window.location.reload(true);\r\n " + +" }, 10000);\r\n }\r\n\r\n // Helpers\r\n " + +"function rotateArray(koArray, element) {\r\n var items = koArray();" + +"\r\n\r\n if (items.length <= 1)\r\n return 0;\r\n\r\n " + +" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " + +" if (findUnsortedArrayTopIndex(items) !== 0)\r\n " + +" koArray.sort(sortFunction);\r\n\r\n // Don\'t rotate if small " + +"& sorted correctly\r\n return;\r\n }\r\n\r\n " + +" // Move Last Item to Top\r\n var item = koArray.pop();\r\n " + +" koArray.unshift(item);\r\n }\r\n function removeIte" + +"mFromArray(koArray, UserId) {\r\n var items = koArray();\r\n " + +" for (var i = 0; i < items.length; i++) {\r\n if (items[i" + +"].UserId == UserId) {\r\n koArray.splice(i, 1);\r\n " + +" items = koArray();\r\n i--;\r\n " + +" }\r\n }\r\n }\r\n function findUnsortedArrayT" + +"opIndex(items) {\r\n // Only one Item\r\n if (items.le" + +"ngth <= 1)\r\n return 0;\r\n\r\n for (var i = 1; i <" + +" items.length; i++) {\r\n var s = sortFunction(items[i - 1], it" + +"ems[i]);\r\n if (s > 0)\r\n return i;\r\n " + +" }\r\n\r\n return 0;\r\n }\r\n function" + +" findSortedInsertIndex(koArray, heldDeviceItem) {\r\n var items = k" + +"oArray();\r\n var startIndex = findUnsortedArrayTopIndex(items);\r\n " + +" for (var i = startIndex; i < items.length; i++) {\r\n " + +" var s = sortFunction(heldDeviceItem, items[i]);\r\n if (s" + +" <= 0)\r\n return i;\r\n }\r\n if" + +" (startIndex !== 0) {\r\n for (var i = 0; i < startIndex; i++) " + +"{\r\n var s = sortFunction(heldDeviceItem, items[i]);\r\n " + +" if (s <= 0)\r\n return i;\r\n " + +" }\r\n return startIndex;\r\n } else {\r" + +"\n return -1;\r\n }\r\n }\r\n f" + +"unction sortFunction(l, r) {\r\n return l.UserIdFriendly.toLowerCas" + +"e() == r.UserIdFriendly.toLowerCase() ? 0 : (l.UserIdFriendly.toLowerCase() < r." + +"UserIdFriendly.toLowerCase() ? -1 : 1)\r\n }\r\n function isIn" + +"Process(i) {\r\n return !i.ReadyForReturn && !i.WaitingForUserActio" + +"n;\r\n }\r\n function isReadyForReturn(i) {\r\n r" + +"eturn i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n f" + +"unction isWaitingForUserAction(i) {\r\n return i.WaitingForUserActi" + +"on;\r\n }\r\n function getQueryStringParameters() {\r\n\r\n " + +" if (window.location.search.length === 0)\r\n return nu" + +"ll;\r\n\r\n var params = {};\r\n window.location.search." + +"substr(1).split(\"&\").forEach(function (pair) {\r\n if (pair ===" + +" \"\") return;\r\n var parts = pair.split(\"=\");\r\n " + +" params[parts[0]] = parts[1] && decodeURIComponent(parts[1].replace(/\\+/g, \" " + +"\"));\r\n });\r\n return params;\r\n }\r\n\r\n " + +" init();\r\n });\r\n \r\n\r\n\r\n"); } } diff --git a/Disco.Web/Views/Device/Show.cshtml b/Disco.Web/Views/Device/Show.cshtml index 298678f3..e3e5a0b7 100644 --- a/Disco.Web/Views/Device/Show.cshtml +++ b/Disco.Web/Views/Device/Show.cshtml @@ -147,25 +147,10 @@ hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRemoved; $.connection.hub.qs = { DeviceSerialNumber: deviceSerialNumber }; - $.connection.hub.error(onHubFailed); - $.connection.hub.disconnected(onHubFailed); - - $.connection.hub.reconnecting(function () { - $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); - $('#Comments').find('button').prop('disabled', true); + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); }); - $.connection.hub.reconnected(function () { - $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); - $('#Comments').find('button').prop('disabled', false); - }); - - // Start Connection - $.connection.hub.start(function () { - $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); - $('#Comments').find('button').prop('disabled', false); - }).fail(onHubFailed); - - function onHubFailed(error) { + $.connection.hub.disconnected(function () { // Disable UI $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); $('#Comments').find('button').prop('disabled', true); @@ -191,7 +176,22 @@ } }); } - } + }); + + $.connection.hub.reconnecting(function () { + $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); + $('#Comments').find('button').prop('disabled', true); + }); + $.connection.hub.reconnected(function () { + $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); + $('#Comments').find('button').prop('disabled', false); + }); + + // Start Connection + $.connection.hub.start(function () { + $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); + $('#Comments').find('button').prop('disabled', false); + }); }); } diff --git a/Disco.Web/Views/Device/Show.generated.cs b/Disco.Web/Views/Device/Show.generated.cs index 755e6a89..940ce4bc 100644 --- a/Disco.Web/Views/Device/Show.generated.cs +++ b/Disco.Web/Views/Device/Show.generated.cs @@ -514,39 +514,40 @@ WriteLiteral(" \r\n"); +"lNumber };\r\n $.connection.hub.error(function (error) {\r\n " + +" console.log(\'Server connection error: \' + error);\r\n })" + +";\r\n $.connection.hub.disconnected(function () {\r\n " + +" // Disable UI\r\n $(\'#AttachmentsContainer\').find(\'span.act" + +"ion.enabled\').addClass(\'disabled\');\r\n $(\'#Comments\').find(\'bu" + +"tton\').prop(\'disabled\', true);\r\n\r\n // Show Dialog Message\r\n " + +" if ($(\'.disconnected-dialog\').length == 0) {\r\n " + +" $(\'
    \')\r\n .addClass(\'dialog disconnected-d" + +"ialog\')\r\n .html(\'

    Disconnected from the Disco ICT Server

    This page is not receiving " + +"live updates. Please ensure you are connected to the server, then refresh this p" + +"age to enable features.
    \')\r\n .dialog({\r\n " + +" resizable: false,\r\n title" + +": \'Disconnected\',\r\n width: 400,\r\n " + +" modal: true,\r\n buttons: {\r\n " + +" \'Refresh Now\': function () {\r\n " + +" $(this).dialog(\'option\', \'buttons\', null);\r\n " + +" window.location.reload(true);\r\n " + +" },\r\n \'Close\': function () {\r\n " + +" $(this).dialog(\'destroy\');\r\n " + +" }\r\n }\r\n " + +" });\r\n }\r\n });\r\n\r\n $.connec" + +"tion.hub.reconnecting(function () {\r\n $(\'#AttachmentsContaine" + +"r\').find(\'span.action.enabled\').addClass(\'disabled\');\r\n $(\'#C" + +"omments\').find(\'button\').prop(\'disabled\', true);\r\n });\r\n " + +" $.connection.hub.reconnected(function () {\r\n $(\'#Attac" + +"hmentsContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " + +" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n " + +" });\r\n\r\n // Start Connection\r\n $.connection.hub" + +".start(function () {\r\n $(\'#AttachmentsContainer\').find(\'span." + +"action.enabled\').removeClass(\'disabled\');\r\n $(\'#Comments\').fi" + +"nd(\'button\').prop(\'disabled\', false);\r\n });\r\n });\r\n " + +" \r\n"); #line 197 "..\..\Views\Device\Show.cshtml" diff --git a/Disco.Web/Views/Job/JobParts/Resources.cshtml b/Disco.Web/Views/Job/JobParts/Resources.cshtml index d43ec7ab..3e2e8fef 100644 --- a/Disco.Web/Views/Job/JobParts/Resources.cshtml +++ b/Disco.Web/Views/Job/JobParts/Resources.cshtml @@ -567,9 +567,6 @@ } $.connection.hub.qs = { JobId: jobId }; - $.connection.hub.error(onHubFailed); - $.connection.hub.disconnected(onHubFailed); - $.connection.hub.reconnecting(function () { $('#CommentsContainer').find('span.action').addClass('disabled'); $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); @@ -578,14 +575,10 @@ $('#CommentsContainer').find('span.action').removeClass('disabled'); $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); }); - - // Start Connection - $.connection.hub.start(function () { - $('#CommentsContainer').find('span.action').removeClass('disabled'); - $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); - }).fail(onHubFailed); - - function onHubFailed(error) { + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); + }); + $.connection.hub.disconnected(function () { // Disable UI $('#CommentsContainer').find('textarea.commentInput').attr('readonly', 'readonly'); $('#CommentsContainer').find('span.action').addClass('disabled'); @@ -612,7 +605,13 @@ } }); } - } + }); + + // Start Connection + $.connection.hub.start(function () { + $('#CommentsContainer').find('span.action').removeClass('disabled'); + $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); + }); //#endregion }); diff --git a/Disco.Web/Views/Job/JobParts/Resources.generated.cs b/Disco.Web/Views/Job/JobParts/Resources.generated.cs index c44594be..042fb011 100644 --- a/Disco.Web/Views/Job/JobParts/Resources.generated.cs +++ b/Disco.Web/Views/Job/JobParts/Resources.generated.cs @@ -1337,42 +1337,42 @@ WriteLiteral(@" #line default #line hidden WriteLiteral("\r\n $.connection.hub.qs = { JobId: jobId };\r\n $.connection.h" + -"ub.error(onHubFailed);\r\n $.connection.hub.disconnected(onHubFailed);\r" + -"\n\r\n $.connection.hub.reconnecting(function () {\r\n $(\'#" + -"CommentsContainer\').find(\'span.action\').addClass(\'disabled\');\r\n $" + -"(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'disabled\');\r\n " + -" });\r\n $.connection.hub.reconnected(function () {\r\n " + -" $(\'#CommentsContainer\').find(\'span.action\').removeClass(\'disabled\');\r\n " + -" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').removeClass(\'" + -"disabled\');\r\n });\r\n\r\n // Start Connection\r\n $.c" + -"onnection.hub.start(function () {\r\n $(\'#CommentsContainer\').find(" + -"\'span.action\').removeClass(\'disabled\');\r\n $(\'#AttachmentsContaine" + -"r\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n }).fail(on" + -"HubFailed);\r\n\r\n function onHubFailed(error) {\r\n // Dis" + -"able UI\r\n $(\'#CommentsContainer\').find(\'textarea.commentInput\').a" + -"ttr(\'readonly\', \'readonly\');\r\n $(\'#CommentsContainer\').find(\'span" + -".action\').addClass(\'disabled\');\r\n $(\'#AttachmentsContainer\').find" + -"(\'span.action.enabled\').addClass(\'disabled\');\r\n\r\n // Show Dialog " + -"Message\r\n if ($(\'.disconnected-dialog\').length == 0) {\r\n " + -" $(\'
    \')\r\n .addClass(\'dialog disconnected-di" + -"alog\')\r\n .html(\'

    " + -"Disconnected from the Disco ICT Server

    This page is not receiving live " + -"updates. Please ensure you are connected to the server, then refresh this page t" + -"o enable features.
    \')\r\n .dialog({\r\n " + -" resizable: false,\r\n title: \'Disconnected\'," + -"\r\n width: 400,\r\n modal: tr" + -"ue,\r\n buttons: {\r\n \'Re" + -"fresh Now\': function () {\r\n $(this).dialog(\'o" + -"ption\', \'buttons\', null);\r\n window.location.r" + -"eload(true);\r\n },\r\n " + -" \'Close\': function () {\r\n $(this).dialog(\'de" + -"stroy\');\r\n }\r\n }\r\n " + -" });\r\n }\r\n }\r\n\r\n //#endr" + -"egion\r\n });\r\n \r\n"); +"ub.reconnecting(function () {\r\n $(\'#CommentsContainer\').find(\'spa" + +"n.action\').addClass(\'disabled\');\r\n $(\'#AttachmentsContainer\').fin" + +"d(\'span.action.enabled\').addClass(\'disabled\');\r\n });\r\n $.c" + +"onnection.hub.reconnected(function () {\r\n $(\'#CommentsContainer\')" + +".find(\'span.action\').removeClass(\'disabled\');\r\n $(\'#AttachmentsCo" + +"ntainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n });\r" + +"\n $.connection.hub.error(function (error) {\r\n console." + +"log(\'Server connection error: \' + error);\r\n });\r\n $.connec" + +"tion.hub.disconnected(function () {\r\n // Disable UI\r\n " + +" $(\'#CommentsContainer\').find(\'textarea.commentInput\').attr(\'readonly\', \'read" + +"only\');\r\n $(\'#CommentsContainer\').find(\'span.action\').addClass(\'d" + +"isabled\');\r\n $(\'#AttachmentsContainer\').find(\'span.action.enabled" + +"\').addClass(\'disabled\');\r\n\r\n // Show Dialog Message\r\n " + +" if ($(\'.disconnected-dialog\').length == 0) {\r\n $(\'
    \')" + +"\r\n .addClass(\'dialog disconnected-dialog\')\r\n " + +" .html(\'

    Disconnected from the" + +" Disco ICT Server

    This page is not receiving live updates. Please ensur" + +"e you are connected to the server, then refresh this page to enable features.\')\r\n .dialog({\r\n resizable:" + +" false,\r\n title: \'Disconnected\',\r\n " + +" width: 400,\r\n modal: true,\r\n " + +" buttons: {\r\n \'Refresh Now\': function " + +"() {\r\n $(this).dialog(\'option\', \'buttons\', nu" + +"ll);\r\n window.location.reload(true);\r\n " + +" },\r\n \'Close\': function (" + +") {\r\n $(this).dialog(\'destroy\');\r\n " + +" }\r\n }\r\n }" + +");\r\n }\r\n });\r\n\r\n // Start Connection\r\n " + +" $.connection.hub.start(function () {\r\n $(\'#CommentsContain" + +"er\').find(\'span.action\').removeClass(\'disabled\');\r\n $(\'#Attachmen" + +"tsContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " + +"});\r\n\r\n //#endregion\r\n });\r\n \r\n"); - #line 620 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 619 "..\..\Views\Job\JobParts\Resources.cshtml" } #line default diff --git a/Disco.Web/Views/User/Show.cshtml b/Disco.Web/Views/User/Show.cshtml index 58a25f07..a3514a07 100644 --- a/Disco.Web/Views/User/Show.cshtml +++ b/Disco.Web/Views/User/Show.cshtml @@ -137,25 +137,10 @@ hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRemoved; $.connection.hub.qs = { UserId: userId }; - $.connection.hub.error(onHubFailed); - $.connection.hub.disconnected(onHubFailed); - - $.connection.hub.reconnecting(function () { - $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); - $('#Comments').find('button').prop('disabled', true); + $.connection.hub.error(function (error) { + console.log('Server connection error: ' + error); }); - $.connection.hub.reconnected(function () { - $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); - $('#Comments').find('button').prop('disabled', false); - }); - - // Start Connection - $.connection.hub.start(function () { - $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); - $('#Comments').find('button').prop('disabled', false); - }).fail(onHubFailed); - - function onHubFailed(error) { + $.connection.hub.disconnected(function () { // Disable UI $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); $('#Comments').find('button').prop('disabled', true); @@ -181,7 +166,22 @@ } }); } - } + }); + + $.connection.hub.reconnecting(function () { + $('#AttachmentsContainer').find('span.action.enabled').addClass('disabled'); + $('#Comments').find('button').prop('disabled', true); + }); + $.connection.hub.reconnected(function () { + $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); + $('#Comments').find('button').prop('disabled', false); + }); + + // Start Connection + $.connection.hub.start(function () { + $('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled'); + $('#Comments').find('button').prop('disabled', false); + }); }); } diff --git a/Disco.Web/Views/User/Show.generated.cs b/Disco.Web/Views/User/Show.generated.cs index 9ff035d9..5fa96557 100644 --- a/Disco.Web/Views/User/Show.generated.cs +++ b/Disco.Web/Views/User/Show.generated.cs @@ -456,40 +456,40 @@ WriteLiteral(" \r\n"); +"onnection.hub.qs = { UserId: userId };\r\n $.connection.hub.error(f" + +"unction (error) {\r\n console.log(\'Server connection error: \' +" + +" error);\r\n });\r\n $.connection.hub.disconnected(fun" + +"ction () {\r\n // Disable UI\r\n $(\'#Attachmen" + +"tsContainer\').find(\'span.action.enabled\').addClass(\'disabled\');\r\n " + +" $(\'#Comments\').find(\'button\').prop(\'disabled\', true);\r\n\r\n " + +" // Show Dialog Message\r\n if ($(\'.disconnected-dialog\').leng" + +"th == 0) {\r\n $(\'
    \')\r\n .add" + +"Class(\'dialog disconnected-dialog\')\r\n .html(\'

    Disconnected from the Disco ICT Server

    This page is not receiving live updates. Please ensure you are connected to the" + +" server, then refresh this page to enable features.
    \')\r\n " + +" .dialog({\r\n resizable: false,\r\n " + +" title: \'Disconnected\',\r\n w" + +"idth: 400,\r\n modal: true,\r\n " + +" buttons: {\r\n \'Refresh Now\': functio" + +"n () {\r\n $(this).dialog(\'option\', \'button" + +"s\', null);\r\n window.location.reload(true)" + +";\r\n },\r\n \'" + +"Close\': function () {\r\n $(this).dialog(\'d" + +"estroy\');\r\n }\r\n " + +" }\r\n });\r\n }\r\n });" + +"\r\n\r\n $.connection.hub.reconnecting(function () {\r\n " + +" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'disabled\')" + +";\r\n $(\'#Comments\').find(\'button\').prop(\'disabled\', true);\r\n " + +" });\r\n $.connection.hub.reconnected(function () {\r\n " + +" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').remove" + +"Class(\'disabled\');\r\n $(\'#Comments\').find(\'button\').prop(\'disa" + +"bled\', false);\r\n });\r\n\r\n // Start Connection\r\n " + +" $.connection.hub.start(function () {\r\n $(\'#Attach" + +"mentsContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " + +" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n " + +" });\r\n });\r\n \r\n"); #line 187 "..\..\Views\User\Show.cshtml"