#172 attempt reconnect if signalR disconnects

This commit is contained in:
Gary Sharp
2025-07-17 12:44:06 +10:00
parent f8fd1a58a3
commit 0905a02aea
20 changed files with 539 additions and 524 deletions
@@ -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 };
@@ -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 $(\'<d" +
"iv>\')\r\n .addClass(\'dialog disconnected-di" +
"alog\')\r\n .html(\'<h3><span class=\"fa-stack" +
" fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x er" +
"ror\"></i></span>Disconnected from the Disco ICT Server</h3><div>This page is not" +
" receiving live updates. Please ensure you are connected to the server, then ref" +
"resh this page to enable features.</div>\')\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 " +
" $(\'<div>\')\r\n " +
".addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><" +
"i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the Disco ICT" +
" Server</h3><div>This page is not receiving live updates. Please ensure you are " +
"connected to the server, then refresh this page to enable features.</div>\')\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(" <li>\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<System.Object, System.Int32>((int)decommissionReason
, Tuple.Create(Tuple.Create("", 56912), Tuple.Create<System.Object, System.Int32>((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<System.Object, System.Int32>((int)decommissionReason
, Tuple.Create(Tuple.Create("", 57013), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default
#line hidden
, 56969), false)
, 57013), false)
);
WriteLiteral(" ");
@@ -2942,15 +2943,15 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" />\r\n <label");
WriteAttribute("for", Tuple.Create(" for=\"", 57135), Tuple.Create("\"", 57206)
, Tuple.Create(Tuple.Create("", 57141), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 57141), true)
WriteAttribute("for", Tuple.Create(" for=\"", 57179), Tuple.Create("\"", 57250)
, Tuple.Create(Tuple.Create("", 57185), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 57185), true)
#line 1060 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
, Tuple.Create(Tuple.Create("", 57180), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
, Tuple.Create(Tuple.Create("", 57224), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default
#line hidden
, 57180), false)
, 57224), false)
);
WriteLiteral(">");
@@ -5,7 +5,8 @@
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
<h2>Documents Imported Today
<h2>
Documents Imported Today
</h2>
<div id="importStatus">
@Html.AntiForgeryToken()
@@ -56,9 +57,11 @@
<table class="logEventsViewport">
<thead>
<tr>
<th class="icon">&nbsp;
<th class="icon">
&nbsp;
</th>
<th class="message">Message
<th class="message">
Message
</th>
</tr>
</thead>
@@ -309,13 +312,10 @@
logHub.client.receiveLog = parseLog
$.connection.hub.qs = { LogModules: '@(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName)' };
$.connection.hub.error(onHubFailed);
$.connection.hub.start()
.done(function () { isLive = true; })
.fail(onHubFailed);
function onHubFailed(error) {
$.connection.hub.error(function (error) {
console.log('Server connection error: ' + error);
});
$.connection.hub.disconnected(function () {
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
@@ -337,7 +337,11 @@
}
});
}
}
});
$.connection.hub.start()
.done(function () { isLive = true; });
}
init();
});
@@ -55,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line default
#line hidden
WriteLiteral("\r\n<h2>Documents Imported Today\r\n</h2>\r\n<div");
WriteLiteral("\r\n<h2>\r\n Documents Imported Today\r\n</h2>\r\n<div");
WriteLiteral(" id=\"importStatus\"");
@@ -64,7 +64,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 11 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 12 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Html.AntiForgeryToken());
@@ -210,12 +210,14 @@ WriteLiteral(">\r\n <thead>\r\n <tr>\r
WriteLiteral(" class=\"icon\"");
WriteLiteral(">&nbsp;\r\n </th>\r\n <th");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n " +
" <th");
WriteLiteral(" class=\"message\"");
WriteLiteral(">Message\r\n </th>\r\n </tr>\r\n " +
" </thead>\r\n </table>\r\n <div");
WriteLiteral(">\r\n Message\r\n </th>\r\n " +
" </tr>\r\n </thead>\r\n </tab" +
"le>\r\n <div");
WriteLiteral(" class=\"logEventsViewportContainer\"");
@@ -287,7 +289,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host =
"var urlDeviceShow = \'");
#line 104 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Device.Show()));
@@ -296,7 +298,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host =
WriteLiteral("/\'\r\n var urlJobShow = \'");
#line 105 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Job.Show()));
@@ -305,7 +307,7 @@ WriteLiteral("/\'\r\n var urlJobShow = \'");
WriteLiteral("/\'\r\n var urlUserShow = \'");
#line 106 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 109 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.User.Show()));
@@ -314,7 +316,7 @@ WriteLiteral("/\'\r\n var urlUserShow = \'");
WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 110 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()));
@@ -323,7 +325,7 @@ WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
#line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 111 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Config.DocumentTemplate.Index()));
@@ -332,7 +334,7 @@ WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
#line 109 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 112 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()));
@@ -444,7 +446,7 @@ WriteLiteral("\';\r\n var isLive = false;\r\n\r\n function pageVie
"n\"]\').val()\r\n };\r\n $.ajax({\r\n url: \'");
#line 288 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 291 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
@@ -476,32 +478,33 @@ WriteLiteral(@"',
$.connection.hub.qs = { LogModules: '");
#line 311 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 314 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName);
#line default
#line hidden
WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n\r\n $.connectio" +
"n.hub.start()\r\n .done(function () { isLive = true; })\r\n " +
" .fail(onHubFailed);\r\n\r\n function onHubFailed(error) {\r\n " +
" // Show Dialog Message\r\n if ($(\'.disconnected-dialog\').le" +
"ngth == 0) {\r\n $(\'<div>\')\r\n .addClass(" +
"\'dialog disconnected-dialog\')\r\n .html(\'<h3><span class=\"f" +
"a-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stac" +
"k-2x error\"></i></span>Disconnected from the Disco ICT Server</h3><div>This page" +
" is not receiving live updates. Please ensure you are connected to the server, t" +
"hen refresh this page to enable features.</div>\')\r\n .dial" +
"og({\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 init();\r\n });\r\n</script>\r\n");
WriteLiteral("\' };\r\n $.connection.hub.error(function (error) {\r\n cons" +
"ole.log(\'Server connection error: \' + error);\r\n });\r\n $.co" +
"nnection.hub.disconnected(function () {\r\n // Show Dialog Message\r" +
"\n if ($(\'.disconnected-dialog\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass(\'dialog disconnected-dialog\')\r\n" +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-" +
"wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconne" +
"cted from the Disco ICT Server</h3><div>This page is not receiving live updates." +
" Please ensure you are connected to the server, then refresh this page to enable" +
" features.</div>\')\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 No" +
"w\': function () {\r\n $(this).dialog(\'option\', " +
"\'buttons\', null);\r\n window.location.reload(tr" +
"ue);\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 $.connection." +
"hub.start()\r\n .done(function () { isLive = true; });\r\n\r\n }" +
"\r\n init();\r\n });\r\n</script>\r\n");
}
}
@@ -407,13 +407,10 @@
logHub.client.receiveLog = parseLog
$.connection.hub.qs = { LogModules: '@(Disco.Services.Devices.Enrolment.EnrolmentLog.Current.LiveLogGroupName)' };
$.connection.hub.error(onHubFailed);
$.connection.hub.start()
.done(function () { isLive = true; })
.fail(onHubFailed);
function onHubFailed(error) {
$.connection.hub.error(function (error) {
console.log('Server connection error: ' + error);
});
$.connection.hub.disconnected(function (error) {
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
@@ -435,7 +432,11 @@
}
});
}
}
});
$.connection.hub.start()
.done(function () { isLive = true; });
}
$('#dialogSession').on('click', '#formResolveSessionPending button', function (e) {
const $button = $(this);
@@ -831,34 +831,35 @@ WriteLiteral(@"',
#line default
#line hidden
WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n\r\n $.connectio" +
"n.hub.start()\r\n .done(function () { isLive = true; })\r\n " +
" .fail(onHubFailed);\r\n\r\n function onHubFailed(error) {\r\n " +
" // Show Dialog Message\r\n if ($(\'.disconnected-dialog\').le" +
"ngth == 0) {\r\n $(\'<div>\')\r\n .addClass(" +
"\'dialog disconnected-dialog\')\r\n .html(\'<h3><span class=\"f" +
"a-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stac" +
"k-2x error\"></i></span>Disconnected from the Disco ICT Server</h3><div>This page" +
" is not receiving live updates. Please ensure you are connected to the server, t" +
"hen refresh this page to enable features.</div>\')\r\n .dial" +
"og({\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 $(\'#dialogSession\').on(\'click\', \'#formResolveSessionPending" +
" button\', function (e) {\r\n const $button = $(this);\r\n cons" +
"t $form = $button.closest(\'form\');\r\n const body = new FormData($form[" +
"0]);\r\n body.append(\'approve\', $button.val());\r\n fetch($for" +
"m.attr(\'action\'), {\r\n method: \'POST\',\r\n body: body" +
"\r\n }).then(function (response) {\r\n if (!response.ok) {" +
"\r\n alert(\'Failed to resolve pending session: \' + response.sta" +
"tusText);\r\n }\r\n });\r\n });\r\n init();\r\n " +
" });\r\n</script>\r\n");
WriteLiteral("\' };\r\n $.connection.hub.error(function (error) {\r\n cons" +
"ole.log(\'Server connection error: \' + error);\r\n });\r\n $.co" +
"nnection.hub.disconnected(function (error) {\r\n // Show Dialog Mes" +
"sage\r\n if ($(\'.disconnected-dialog\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass(\'dialog disconnected-dialo" +
"g\')\r\n .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"f" +
"a fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Dis" +
"connected from the Disco ICT Server</h3><div>This page is not receiving live upd" +
"ates. Please ensure you are connected to the server, then refresh this page to e" +
"nable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: true," +
"\r\n buttons: {\r\n \'Refre" +
"sh Now\': function () {\r\n $(this).dialog(\'opti" +
"on\', \'buttons\', null);\r\n window.location.relo" +
"ad(true);\r\n },\r\n \'" +
"Close\': function () {\r\n $(this).dialog(\'destr" +
"oy\');\r\n }\r\n }\r\n " +
" });\r\n }\r\n });\r\n\r\n $.connec" +
"tion.hub.start()\r\n .done(function () { isLive = true; });\r\n\r\n " +
" }\r\n $(\'#dialogSession\').on(\'click\', \'#formResolveSessionPending butto" +
"n\', function (e) {\r\n const $button = $(this);\r\n const $for" +
"m = $button.closest(\'form\');\r\n const body = new FormData($form[0]);\r\n" +
" body.append(\'approve\', $button.val());\r\n fetch($form.attr" +
"(\'action\'), {\r\n method: \'POST\',\r\n body: body\r\n " +
" }).then(function (response) {\r\n if (!response.ok) {\r\n " +
" alert(\'Failed to resolve pending session: \' + response.statusTex" +
"t);\r\n }\r\n });\r\n });\r\n init();\r\n });\r\n" +
"</script>\r\n");
}
}
@@ -122,11 +122,10 @@
};
$.connection.hub.qs = {LogModules: logModuleLiveGroupName};
$.connection.hub.error(onHubFailed);
$.connection.hub.start().fail(onHubFailed);
function onHubFailed(error) {
$.connection.hub.error(function (error) {
console.log('Server connection error: ' + error);
});
$.connection.hub.disconnected(function () {
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
@@ -148,7 +147,9 @@
}
});
}
}
})
$.connection.hub.start();
}
}
@@ -340,29 +340,30 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"ge.UseDisplay) logsViewModel.EventLogs.unshift(message);\r\n " +
" if (liveEventReceivedFunction) liveEventReceivedFunction(message);\r\n " +
" };\r\n\r\n $.connection.hub.qs = {LogModules: logModule" +
"LiveGroupName};\r\n $.connection.hub.error(onHubFailed);\r\n\r\n " +
" $.connection.hub.start().fail(onHubFailed);\r\n\r\n " +
" function onHubFailed(error) {\r\n // Show Dialog Messag" +
"e\r\n if ($(\'.disconnected-dialog\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass(\'dial" +
"og disconnected-dialog\')\r\n .html(\'<h3><span class" +
"=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-s" +
"tack-2x error\"></i></span>Disconnected from the Disco ICT Server</h3><div>This p" +
"age is not receiving live updates. Please ensure you are connected to the server" +
", then refresh this page to enable features.</div>\')\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" +
" }\r\n\r\n loadInitialData();\r\n });\r\n </script>\r\n</d" +
"iv>\r\n");
"LiveGroupName};\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 // Show Dialog Message\r\n if " +
"($(\'.disconnected-dialog\').length == 0) {\r\n $(\'<div>\'" +
")\r\n .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa" +
" fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disc" +
"onnected from the Disco ICT Server</h3><div>This page is not receiving live upda" +
"tes. Please ensure you are connected to the server, then refresh this page to en" +
"able features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n ti" +
"tle: \'Disconnected\',\r\n width: 400,\r\n " +
" modal: true,\r\n but" +
"tons: {\r\n \'Refresh Now\': function () {\r\n " +
" $(this).dialog(\'option\', \'buttons\', n" +
"ull);\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 $.connection.hub.start();\r" +
"\n }\r\n }\r\n\r\n loadInitialData();\r\n });" +
"\r\n </script>\r\n</div>\r\n");
}
}
@@ -147,7 +147,6 @@
if (self.FullUpdateToken)
window.clearTimeout(self.FullUpdateToken);
$.connection.hub.stop();
if (self.FinishedMessage())
window.setTimeout(function () { window.location.href = self.FinishedUrl(); }, 3000);
@@ -247,13 +246,10 @@
notificationsHub.client.updateTaskStatus = vm.Update;
$.connection.hub.qs = { TaskSessionId: sessionId };
$.connection.hub.error(onHubFailed);
$.connection.hub.start()
.fail(onHubFailed);
}
function onHubFailed(error) {
$.connection.hub.error(function (error) {
console.log('Server connection error: ' + error);
});
$.connection.hub.disconnected(function () {
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
@@ -275,6 +271,10 @@
}
});
}
})
$.connection.hub.start()
.fail(onHubFailed);
}
});
@@ -229,75 +229,77 @@ WriteLiteral("\';\r\n\r\n var view = $(\'#Logging_Task_Status\');\r\n
" if (self.FinishedTimestamp()) {\r\n if (self.FinishedUrl()" +
" && !self.TaskExceptionMessage()) {\r\n\r\n if (self.FullUpda" +
"teToken)\r\n window.clearTimeout(self.FullUpdateToken);" +
"\r\n $.connection.hub.stop();\r\n\r\n if" +
" (self.FinishedMessage())\r\n window.setTimeout(functio" +
"n () { window.location.href = self.FinishedUrl(); }, 3000);\r\n " +
" else\r\n window.location.href = self.FinishedUrl()" +
";\r\n }\r\n }\r\n }\r\n\r\n self.I" +
"nitialize = function (taskStatus) {\r\n self.TaskName(taskStatus.Ta" +
"skName);\r\n self.FinishedUrl(taskStatus.FinishedUrl);\r\n\r\n " +
" self.Progress(taskStatus.Progress);\r\n self.CurrentProcess(" +
"taskStatus.CurrentProcess);\r\n self.CurrentDescription(taskStatus." +
"CurrentDescription);\r\n\r\n self.IsRunning(taskStatus.IsRunning);\r\n\r" +
"\n self.TaskExceptionMessage(taskStatus.TaskExceptionMessage);\r\n\r\n" +
" self.FinishedTimestamp(taskStatus.FinishedTimestamp);\r\n " +
" self.NextScheduledTimestamp(taskStatus.NextScheduledTimestamp);\r\n\r\n " +
" self.FinishedMessage(taskStatus.FinishedMessage);\r\n\r\n s" +
"elf.Initialized(true);\r\n\r\n self.Finished();\r\n }\r\n " +
" self.Update = function (taskStatus) {\r\n if (!self.Initiali" +
"zed())\r\n return;\r\n\r\n if (self.FullUpdateToken)" +
"\r\n window.clearTimeout(self.FullUpdateToken);\r\n\r\n " +
" if (taskStatus) {\r\n $.each(taskStatus, function (key, val" +
"ue) {\r\n switch (key) {\r\n case " +
"\'Progress\':\r\n self.Progress(value);\r\n " +
" break;\r\n case \'CurrentProcess\':\r\n" +
" self.CurrentProcess(value);\r\n " +
" break;\r\n case \'CurrentDescription\':\r\n " +
" self.CurrentDescription(value);\r\n " +
" break;\r\n case \'IsRunning\':\r\n " +
" self.IsRunning(value);\r\n bre" +
"ak;\r\n case \'TaskExceptionMessage\':\r\n " +
" self.TaskExceptionMessage(value);\r\n " +
" break;\r\n case \'NextScheduledTimestamp\':\r\n " +
" self.NextScheduledTimestamp(value);\r\n " +
" break;\r\n case \'FinishedUrl\':\r\n " +
" self.FinishedUrl(value);\r\n br" +
"eak;\r\n case \'FinishedMessage\':\r\n " +
" self.FinishedMessage(value);\r\n break;\r" +
"\n case \'FinishedTimestamp\':\r\n " +
" self.FinishedTimestamp(value);\r\n window.s" +
"etTimeout(self.Finished, 1);\r\n break;\r\n " +
" default:\r\n // Ignore\r\n " +
" }\r\n });\r\n }\r\n\r\n " +
"if (!self.FinishedTimestamp())\r\n self.FullUpdateToken = windo" +
"w.setTimeout(self.FullUpdate, 2000);\r\n }\r\n\r\n self.FullUpda" +
"te = function () {\r\n self.FullUpdateToken = null;\r\n\r\n " +
" if (!self.FinishedTimestamp())\r\n notificationsHub.server." +
"getStatus()\r\n .done(self.Initialize);\r\n }\r\n " +
" }\r\n\r\n vm = new statusViewModel(sessionId);\r\n ko.applyBindings" +
"(vm, view[0]);\r\n\r\n // Start Live Connection\r\n updateWithLive();\r\n\r" +
"\n function updateWithLive() {\r\n notificationsHub = $.connectio" +
"n.scheduledTaskNotifications;\r\n notificationsHub.client.initializeTas" +
"kStatus = vm.Initialize;\r\n notificationsHub.client.updateTaskStatus =" +
" vm.Update;\r\n\r\n $.connection.hub.qs = { TaskSessionId: sessionId };\r\n" +
" $.connection.hub.error(onHubFailed);\r\n\r\n $.connection.hub" +
".start()\r\n .fail(onHubFailed);\r\n }\r\n\r\n function onH" +
"ubFailed(error) {\r\n // Show Dialog Message\r\n if ($(\'.disco" +
"nnected-dialog\').length == 0) {\r\n $(\'<div>\')\r\n " +
" .addClass(\'dialog disconnected-dialog\')\r\n .html(\'<h3><span c" +
"lass=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban " +
"fa-stack-2x error\"></i></span>Disconnected from the Disco ICT Server</h3><div>Th" +
"is page is not receiving live updates. Please ensure you are connected to the se" +
"rver, then refresh this page to enable features.</div>\')\r\n .d" +
"ialog({\r\n resizable: false,\r\n titl" +
"e: \'Disconnected\',\r\n width: 400,\r\n " +
" modal: true,\r\n buttons: {\r\n \'" +
"Refresh Now\': function () {\r\n $(this).dialog(\'opt" +
"ion\', \'buttons\', null);\r\n window.location.reload(" +
"true);\r\n },\r\n \'Close\': fun" +
"ction () {\r\n $(this).dialog(\'destroy\');\r\n " +
" }\r\n }\r\n });\r\n " +
" }\r\n }\r\n\r\n });\r\n</script>\r\n");
"\r\n\r\n if (self.FinishedMessage())\r\n " +
" window.setTimeout(function () { window.location.href = self.FinishedUrl(); " +
"}, 3000);\r\n else\r\n window.loca" +
"tion.href = self.FinishedUrl();\r\n }\r\n }\r\n " +
" }\r\n\r\n self.Initialize = function (taskStatus) {\r\n " +
" self.TaskName(taskStatus.TaskName);\r\n self.FinishedUrl(taskSta" +
"tus.FinishedUrl);\r\n\r\n self.Progress(taskStatus.Progress);\r\n " +
" self.CurrentProcess(taskStatus.CurrentProcess);\r\n self." +
"CurrentDescription(taskStatus.CurrentDescription);\r\n\r\n self.IsRun" +
"ning(taskStatus.IsRunning);\r\n\r\n self.TaskExceptionMessage(taskSta" +
"tus.TaskExceptionMessage);\r\n\r\n self.FinishedTimestamp(taskStatus." +
"FinishedTimestamp);\r\n self.NextScheduledTimestamp(taskStatus.Next" +
"ScheduledTimestamp);\r\n\r\n self.FinishedMessage(taskStatus.Finished" +
"Message);\r\n\r\n self.Initialized(true);\r\n\r\n self.Fin" +
"ished();\r\n }\r\n self.Update = function (taskStatus) {\r\n " +
" if (!self.Initialized())\r\n return;\r\n\r\n " +
" if (self.FullUpdateToken)\r\n window.clearTimeout(self.Ful" +
"lUpdateToken);\r\n\r\n if (taskStatus) {\r\n $.each(" +
"taskStatus, function (key, value) {\r\n switch (key) {\r\n " +
" case \'Progress\':\r\n self." +
"Progress(value);\r\n break;\r\n " +
" case \'CurrentProcess\':\r\n self.CurrentProces" +
"s(value);\r\n break;\r\n c" +
"ase \'CurrentDescription\':\r\n self.CurrentDescripti" +
"on(value);\r\n break;\r\n " +
"case \'IsRunning\':\r\n self.IsRunning(value);\r\n " +
" break;\r\n case \'TaskExcepti" +
"onMessage\':\r\n self.TaskExceptionMessage(value);\r\n" +
" break;\r\n case \'NextSc" +
"heduledTimestamp\':\r\n self.NextScheduledTimestamp(" +
"value);\r\n break;\r\n cas" +
"e \'FinishedUrl\':\r\n self.FinishedUrl(value);\r\n " +
" break;\r\n case \'FinishedMe" +
"ssage\':\r\n self.FinishedMessage(value);\r\n " +
" break;\r\n case \'FinishedTimesta" +
"mp\':\r\n self.FinishedTimestamp(value);\r\n " +
" window.setTimeout(self.Finished, 1);\r\n " +
" break;\r\n default:\r\n " +
" // Ignore\r\n }\r\n });\r\n " +
" }\r\n\r\n if (!self.FinishedTimestamp())\r\n " +
" self.FullUpdateToken = window.setTimeout(self.FullUpdate, 2000);\r\n " +
"}\r\n\r\n self.FullUpdate = function () {\r\n self.FullUpdat" +
"eToken = null;\r\n\r\n if (!self.FinishedTimestamp())\r\n " +
" notificationsHub.server.getStatus()\r\n .done(self.In" +
"itialize);\r\n }\r\n }\r\n\r\n vm = new statusViewModel(session" +
"Id);\r\n ko.applyBindings(vm, view[0]);\r\n\r\n // Start Live Connection" +
"\r\n updateWithLive();\r\n\r\n function updateWithLive() {\r\n " +
"notificationsHub = $.connection.scheduledTaskNotifications;\r\n notific" +
"ationsHub.client.initializeTaskStatus = vm.Initialize;\r\n notification" +
"sHub.client.updateTaskStatus = vm.Update;\r\n\r\n $.connection.hub.qs = {" +
" TaskSessionId: sessionId };\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 " +
" // Show Dialog Message\r\n if ($(\'.disconnected-dialog\').length =" +
"= 0) {\r\n $(\'<div>\')\r\n .addClass(\'dialo" +
"g disconnected-dialog\')\r\n .html(\'<h3><span class=\"fa-stac" +
"k fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x e" +
"rror\"></i></span>Disconnected from the Disco ICT Server</h3><div>This page is no" +
"t receiving live updates. Please ensure you are connected to the server, then re" +
"fresh this page to enable features.</div>\')\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 " +
" $.connection.hub.start()\r\n .fail(onHubFailed);\r\n " +
" }\r\n\r\n });\r\n</script>\r\n");
}
}
@@ -131,9 +131,10 @@
hub.client.setTheme = setTheme;
$.connection.hub.qs = { Noticeboard: '@(Disco.Services.Jobs.Noticeboards.HeldDevices.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
}
@@ -256,9 +256,10 @@ WriteLiteral(">\r\n <li data-bind=\"css: { alert: IsAlert }\">\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 </script>\r\n</body>\r\n</html>");
" $(\'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 </scri" +
"pt>\r\n</body>\r\n</html>");
}
}
@@ -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
}
@@ -257,9 +257,10 @@ WriteLiteral(">\r\n <li data-bind=\"css: { alert: IsAlert }\">\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 " +
"</script>\r\n</body>\r\n</html>\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 </script>\r\n</body>\r\n</html>\r\n");
}
}
+19 -19
View File
@@ -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);
});
});
</script>
}
+34 -33
View File
@@ -514,39 +514,40 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
"d;\r\n if (document.DiscoFunctions.onAttachmentRemoved)\r\n " +
" hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRem" +
"oved;\r\n\r\n $.connection.hub.qs = { DeviceSerialNumber: deviceSeria" +
"lNumber };\r\n $.connection.hub.error(onHubFailed);\r\n " +
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n $.connection.hu" +
"b.reconnecting(function () {\r\n $(\'#AttachmentsContainer\').fin" +
"d(\'span.action.enabled\').addClass(\'disabled\');\r\n $(\'#Comments" +
"\').find(\'button\').prop(\'disabled\', true);\r\n });\r\n " +
"$.connection.hub.reconnected(function () {\r\n $(\'#AttachmentsC" +
"ontainer\').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\').find(\'but" +
"ton\').prop(\'disabled\', false);\r\n }).fail(onHubFailed);\r\n\r\n " +
" function onHubFailed(error) {\r\n // Disable UI\r\n " +
" $(\'#AttachmentsContainer\').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\').length == 0) {\r\n $(\'<div>\')\r\n " +
" .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-sta" +
"ck-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from t" +
"he Disco ICT Server</h3><div>This page is not receiving live updates. Please ens" +
"ure you are connected to the server, then refresh this page to enable features.<" +
"/div>\')\r\n .dialog({\r\n " +
"resizable: false,\r\n title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: t" +
"rue,\r\n buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n $(th" +
"is).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 </script>\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 " +
" $(\'<div>\')\r\n .addClass(\'dialog disconnected-d" +
"ialog\')\r\n .html(\'<h3><span class=\"fa-stack fa-lg\"><i " +
"class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></" +
"span>Disconnected from the Disco ICT Server</h3><div>This page is not receiving " +
"live updates. Please ensure you are connected to the server, then refresh this p" +
"age to enable features.</div>\')\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 " +
" </script>\r\n");
#line 197 "..\..\Views\Device\Show.cshtml"
+11 -12
View File
@@ -567,9 +567,6 @@
</text>}
$.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
});
@@ -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 " +
" $(\'<div>\')\r\n .addClass(\'dialog disconnected-di" +
"alog\')\r\n .html(\'<h3><span class=\"fa-stack fa-lg\"><i class" +
"=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>" +
"Disconnected from the Disco ICT Server</h3><div>This page is not receiving live " +
"updates. Please ensure you are connected to the server, then refresh this page t" +
"o enable features.</div>\')\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 </script>\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 $(\'<div>\')" +
"\r\n .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack" +
"-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the" +
" Disco ICT Server</h3><div>This page is not receiving live updates. Please ensur" +
"e you are connected to the server, then refresh this page to enable features.</d" +
"iv>\')\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 </script>\r\n");
#line 620 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 619 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
+19 -19
View File
@@ -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);
});
});
</script>
}
+33 -33
View File
@@ -456,40 +456,40 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
"mentAdded = document.DiscoFunctions.onAttachmentAdded;\r\n if (docu" +
"ment.DiscoFunctions.onAttachmentRemoved)\r\n hub.client.attachm" +
"entRemoved = document.DiscoFunctions.onAttachmentRemoved;\r\n\r\n $.c" +
"onnection.hub.qs = { UserId: userId };\r\n $.connection.hub.error(o" +
"nHubFailed);\r\n $.connection.hub.disconnected(onHubFailed);\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 " +
"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 $(\'<div>\')\r\n .add" +
"Class(\'dialog disconnected-dialog\')\r\n .html(\'<h3><spa" +
"n class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-b" +
"an fa-stack-2x error\"></i></span>Disconnected from the Disco ICT Server</h3><div" +
">This page is not receiving live updates. Please ensure you are connected to the" +
" server, then refresh this page to enable features.</div>\')\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\').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 $(\'#AttachmentsCo" +
"ntainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n }).f" +
"ail(onHubFailed);\r\n\r\n function onHubFailed(error) {\r\n " +
" // Disable UI\r\n $(\'#AttachmentsContainer\').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\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass(\'dialog disconnect" +
"ed-dialog\')\r\n .html(\'<h3><span class=\"fa-stack fa-lg\"" +
"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></" +
"i></span>Disconnected from the Disco ICT Server</h3><div>This page is not receiv" +
"ing live updates. Please ensure you are connected to the server, then refresh th" +
"is page to enable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n t" +
"itle: \'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 " +
" </script>\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 </script>\r\n");
#line 187 "..\..\Views\User\Show.cshtml"