##// END OF EJS Templates
remove call to jquery-ui useless button()
Matthias BUSSONNIER -
Show More
@@ -1,121 +1,121 b''
1 // Copyright (c) IPython Development Team.
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
2 // Distributed under the terms of the Modified BSD License.
3
3
4 require([
4 require([
5 'base/js/namespace',
5 'base/js/namespace',
6 'jquery',
6 'jquery',
7 'base/js/events',
7 'base/js/events',
8 'base/js/page',
8 'base/js/page',
9 'base/js/utils',
9 'base/js/utils',
10 'tree/js/notebooklist',
10 'tree/js/notebooklist',
11 'tree/js/clusterlist',
11 'tree/js/clusterlist',
12 'tree/js/sessionlist',
12 'tree/js/sessionlist',
13 'tree/js/kernellist',
13 'tree/js/kernellist',
14 'auth/js/loginwidget',
14 'auth/js/loginwidget',
15 // only loaded, not used:
15 // only loaded, not used:
16 'jqueryui',
16 'jqueryui',
17 'bootstrap',
17 'bootstrap',
18 'custom/custom',
18 'custom/custom',
19 ], function(
19 ], function(
20 IPython,
20 IPython,
21 $,
21 $,
22 events,
22 events,
23 page,
23 page,
24 utils,
24 utils,
25 notebooklist,
25 notebooklist,
26 clusterlist,
26 clusterlist,
27 sesssionlist,
27 sesssionlist,
28 kernellist,
28 kernellist,
29 loginwidget){
29 loginwidget){
30
30
31 page = new page.Page();
31 page = new page.Page();
32
32
33 var common_options = {
33 var common_options = {
34 base_url: utils.get_body_data("baseUrl"),
34 base_url: utils.get_body_data("baseUrl"),
35 notebook_path: utils.get_body_data("notebookPath"),
35 notebook_path: utils.get_body_data("notebookPath"),
36 };
36 };
37 session_list = new sesssionlist.SesssionList($.extend({
37 session_list = new sesssionlist.SesssionList($.extend({
38 events: events},
38 events: events},
39 common_options));
39 common_options));
40 notebook_list = new notebooklist.NotebookList('#notebook_list', $.extend({
40 notebook_list = new notebooklist.NotebookList('#notebook_list', $.extend({
41 session_list: session_list},
41 session_list: session_list},
42 common_options));
42 common_options));
43 cluster_list = new clusterlist.ClusterList('#cluster_list', common_options);
43 cluster_list = new clusterlist.ClusterList('#cluster_list', common_options);
44 kernel_list = new kernellist.KernelList('#running_list', $.extend({
44 kernel_list = new kernellist.KernelList('#running_list', $.extend({
45 session_list: session_list},
45 session_list: session_list},
46 common_options));
46 common_options));
47 login_widget = new loginwidget.LoginWidget('#login_widget', common_options);
47 login_widget = new loginwidget.LoginWidget('#login_widget', common_options);
48
48
49 $('#new_notebook').button().click(function (e) {
49 $('#new_notebook').click(function (e) {
50 notebook_list.new_notebook();
50 notebook_list.new_notebook();
51 });
51 });
52
52
53 var interval_id=0;
53 var interval_id=0;
54 // auto refresh every xx secondes, no need to be fast,
54 // auto refresh every xx secondes, no need to be fast,
55 // update is done at least when page get focus
55 // update is done at least when page get focus
56 var time_refresh = 60; // in sec
56 var time_refresh = 60; // in sec
57
57
58 var enable_autorefresh = function(){
58 var enable_autorefresh = function(){
59 //refresh immediately , then start interval
59 //refresh immediately , then start interval
60 if($('.upload_button').length === 0)
60 if($('.upload_button').length === 0)
61 {
61 {
62 session_list.load_sessions();
62 session_list.load_sessions();
63 cluster_list.load_list();
63 cluster_list.load_list();
64 }
64 }
65 if (!interval_id){
65 if (!interval_id){
66 interval_id = setInterval(function(){
66 interval_id = setInterval(function(){
67 if($('.upload_button').length === 0)
67 if($('.upload_button').length === 0)
68 {
68 {
69 session_list.load_sessions();
69 session_list.load_sessions();
70 cluster_list.load_list();
70 cluster_list.load_list();
71 }
71 }
72 }, time_refresh*1000);
72 }, time_refresh*1000);
73 }
73 }
74 };
74 };
75
75
76 var disable_autorefresh = function(){
76 var disable_autorefresh = function(){
77 clearInterval(interval_id);
77 clearInterval(interval_id);
78 interval_id = 0;
78 interval_id = 0;
79 };
79 };
80
80
81 // stop autorefresh when page lose focus
81 // stop autorefresh when page lose focus
82 $(window).blur(function() {
82 $(window).blur(function() {
83 disable_autorefresh();
83 disable_autorefresh();
84 });
84 });
85
85
86 //re-enable when page get focus back
86 //re-enable when page get focus back
87 $(window).focus(function() {
87 $(window).focus(function() {
88 enable_autorefresh();
88 enable_autorefresh();
89 });
89 });
90
90
91 // finally start it, it will refresh immediately
91 // finally start it, it will refresh immediately
92 enable_autorefresh();
92 enable_autorefresh();
93
93
94 page.show();
94 page.show();
95
95
96 // For backwards compatability.
96 // For backwards compatability.
97 IPython.page = page;
97 IPython.page = page;
98 IPython.notebook_list = notebook_list;
98 IPython.notebook_list = notebook_list;
99 IPython.cluster_list = cluster_list;
99 IPython.cluster_list = cluster_list;
100 IPython.session_list = session_list;
100 IPython.session_list = session_list;
101 IPython.kernel_list = kernel_list;
101 IPython.kernel_list = kernel_list;
102 IPython.login_widget = login_widget;
102 IPython.login_widget = login_widget;
103
103
104 events.trigger('app_initialized.DashboardApp');
104 events.trigger('app_initialized.DashboardApp');
105
105
106 // bound the upload method to the on change of the file select list
106 // bound the upload method to the on change of the file select list
107 $("#alternate_upload").change(function (event){
107 $("#alternate_upload").change(function (event){
108 notebook_list.handleFilesUpload(event,'form');
108 notebook_list.handleFilesUpload(event,'form');
109 });
109 });
110
110
111 // set hash on tab click
111 // set hash on tab click
112 $("#tabs").find("a").click(function() {
112 $("#tabs").find("a").click(function() {
113 window.location.hash = $(this).attr("href");
113 window.location.hash = $(this).attr("href");
114 });
114 });
115
115
116 // load tab if url hash
116 // load tab if url hash
117 if (window.location.hash) {
117 if (window.location.hash) {
118 $("#tabs").find("a[href=" + window.location.hash + "]").click();
118 $("#tabs").find("a[href=" + window.location.hash + "]").click();
119 }
119 }
120
120
121 });
121 });
General Comments 0
You need to be logged in to leave comments. Login now