##// END OF EJS Templates
use jQuery dialog instead of alert()
MinRK -
Show More
@@ -87,6 +87,34 b' var IPython = (function (IPython) {'
87 IPython.kernel_status_widget.status_idle();
87 IPython.kernel_status_widget.status_idle();
88 };
88 };
89
89
90 Kernel.prototype._websocket_closed = function(ws_url, early){
91 var msg;
92 var parent_item = $('body');
93 if (early) {
94 msg = "Websocket connection to " + ws_url + " could not be established.<br/>" +
95 " You will NOT be able to run code.<br/>" +
96 " Your browser may not be compatible with the websocket version in the server," +
97 " or if the url does not look right, there could be an error in the" +
98 " server's configuration."
99 } else {
100 msg = "Websocket connection closed unexpectedly.<br/>" +
101 " The kernel will no longer be responsive."
102 }
103 var dialog = $('<div/>');
104 dialog.html(msg);
105 parent_item.append(dialog);
106 dialog.dialog({
107 resizable: false,
108 modal: true,
109 title: "Websocket closed",
110 buttons : {
111 "Okay": function () {
112 $(this).dialog('close');
113 }
114 }
115 });
116
117 }
90
118
91 Kernel.prototype.start_channels = function () {
119 Kernel.prototype.start_channels = function () {
92 var that = this;
120 var that = this;
@@ -105,11 +133,7 b' var IPython = (function (IPython) {'
105 }
133 }
106 already_called_onclose = true;
134 already_called_onclose = true;
107 if ( ! evt.wasClean ){
135 if ( ! evt.wasClean ){
108 alert("Websocket connection to " + ws_url + " could not be established." +
136 that._websocket_closed(ws_url, true);
109 " You will not be able to run code." +
110 " Your browser may not be compatible with the websocket version in the server," +
111 " or if the url does not look right, there could be an error in the" +
112 " server's configuration.");
113 }
137 }
114 }
138 }
115 ws_closed_late = function(evt){
139 ws_closed_late = function(evt){
@@ -118,8 +142,7 b' var IPython = (function (IPython) {'
118 }
142 }
119 already_called_onclose = true;
143 already_called_onclose = true;
120 if ( ! evt.wasClean ){
144 if ( ! evt.wasClean ){
121 alert("Websocket connection has closed unexpectedly." +
145 that._websocket_closed(ws_url, false);
122 " The kernel will no longer be responsive.");
123 }
146 }
124 }
147 }
125 this.shell_channel.onopen = send_cookie;
148 this.shell_channel.onopen = send_cookie;
General Comments 0
You need to be logged in to leave comments. Login now