updates for onelab portal demo
[unfold.git] / trash / sliceview.py
index 7758845..b171487 100644 (file)
@@ -24,7 +24,7 @@ from plugins.quickfilter.quickfilter import QuickFilter
 from plugins.messages.messages       import Messages
 from plugins.updater.updater         import Updater
 
-tmp_default_slice='ple.inria.heartbeat'
+tmp_default_slice='ple.inria.myslicedemo'
 debug = True
 
 @login_required
@@ -54,6 +54,7 @@ def _slice_view (request, slicename):
 
     # TODO The query to run is embedded in the URL
     main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
+    query_resource_all = Query.get('resource').select('resource_hrn', 'hostname', 'type', 'authority')
 
     # Get default fields from metadata unless specified
     if not main_query.fields:
@@ -62,16 +63,17 @@ def _slice_view (request, slicename):
         if debug:
             print "METADATA", md_fields
         # TODO Get default fields
-        main_query.fields = [
+        main_query.select(
                 'slice_hrn',
                 'resource.resource_hrn', 'resource.hostname', 'resource.type', 'resource.authority',
-                'lease.urn',
+                #'lease.urn',
                 'user.user_hrn',
 #                'application.measurement_point.counter'
-        ]
+        )
 
-    aq = AnalyzedQuery(main_query)
+    aq = AnalyzedQuery(main_query, metadata=metadata)
     page.enqueue_query(main_query, analyzed_query=aq)
+    page.enqueue_query(query_resource_all)
 
     # Prepare the display according to all metadata
     # (some parts will be pending, others can be triggered by users).
@@ -134,12 +136,13 @@ def _slice_view (request, slicename):
     )
 
     tab_resource_plugins.insert(Hazelnut( 
-        page        = page,
-        title       = 'List',
-        domid       = 'checkboxes',
+        page           = page,
+        title          = 'List',
+        domid          = 'checkboxes',
         # this is the query at the core of the slice list
-        query       = sq_resource,
-        checkboxes  = True,
+        query          = sq_resource,
+        query_all_uuid = query_resource_all.query_uuid,
+        checkboxes     = True,
         datatables_options = { 
             # for now we turn off sorting on the checkboxes columns this way
             # this of course should be automatic in hazelnut
@@ -368,7 +371,7 @@ def _slice_view (request, slicename):
     # more general variables expected in the template
     template_env [ 'title' ] = 'Test view that combines various plugins'
     # the menu items on the top
-    template_env [ 'topmenu_items' ] = topmenu_items('slice', request) 
+    template_env [ 'topmenu_items' ] = topmenu_items('Slice', request) 
     # so we can sho who is logged
     template_env [ 'username' ] = the_user (request)