Unified SignalR disconnected/error dialogs
Dialogs (with a refresh option) appear whenever the SignalR client disconnects or encounters an error. Nonsensical error messages replaced. Page refresh technique changed to allow for urls containing fragment hashes.
This commit is contained in:
@@ -120,13 +120,33 @@
|
||||
};
|
||||
|
||||
$.connection.hub.qs = {LogModules: logModuleLiveGroupName};
|
||||
$.connection.hub.error(function(error){
|
||||
alert('Live-Log Error: '+error);
|
||||
});
|
||||
$.connection.hub.error(onHubFailed);
|
||||
|
||||
$.connection.hub.start().fail(function(error){
|
||||
alert('Live-Log Connection Error: '+error);
|
||||
});
|
||||
$.connection.hub.start().fail(onHubFailed);
|
||||
|
||||
function onHubFailed(error) {
|
||||
// Show Dialog Message
|
||||
if ($('.disconnected-dialog').length == 0) {
|
||||
$('<div>')
|
||||
.addClass('dialog disconnected-dialog')
|
||||
.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>')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
title: 'Disconnected',
|
||||
width: 400,
|
||||
modal: true,
|
||||
buttons: {
|
||||
'Refresh Now': function () {
|
||||
$(this).dialog('option', 'buttons', null);
|
||||
window.location.reload(true);
|
||||
},
|
||||
'Close': function () {
|
||||
$(this).dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -329,12 +329,29 @@ 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(function(error){\r\n " +
|
||||
" alert(\'Live-Log Error: \'+error);\r\n });\r" +
|
||||
"\n\r\n $.connection.hub.start().fail(function(error){\r\n " +
|
||||
" alert(\'Live-Log Connection Error: \'+error);\r\n " +
|
||||
"});\r\n }\r\n }\r\n\r\n loadInitialData();\r\n " +
|
||||
" });\r\n </script>\r\n</div>\r\n");
|
||||
"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");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,14 +247,34 @@
|
||||
notificationsHub.client.updateTaskStatus = vm.Update;
|
||||
|
||||
$.connection.hub.qs = { TaskSessionId: sessionId };
|
||||
$.connection.hub.error(function (error) {
|
||||
alert('Live-Status Error: ' + error);
|
||||
});
|
||||
$.connection.hub.error(onHubFailed);
|
||||
|
||||
$.connection.hub.start()
|
||||
.fail(function (error) {
|
||||
alert('Live-Status Connection Error: ' + error);
|
||||
});
|
||||
.fail(onHubFailed);
|
||||
}
|
||||
|
||||
function onHubFailed(error) {
|
||||
// Show Dialog Message
|
||||
if ($('.disconnected-dialog').length == 0) {
|
||||
$('<div>')
|
||||
.addClass('dialog disconnected-dialog')
|
||||
.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>')
|
||||
.dialog({
|
||||
resizable: false,
|
||||
title: 'Disconnected',
|
||||
width: 400,
|
||||
modal: true,
|
||||
buttons: {
|
||||
'Refresh Now': function () {
|
||||
$(this).dialog('option', 'buttons', null);
|
||||
window.location.reload(true);
|
||||
},
|
||||
'Close': function () {
|
||||
$(this).dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -281,11 +281,24 @@ WriteLiteral("\';\r\n\r\n var view = $(\'#Logging_Task_Status\');\r\n
|
||||
"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(function (error) {\r\n alert(\'Li" +
|
||||
"ve-Status Error: \' + error);\r\n });\r\n\r\n $.connection.hub.st" +
|
||||
"art()\r\n .fail(function (error) {\r\n alert(\'Live" +
|
||||
"-Status Connection Error: \' + error);\r\n });\r\n }\r\n\r\n });" +
|
||||
"\r\n</script>\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");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user