#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
@@ -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");
}
}