querytable plugin’s internal key passed by caller : QueryTable (… id_key=‘hrn’ )
[myslice.git] / portal / sliceview.py
index 753fed2..8c6f9fe 100644 (file)
@@ -15,6 +15,7 @@ from plugins.querytable              import QueryTable
 from plugins.queryupdater            import QueryUpdater
 from plugins.googlemap               import GoogleMap
 from plugins.senslabmap              import SensLabMap
+from plugins.scheduler               import Scheduler
 from plugins.querycode               import QueryCode
 from plugins.query_editor            import QueryEditor
 from plugins.active_filters          import ActiveFilters
@@ -59,10 +60,13 @@ class SliceView (LoginRequiredAutoLogoutView):
                 'slice_hrn',
                 'resource.hrn', 'resource.hostname', 'resource.type', 
                 'resource.network_hrn',
-                #'lease.urn',
+                'lease.urn',
                 'user.user_hrn',
                 #'application.measurement_point.counter'
         )
+        # for internal use in the querytable plugin;
+        # needs to be a unique column present for each returned record
+        main_query_key = 'hrn'
     
         query_resource_all = Query.get('resource').select(resource_fields)
         if do_query_users:
@@ -179,6 +183,8 @@ class SliceView (LoginRequiredAutoLogoutView):
             # this is the query at the core of the slice list
             query      = sq_resource,
             query_all  = query_resource_all,
+            # safer to use 'hrn' as the internal unique key for this plugin
+            id_key     = main_query_key,
             checkboxes = True,
             datatables_options = { 
                 'iDisplayLength': 25,
@@ -187,6 +193,15 @@ class SliceView (LoginRequiredAutoLogoutView):
                 },
             )
 
+        resources_as_scheduler = Scheduler(
+            page        = page,
+            title       = 'Scheduler',
+            domid       = 'scheduler',
+            query       = sq_resource,
+            query_all_resources = query_resource_all,
+            query_lease = sq_lease,
+        )
+
        # with the new 'Filter' stuff on top, no need for anything but the querytable
         resources_as_list_area = resources_as_list 
 
@@ -195,8 +210,10 @@ class SliceView (LoginRequiredAutoLogoutView):
                                 togglable=True,
                                 title="Resources",
                                 outline_complete=True,
-                                sons=[ resources_as_gmap, 
+                                sons=[ 
+                                       resources_as_gmap, 
                                        resources_as_3dmap,
+                                       resources_as_scheduler,
                                        resources_as_list_area, ],
                                 active_domid = 'resources-map',
                                 persistent_active=True,