##// END OF EJS Templates
Make kernel dialogs be a special type of dialog
Jessica B. Hamrick -
Show More
@@ -90,6 +90,15 define([
90 90 return modal.modal(options);
91 91 };
92 92
93 var kernel_modal = function (options) {
94 // only one kernel dialog should be open at a time -- but
95 // other modal dialogs can still be open
96 $('.kernel-modal').modal('hide');
97 var dialog = modal(options);
98 dialog.addClass('kernel-modal');
99 return dialog;
100 };
101
93 102 var edit_metadata = function (options) {
94 103 options.name = options.name || "Cell";
95 104 var error_div = $('<div/>').css('color', 'red');
@@ -153,6 +162,7 define([
153 162
154 163 var dialog = {
155 164 modal : modal,
165 kernel_modal : kernel_modal,
156 166 edit_metadata : edit_metadata,
157 167 };
158 168
@@ -149,10 +149,7 define([
149 149 // times it tries restarting).
150 150 if (info.attempt === 1) {
151 151
152 // hide existing modal dialog
153 $(".modal").modal('hide');
154
155 dialog.modal({
152 dialog.kernel_modal({
156 153 notebook: that.notebook,
157 154 keyboard_manager: that.keyboard_manager,
158 155 title: "Kernel Restarting",
@@ -186,15 +183,13 define([
186 183 // trying to reconnect and we don't want to spam the user
187 184 // with messages
188 185 if (info.attempt === 1) {
189 // hide existing dialog
190 $(".modal").modal('hide');
191 186
192 187 var msg = "A connection to the notebook server could not be established." +
193 188 " The notebook will continue trying to reconnect, but" +
194 189 " until it does, you will NOT be able to run code. Check your" +
195 190 " network connection or notebook server configuration.";
196 191
197 dialog.modal({
192 dialog.kernel_modal({
198 193 title: "Connection failed",
199 194 body: msg,
200 195 keyboard_manager: that.keyboard_manager,
@@ -215,8 +210,6 define([
215 210 this.events.on('kernel_dead.Kernel', function () {
216 211
217 212 var showMsg = function () {
218 // hide existing dialog
219 $(".modal").modal('hide');
220 213
221 214 var msg = 'The kernel has died, and the automatic restart has failed.' +
222 215 ' It is possible the kernel cannot be restarted.' +
@@ -224,7 +217,7 define([
224 217 ' the notebook, but running code will no longer work until the notebook' +
225 218 ' is reopened.';
226 219
227 dialog.modal({
220 dialog.kernel_modal({
228 221 title: "Dead kernel",
229 222 body : msg,
230 223 keyboard_manager: that.keyboard_manager,
@@ -273,10 +266,7 define([
273 266 cm_open = $.proxy(cm.refresh, cm);
274 267 }
275 268
276 // hide existing modal dialog
277 $(".modal").modal('hide');
278
279 dialog.modal({
269 dialog.kernel_modal({
280 270 title: "Failed to start the kernel",
281 271 body : msg,
282 272 keyboard_manager: that.keyboard_manager,
General Comments 0
You need to be logged in to leave comments. Login now