now dashboard and sliceview both have the validation plugin
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 16:28:46 +0000 (17:28 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 16:28:46 +0000 (17:28 +0100)
this needs some care before we move to all views, because at this point the order in which toplevel_items and expose_queries occur is important, and this is confusing

portal/dashboardview.py
portal/sliceview.py

index 4117782..95abbaf 100644 (file)
@@ -9,7 +9,7 @@ from plugins.lists.slicelist     import SliceList
 
 from unfold.loginrequired        import LoginRequiredAutoLogoutView
 
-from ui.topmenu                  import topmenu_items, the_user
+from ui.topmenu                  import topmenu_items_live, the_user
 
 #This view requires login 
 class DashboardView (LoginRequiredAutoLogoutView):
@@ -29,11 +29,11 @@ class DashboardView (LoginRequiredAutoLogoutView):
         #slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
         testbed_query  = Query().get('network').select('network_hrn','platform')
         # DEMO GEC18 Query only PLE
-        user_query  = Query().get('local:user').select('config','email')
-        user_details = execute_query(self.request, user_query)
+#        user_query  = Query().get('local:user').select('config','email')
+#        user_details = execute_query(self.request, user_query)
 
         # not always found in user_details...
-        config={}
+#        config={}
   #      for user_detail in user_details:
   #          #email = user_detail['email']
   #          if user_detail['config']:
@@ -50,9 +50,6 @@ class DashboardView (LoginRequiredAutoLogoutView):
         page.enqueue_query(slice_query)
         page.enqueue_query(testbed_query)
 
-        page.expose_js_metadata()
-        page.expose_queries()
-
         slicelist = SliceList(
             page  = page,
             title = "slices",
@@ -73,10 +70,14 @@ class DashboardView (LoginRequiredAutoLogoutView):
         # more general variables expected in the template
         context['title'] = 'Dashboard'
         # the menu items on the top
-        context['topmenu_items'] = topmenu_items('Dashboard', self.request
+        context['topmenu_items'] = topmenu_items_live('Dashboard', page
         # so we can sho who is logged
         context['username'] = the_user(self.request) 
 
+        page.expose_js_metadata()
+        page.expose_queries()
+
+        # the page header and other stuff
         context.update(page.prelude_env())
 
         return context
index 318ee34..b9ac8b1 100644 (file)
@@ -59,8 +59,6 @@ class SliceView (LoginRequiredAutoLogoutView):
         config=Config()
         page.add_js_chunks ('$(function() { messages.debug("manifold URL %s"); });'%(config.manifold_url()))
 
-        page.expose_js_metadata()
-
         metadata = page.get_metadata()
         resource_md = metadata.details_by_object('resource')
         resource_fields = [column['name'] for column in resource_md['column']]
@@ -434,15 +432,11 @@ class SliceView (LoginRequiredAutoLogoutView):
         template_env [ 'username' ] = the_user (request) 
     
         # don't forget to run the requests
+        page.expose_js_metadata()
         page.expose_queries ()
-    
-        # xxx create another plugin with the same query and a different layout (with_datatables)
-        # show that it worls as expected, one single api call to backend and 2 refreshed views
-    
         # the prelude object in page contains a summary of the requirements() for all plugins
         # define {js,css}_{files,chunks}
-        prelude_env = page.prelude_env()
-        template_env.update(prelude_env)
-        result=render_to_response ('view-unfold1.html',template_env,
+        template_env.update(page.prelude_env())
+
+        return render_to_response ('view-unfold1.html',template_env,
                                    context_instance=RequestContext(request))
-        return result