##// END OF EJS Templates
add missing error dialogs to tree actions...
Min RK -
Show More
@@ -85,16 +85,20 b' define(['
85 url += "?kernel_name=" + kernel_name;
85 url += "?kernel_name=" + kernel_name;
86 }
86 }
87 w.location = url;
87 w.location = url;
88 },
88 }).catch(function (e) {
89 function (error) {
89 w.close();
90 w.close();
90 dialog.modal({
91 dialog.modal({
91 title : 'Creating Notebook Failed',
92 title : 'Creating Notebook Failed',
92 body : $('<div/>')
93 body : "The error was: " + error.message,
93 .text("An error occurred while creating a new notebook.")
94 buttons : {'OK' : {'class' : 'btn-primary'}}
94 .append($('<div/>')
95 });
95 .addClass('alert alert-danger')
96 }
96 .text(e.message || e)),
97 );
97 buttons: {
98 OK: {'class' : 'btn-primary'}
99 }
100 });
101 });
98 };
102 };
99
103
100 return {'NewNotebookWidget': NewNotebookWidget};
104 return {'NewNotebookWidget': NewNotebookWidget};
@@ -78,6 +78,19 b' define(['
78 that.base_url, 'edit', data.path
78 that.base_url, 'edit', data.path
79 );
79 );
80 w.location = url;
80 w.location = url;
81 }).catch(function (e) {
82 w.close();
83 dialog.modal({
84 title: 'Creating File Failed',
85 body: $('<div/>')
86 .text("An error occurred while creating a new file.")
87 .append($('<div/>')
88 .addClass('alert alert-danger')
89 .text(e.message || e)),
90 buttons: {
91 OK: {'class': 'btn-primary'}
92 }
93 });
81 });
94 });
82 that.load_sessions();
95 that.load_sessions();
83 });
96 });
@@ -85,7 +98,20 b' define(['
85 that.contents.new_untitled(that.notebook_path || '', {type: 'directory'})
98 that.contents.new_untitled(that.notebook_path || '', {type: 'directory'})
86 .then(function(){
99 .then(function(){
87 that.load_list();
100 that.load_list();
101 }).catch(function (e) {
102 dialog.modal({
103 title: 'Creating Folder Failed',
104 body: $('<div/>')
105 .text("An error occurred while creating a new folder.")
106 .append($('<div/>')
107 .addClass('alert alert-danger')
108 .text(e.message || e)),
109 buttons: {
110 OK: {'class': 'btn-primary'}
111 }
112 });
88 });
113 });
114 that.load_sessions();
89 });
115 });
90
116
91 $('.rename-button').click($.proxy(this.rename_selected, this));
117 $('.rename-button').click($.proxy(this.rename_selected, this));
@@ -462,7 +488,7 b' define(['
462 );
488 );
463 $.ajax(url, settings);
489 $.ajax(url, settings);
464 }
490 }
465 }
491 };
466
492
467 NotebookList.prototype.rename_selected = function() {
493 NotebookList.prototype.rename_selected = function() {
468 if (this.selected.length != 1) return;
494 if (this.selected.length != 1) return;
@@ -488,12 +514,14 b' define(['
488 that.load_list();
514 that.load_list();
489 }).catch(function(e) {
515 }).catch(function(e) {
490 dialog.modal({
516 dialog.modal({
491 title : "Error",
517 title: "Rename Failed",
492 body : $('<div/>')
518 body: $('<div/>')
493 .text("An error occurred while renaming \"" + path + "\" to \"" + input.val() + "\".")
519 .text("An error occurred while renaming \"" + path + "\" to \"" + input.val() + "\".")
494 .append($('<div/>').addClass('alert alert-danger').text(String(e))),
520 .append($('<div/>')
495 buttons : {
521 .addClass('alert alert-danger')
496 OK : {}
522 .text(e.message || e)),
523 buttons: {
524 OK: {'class': 'btn-primary'}
497 }
525 }
498 });
526 });
499 });
527 });
@@ -539,12 +567,14 b' define(['
539 that.notebook_deleted(item.path);
567 that.notebook_deleted(item.path);
540 }).catch(function(e) {
568 }).catch(function(e) {
541 dialog.modal({
569 dialog.modal({
542 title : "Error",
570 title: "Delete Failed",
543 body : $('<div/>')
571 body: $('<div/>')
544 .text("An error occurred while deleting \"" + item.path + "\".")
572 .text("An error occurred while deleting \"" + item.path + "\".")
545 .append($('<div/>').addClass('alert alert-danger').text(String(e))),
573 .append($('<div/>')
546 buttons : {
574 .addClass('alert alert-danger')
547 OK : {}
575 .text(e.message || e)),
576 buttons: {
577 OK: {'class': 'btn-primary'}
548 }
578 }
549 });
579 });
550 });
580 });
@@ -576,12 +606,14 b' define(['
576 that.load_list();
606 that.load_list();
577 }).catch(function(e) {
607 }).catch(function(e) {
578 dialog.modal({
608 dialog.modal({
579 title : "Error",
609 title: "Delete Failed",
580 body : $('<div/>')
610 body: $('<div/>')
581 .text("An error occurred while copying \"" + item.path + "\".")
611 .text("An error occurred while deleting \"" + item.path + "\".")
582 .append($('<div/>').addClass('alert alert-danger').text(String(e))),
612 .append($('<div/>')
583 buttons : {
613 .addClass('alert alert-danger')
584 OK : {}
614 .text(e.message || e)),
615 buttons: {
616 OK: {'class': 'btn-primary'}
585 }
617 }
586 });
618 });
587 });
619 });
General Comments 0
You need to be logged in to leave comments. Login now