X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fsliceview.py;h=e4e1bc5fd76e89f4e78be2ac7a5ed73b202728ad;hb=3a7b21bbf4396590a40ea02d83846ce3ed951f53;hp=6e63e82fb3c45ba271dacbd55190fb7fe636d67f;hpb=23ff03c16854ba93aec3d7d8a19901cdf5448001;p=myslice.git diff --git a/portal/sliceview.py b/portal/sliceview.py index 6e63e82f..e4e1bc5f 100644 --- a/portal/sliceview.py +++ b/portal/sliceview.py @@ -11,7 +11,6 @@ from myslice.viewutils import topmenu_items, the_user from plugins.raw.raw import Raw from plugins.stack.stack import Stack from plugins.tabs.tabs import Tabs -from plugins.lists.slicelist import SliceList from plugins.hazelnut import Hazelnut from plugins.resources_selected import ResourcesSelected from plugins.googlemaps import GoogleMaps @@ -25,12 +24,17 @@ from plugins.messages.messages import Messages tmp_default_slice='ple.upmc.myslicedemo' +# temporary : turn off the users part to speed things up +do_query_users=True + class SliceView (LoginRequiredAutoLogoutView): def get (self,request, slicename=tmp_default_slice): page = Page(request) page.add_css_files ('css/slice-view.css') + page.add_js_chunks ('$(function() { console.log("sliceview: jQuery version " + $.fn.jquery); });') + page.add_js_chunks ('$(function() { console.log("users turned %s"); });'%("on" if do_query_users else "off")) page.expose_js_metadata() metadata = page.get_metadata() @@ -51,18 +55,20 @@ class SliceView (LoginRequiredAutoLogoutView): ) query_resource_all = Query.get('resource').select(resource_fields) - query_user_all = Query.get('user').select(user_fields) + if do_query_users: + query_user_all = Query.get('user').select(user_fields) aq = AnalyzedQuery(main_query, metadata=metadata) page.enqueue_query(main_query, analyzed_query=aq) page.enqueue_query(query_resource_all) - page.enqueue_query(query_user_all) + if do_query_users: + page.enqueue_query(query_user_all) # ... and for the relations # XXX Let's hardcode resources for now - sq_resource = aq.subquery('resource') - sq_user = aq.subquery('user') - sq_lease = aq.subquery('lease') + sq_resource = aq.subquery('resource') + sq_user = aq.subquery('user') + sq_lease = aq.subquery('lease') sq_measurement = aq.subquery('measurement') @@ -201,34 +207,35 @@ class SliceView (LoginRequiredAutoLogoutView): # USERS # - tab_users = Tabs( - page = page, - domid = 'users', - outline_complete = True, - togglable = True, - title = 'Users', - active_domid = 'checkboxes2', - ) - main_stack.insert(tab_users) + if do_query_users: + tab_users = Tabs( + page = page, + domid = 'users', + outline_complete = True, + togglable = True, + title = 'Users', + active_domid = 'checkboxes2', + ) + main_stack.insert(tab_users) - tab_users.insert(Hazelnut( - page = page, - title = 'Users List', - domid = 'checkboxes2', - # tab's sons preferably turn this off - togglable = False, - # this is the query at the core of the slice list - query = sq_user, - query_all = query_user_all, - checkboxes = True, - datatables_options = { - # for now we turn off sorting on the checkboxes columns this way - # this of course should be automatic in hazelnut - 'aoColumns' : [None, None, None, None, {'bSortable': False}], - 'iDisplayLength' : 25, - 'bLengthChange' : True, - }, - )) + tab_users.insert(Hazelnut( + page = page, + title = 'Users List', + domid = 'checkboxes2', + # tab's sons preferably turn this off + togglable = False, + # this is the query at the core of the slice list + query = sq_user, + query_all = query_user_all, + checkboxes = True, + datatables_options = { + # for now we turn off sorting on the checkboxes columns this way + # this of course should be automatic in hazelnut + 'aoColumns' : [None, None, None, None, {'bSortable': False}], + 'iDisplayLength' : 25, + 'bLengthChange' : True, + }, + )) tab_measurements = Tabs ( page = page,