##// END OF EJS Templates
Status monitoring added to notebook....
Brian Granger -
Show More
@@ -85,6 +85,25 b' div#toolbar {'
85 padding: 5px;
85 padding: 5px;
86 }
86 }
87
87
88 span#kernel_status {
89 position: absolute;
90 top: 12%;
91 right: 10px;
92 font-weight: bold;
93 }
94
95 .status_idle {
96 color: gray;
97 }
98
99 .status_busy {
100 color: red;
101 }
102
103 .status_restarting {
104 color: black;
105 }
106
88 div.notebook {
107 div.notebook {
89 width: 790px;
108 width: 790px;
90 height: 650px; /*We might have to detect window height for this*/
109 height: 650px; /*We might have to detect window height for this*/
@@ -102,7 +102,7 b' var Notebook = function (selector) {'
102 Notebook.prototype.bind_events = function () {
102 Notebook.prototype.bind_events = function () {
103 var that = this;
103 var that = this;
104 $(document).keydown(function (event) {
104 $(document).keydown(function (event) {
105 console.log(event);
105 // console.log(event);
106 if (event.which == 38 && event.shiftKey) {
106 if (event.which == 38 && event.shiftKey) {
107 event.preventDefault();
107 event.preventDefault();
108 that.select_prev();
108 that.select_prev();
@@ -458,6 +458,12 b' Notebook.prototype._kernel_started = function () {'
458 } else if (msg_type === "pyout" || msg_type === "display_data") {
458 } else if (msg_type === "pyout" || msg_type === "display_data") {
459 cell.expand();
459 cell.expand();
460 cell.append_display_data(reply.content.data);
460 cell.append_display_data(reply.content.data);
461 } else if (msg_type === "status") {
462 if (reply.content.execution_state === "busy") {
463 that.kernel.status_busy();
464 } else if (reply.content.execution_state === "idle") {
465 that.kernel.status_idle();
466 };
461 };
467 };
462 };
468 };
463 };
469 };
@@ -769,16 +775,40 b' Kernel.prototype.interrupt = function () {'
769
775
770
776
771 Kernel.prototype.restart = function () {
777 Kernel.prototype.restart = function () {
778 this.status_restarting();
772 url = this.kernel_url + "/restart"
779 url = this.kernel_url + "/restart"
773 var that = this;
780 var that = this;
774 $.post(url, function (kernel_id) {
781 $.post(url, function (kernel_id) {
775 console.log("Kernel restarted: " + kernel_id);
782 console.log("Kernel restarted: " + kernel_id);
776 that.kernel_id = kernel_id;
783 that.kernel_id = kernel_id;
777 that.kernel_url = that.base_url + "/" + that.kernel_id;
784 that.kernel_url = that.base_url + "/" + that.kernel_id;
785 that.status_idle();
778 }, 'json');
786 }, 'json');
779 };
787 };
780
788
781
789
790 Kernel.prototype.status_busy = function () {
791 $("#kernel_status").removeClass("status_idle");
792 $("#kernel_status").removeClass("status_restarting");
793 $("#kernel_status").addClass("status_busy");
794 $("#kernel_status").text("Busy");
795 };
796
797
798 Kernel.prototype.status_idle = function () {
799 $("#kernel_status").removeClass("status_busy");
800 $("#kernel_status").removeClass("status_restarting");
801 $("#kernel_status").addClass("status_idle");
802 $("#kernel_status").text("Idle");
803 };
804
805 Kernel.prototype.status_restarting = function () {
806 $("#kernel_status").removeClass("status_busy");
807 $("#kernel_status").removeClass("status_idle");
808 $("#kernel_status").addClass("status_restarting");
809 $("#kernel_status").text("Restarting");
810 };
811
782 //============================================================================
812 //============================================================================
783 // On document ready
813 // On document ready
784 //============================================================================
814 //============================================================================
@@ -803,6 +833,7 b' $(document).ready(function () {'
803 $("#kernel_toolbar").buttonset();
833 $("#kernel_toolbar").buttonset();
804 $("#interrupt_kernel").click(function () {IPYTHON.notebook.kernel.interrupt();});
834 $("#interrupt_kernel").click(function () {IPYTHON.notebook.kernel.interrupt();});
805 $("#restart_kernel").click(function () {IPYTHON.notebook.kernel.restart();});
835 $("#restart_kernel").click(function () {IPYTHON.notebook.kernel.restart();});
836 $("#kernel_status").addClass("status_idle");
806
837
807 $("#move_cell").buttonset();
838 $("#move_cell").buttonset();
808 $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"});
839 $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"});
@@ -26,6 +26,7 b''
26 <div id="tools">
26 <div id="tools">
27
27
28 <div id="menu_tabs">
28 <div id="menu_tabs">
29 <span id="kernel_status">Idle</span>
29 <ul>
30 <ul>
30 <li><a href="#cell_tab">Cell</a></li>
31 <li><a href="#cell_tab">Cell</a></li>
31 <li><a href="#kernel_tab">Kernel</a></li>
32 <li><a href="#kernel_tab">Kernel</a></li>
General Comments 0
You need to be logged in to leave comments. Login now