- sons=[Tabs (
- page=page,
- title="2 tabs : w/ and w/o checkboxes",
- domid='thetabs',
- # active_domid='checkboxes',
- active_domid='gmap',
- sons=[
- Hazelnut (
- page=page,
- title='a sample and simple hazelnut',
- domid='simple',
- # tab's sons preferably turn this off
- togglable=False,
- # this is the query at the core of the slice list
- query=main_query,
- ),
- Hazelnut (
- page=page,
- title='with checkboxes',
- domid='checkboxes',
- # tab's sons preferably turn this off
- togglable=False,
- # this is the query at the core of the slice list
- query=main_query,
- 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,
- },
- ),
- GoogleMap (
- page=page,
- title='geographic view',
- domid='gmap',
- # tab's sons preferably turn this off
- togglable=False,
- query=main_query,
- ),
- SensLabMap (
- page=page,
- title='3D view',
- domid='smap',
- # tab's sons preferably turn this off
- togglable=False,
- query=main_query,
- ),
- ]),
- Hazelnut (
- page=page,
- title='not in tabs',
- domid='standalone',
- # this is the query at the core of the slice list
- query=main_query,
- columns=['hrn','hostname'],
- ),
- # you don't *have to* set a domid, but if you plan on using toggled=persistent then it's required
- # because domid is the key for storing toggle status in the browser
- QueryCode (
- page=page,
- title='xmlrpc code (toggled=False)',
- query=main_query,
-# domid='xmlrpc',
- toggled=False,
- ),
- QuickFilter (
- page=page,
- title="QuickFilter - requires metadata (toggled=False)",
- criterias=quickfilter_criterias,
- domid='filters',
- toggled=False,
- ),
- ])
+ sons=[],
+ )
+
+
+ # ... 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_measurement = aq.subquery('measurement')
+
+
+ ############################################################################
+ # RESOURCES
+ #
+ # A stack inserted in the subquery tab that will hold all operations
+ # related to resources
+ #
+
+ stack_resources = Stack(
+ page = page,
+ title = 'Resources',
+ sons=[],
+ )
+
+ resource_query_editor = QueryEditor(
+ page = page,
+ query = sq_resource,
+ )
+ stack_resources.insert(resource_query_editor)
+
+ resource_active_filters = ActiveFilters(
+ page = page,
+ query = sq_resource,
+ )
+ stack_resources.insert(resource_active_filters)
+
+ # --------------------------------------------------------------------------
+ # Different displays = DataTables + GoogleMaps
+ #
+ tab_resource_plugins = Tabs(
+ page = page,
+ sons = []
+ )
+
+ tab_resource_plugins.insert(Hazelnut(
+ page = page,
+ title = 'List',
+ domid = 'checkboxes',
+ # this is the query at the core of the slice list
+ query = sq_resource,
+ query_all = query_resource_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_resource_plugins.insert(GoogleMaps(
+ page = page,
+ title = 'Geographic view',
+ domid = 'gmap',
+ # tab's sons preferably turn this off
+ togglable = False,
+ query = sq_resource,
+ query_all = query_resource_all,
+ checkboxes = True,
+ # center on Paris
+ latitude = 49.,
+ longitude = 2.2,
+ zoom = 3,
+ ))
+
+ stack_resources.insert(tab_resource_plugins)
+
+ # --------------------------------------------------------------------------
+ # ResourcesSelected
+ #
+ stack_resources.insert(ResourcesSelected(
+ page = page,
+ title = 'Pending operations',
+ resource_query_uuid = sq_resource,
+ lease_query_uuid = sq_lease,
+ togglable = True,
+ ))
+
+ sq_plugin.insert(stack_resources)
+
+ ############################################################################
+ # USERS
+ #
+
+ tab_users = Tabs(
+ page = page,
+ title = 'Users',
+ domid = 'thetabs2',
+ # activeid = 'checkboxes',
+ active_domid = 'checkboxes2',
+ )
+ sq_plugin.insert(tab_users)
+
+ tab_users.insert(Hazelnut(
+ page = page,
+ title = '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,
+ 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,
+ title = 'Measurements',
+ domid = 'thetabs3',
+ # activeid = 'checkboxes',
+ active_domid = 'checkboxes3',
+ )
+ sq_plugin.insert(tab_measurements)
+
+ tab_measurements.insert(Hazelnut(
+ page = page,
+ title = 'List',
+ domid = 'checkboxes3',
+ # tab's sons preferably turn this off
+ togglable = False,
+ # this is the query at the core of the slice list
+ query = sq_measurement,
+ 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,
+ },
+ ))
+
+ main_plugin.insert(sq_plugin)
+
+ main_plugin.insert(Messages(
+ page = page,
+ title = "Runtime messages for slice %s"%slicename,
+ domid = "msgs-pre",
+ levels = "ALL",
+ ))
+ main_plugin.insert(Updater(
+ page = page,
+ title = "wont show up as non togglable by default",
+ query = main_query,
+ label = "Update slice",
+ ))
+
+