##// END OF EJS Templates
Done with major changes,...
Done with major changes, fixed widget IPython. references

File last commit:

r17198:7d582c78
r17199:aecfde7b
Show More
main.js
114 lines | 3.2 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 // Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
Jonathan Frederic
Use ipython namepsace for instances.
r17193 var ipython = ipython || {};
require([
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 'base/js/namespace',
'components/jquery/jquery.min',
Jonathan Frederic
Fixed events
r17195 'base/js/events',
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 'base/js/page',
'base/js/utils',
'tree/js/notebooklist',
'tree/js/clusterlist',
'tree/js/sessionlist',
'tree/js/kernellist',
'auth/js/loginwidget',
'components/jquery-ui/ui/minified/jquery-ui.min',
'components/bootstrap/js/bootstrap.min',
], function(
IPython,
$,
Jonathan Frederic
Fixed events
r17195 Events,
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 Page,
Jonathan Frederic
Almost done!...
r17198 utils,
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 NotebookList,
ClusterList,
SesssionList,
KernelList,
LoginWidget){
page = new Page();
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 var opts = {
Jonathan Frederic
Almost done!...
r17198 base_url: utils.get_body_data("baseUrl"),
notebook_path: utils.get_body_data("notebookPath"),
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 };
Jonathan Frederic
Progress...
r17196 events = $([new Events()]);
Jonathan Frederic
Fixed events
r17195 session_list = new SesssionList(opts, events);
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 notebook_list = new NotebookList('#notebook_list', opts, undefined, session_list);
cluster_list = new ClusterList('#cluster_list', opts);
Jonathan Frederic
Finished making tree.html requirejs friendly
r17190 kernel_list = new KernelList('#running_list', opts, session_list);
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 login_widget = new LoginWidget('#login_widget', opts);
Zachary Sailer
removed '/new' URL and added POST notebook request
r13016
$('#new_notebook').button().click(function (e) {
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 notebook_list.new_notebook();
Zachary Sailer
removed '/new' URL and added POST notebook request
r13016 });
MinRK
various unicode fixes...
r15234
Matthias BUSSONNIER
dashboard autorefresh...
r6844 var interval_id=0;
// auto refresh every xx secondes, no need to be fast,
// update is done at least when page get focus
var time_refresh = 60; // in sec
var enable_autorefresh = function(){
//refresh immediately , then start interval
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 if($('.upload_button').length === 0)
Matthias BUSSONNIER
prevent autorefresh when pending upload...
r6849 {
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 session_list.load_sessions();
cluster_list.load_list();
Matthias BUSSONNIER
prevent autorefresh when pending upload...
r6849 }
Matthias BUSSONNIER
dashboard autorefresh...
r6844 if (!interval_id){
interval_id = setInterval(function(){
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 if($('.upload_button').length === 0)
Matthias BUSSONNIER
prevent autorefresh when pending upload...
r6849 {
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 session_list.load_sessions();
cluster_list.load_list();
Matthias BUSSONNIER
prevent autorefresh when pending upload...
r6849 }
Matthias BUSSONNIER
dashboard autorefresh...
r6844 }, time_refresh*1000);
}
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 };
Matthias BUSSONNIER
dashboard autorefresh...
r6844
var disable_autorefresh = function(){
clearInterval(interval_id);
interval_id = 0;
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 };
Matthias BUSSONNIER
dashboard autorefresh...
r6844
// stop autorefresh when page lose focus
$(window).blur(function() {
disable_autorefresh();
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 });
Matthias BUSSONNIER
dashboard autorefresh...
r6844
//re-enable when page get focus back
$(window).focus(function() {
enable_autorefresh();
});
// finally start it, it will refresh immediately
enable_autorefresh();
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 page.show();
events.trigger('app_initialized.DashboardApp');
Matthias BUSSONNIER
alternate notebook upload methods...
r6838 // bound the upload method to the on change of the file select list
$("#alternate_upload").change(function (event){
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 notebook_list.handleFilesUpload(event,'form');
Matthias BUSSONNIER
alternate notebook upload methods...
r6838 });
MinRK
fix tab hash / url behavior...
r10927
// set hash on tab click
$("#tabs").find("a").click(function() {
window.location.hash = $(this).attr("href");
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 });
MinRK
fix tab hash / url behavior...
r10927
// load tab if url hash
if (window.location.hash) {
$("#tabs").find("a[href=" + window.location.hash + "]").click();
}
Jonathan Frederic
Started work to make tree requirejs friendly.
r17189 // For backwards compatability.
Jonathan Frederic
Use ipython namepsace for instances.
r17193 ipython.page = page;
ipython.notebook_list = notebook_list;
ipython.cluster_list = cluster_list;
ipython.session_list = session_list;
ipython.kernel_list = kernel_list;
ipython.login_widget = login_widget;
Jonathan Frederic
Fixed events
r17195 ipython.events = events;
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 });