updated maps
[unfold.git] / portal / sliceresourceview.py
index da362d3..e887ff7 100644 (file)
@@ -18,7 +18,7 @@ from myslice.configengine               import ConfigEngine
 from plugins.apply                      import ApplyPlugin
 from plugins.querytable                 import QueryTable
 from plugins.googlemap                  import GoogleMap
-#from plugins.queryupdater               import QueryUpdater
+# from plugins.queryupdater               import QueryUpdaterPlugin
 from plugins.filter_status              import FilterStatusPlugin
 from plugins.testbeds                   import TestbedsPlugin
 from plugins.scheduler2                 import Scheduler2
@@ -60,6 +60,7 @@ class SliceResourceView (LoginRequiredView, ThemeView):
                 'lease.resource',
                 'lease.start_time',
                 'lease.end_time',
+                'lease.lease_id', # Important for NITOS identify already existing leases
                 #'user.user_hrn',
                 #'application.measurement_point.counter'
         )
@@ -75,11 +76,11 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         #page.enqueue_query(query_resource_all)
 
         # leases query
-        lease_md = metadata.details_by_object('lease')
-        lease_fields = [column['name'] for column in lease_md['column']]
+        #lease_md = metadata.details_by_object('lease')
+        #lease_fields = [column['name'] for column in lease_md['column']]
 
-        query_lease_all = Query.get('lease').select(lease_fields)
-        page.enqueue_query(query_lease_all)
+        #query_lease_all = Query.get('lease').select(lease_fields)
+        #page.enqueue_query(query_lease_all)
 
         # --------------------------------------------------------------------------
         # ALL RESOURCES LIST
@@ -163,10 +164,11 @@ class SliceResourceView (LoginRequiredView, ThemeView):
             # the key to use at init-time
             init_key   = main_query_init_key,
             checkboxes = True,
-            # center on Paris
-            latitude   = 49.,
-            longitude  = 9,
-            zoom       = 8,
+            
+            # To center around Europe : 53,9 / 3
+            latitude   = 53.,
+            longitude  = 9.,
+            zoom       = 3,
         )
 
         # --------------------------------------------------------------------------
@@ -185,17 +187,17 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         # --------------------------------------------------------------------------
         # QueryUpdater (Pending Operations)
  
-#DEPRECATED|        pending_resources = QueryUpdater(
-#DEPRECATED|            page                = page,
-#DEPRECATED|            title               = 'Pending operations',
-#DEPRECATED|            query               = main_query,
-#DEPRECATED|            togglable           = False,
-#DEPRECATED|            # start turned off, it will open up itself when stuff comes in
-#DEPRECATED|            toggled             = False,
-#DEPRECATED|            domid               = 'pending',
-#DEPRECATED|            outline_complete    = True,
-#DEPRECATED|            username            = request.user,
-#DEPRECATED|        )
+#         pending_resources = QueryUpdaterPlugin(
+#             page                = page,
+#             title               = 'Pending operations',
+#             query               = main_query,
+#             togglable           = False,
+#             # start turned off, it will open up itself when stuff comes in
+#             toggled             = False,
+#             domid               = 'pending',
+#             outline_complete    = True,
+#             username            = request.user,
+#         )
 
         # --------------------------------------------------------------------------
         # NETWORKS
@@ -230,7 +232,8 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         apply = ApplyPlugin(
             page            = page,
             domid           = "apply",
-            query           = sq_resource,
+            query           = main_query,
+            username            = request.user,
         )
             
 
@@ -254,6 +257,8 @@ class SliceResourceView (LoginRequiredView, ThemeView):
         account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
         platform_details = execute_query(self.request, platform_query)
         account_details = execute_query(self.request, account_query)
+
+        # XXX When session has expired, this is None and thus not iterable
         for platform_detail in platform_details:
             for account_detail in account_details:
                 if platform_detail['platform_id'] == account_detail['platform_id']: