Commit 55f235a2 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update ui_viewport to add the node for the sources.

parent 050c63d6
......@@ -81,3 +81,11 @@ def metric2d():
except (IndexError, ReportException, TypeError, ValueError):
return CODE(traceback.format_exc()).xml()
def source():
"""Display the content of a source via an ``Ext.grid.Panel``.
Value send by the selector are used to filter the content of the source.
"""
return "Hello"
......@@ -27,6 +27,7 @@
'Aggregation Z': 'Agréger (z)',
'Alignments': 'Alignments',
'All columns will be configured when the field is empty': 'Toutes les colonnes seront configurées quand ce champ est vide',
'Application': 'Application',
'Are you sure you want to delete this object?': 'Are you sure you want to delete this object?',
'auth_cas': 'auth_cas',
'auth_event': 'auth_event',
......@@ -311,6 +312,7 @@
'the metrics 2d': 'les métriques 2d',
'The metrics 2d': 'Les métriques 2d',
"The report id '%s' is unknown.": "The report id '%s' is unknown.",
'The sources': 'Les sources',
'This email already has an account': 'This email already has an account',
'Time': 'Temps',
'Timestamp': 'Timestamp',
......
......@@ -5,6 +5,7 @@
import plugin_dbui as dbui
from event import Event
from gluon import current
from gluon.html import URL
......@@ -32,10 +33,11 @@ class ViewportUi(object):
ViewportUi.app_node(db, T),
ViewportUi.configure_node(db, T),
ViewportUi.meta_node(db, T),
ViewportUi.object_node(db, T),
ViewportUi.people_object_node(db, T),
ViewportUi.event_node(db, T),
ViewportUi.list_node(db, T, selector_panel),
ViewportUi.metric2d_node(db, T, selector_panel)]
ViewportUi.metric2d_node(db, T, selector_panel),
ViewportUi.source_node(db, T, selector_panel),]
modifier = dbui.ViewportModifier()
modifier.add_node(*nodes)
......@@ -63,7 +65,7 @@ class ViewportUi(object):
if "auth" in current.globalenv:
node = Node(T("CAS"))
node = Node(T("Application"))
add_child = node.add_child
......@@ -186,40 +188,36 @@ class ViewportUi(object):
return node
@staticmethod
def object_node(db, T):
"""To deal with object and people.
def list_node(db, T, selector_panel):
"""To deal with lists.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
selector_panel (gluon.storage.Storage):
configuration of the selector panel.
Returns:
dbui.Node:
the configuration of a tree node.
"""
node = Node(T("People and objects"))
# NOTE
# Immediate translation is required by node.short_children
node = Node(T("The lists"))
add_child = node.add_child
add_child(T("people", lazy=False), to_grid(db.people))
add_child(T("people_categories", lazy=False),
to_grid(db.people_categories))
add_child(T("objects", lazy=False), to_grid(db.objects))
for row in db(db.lists2.id > 0).select(orderby=db.lists2.name):
add_child(T("object_categories", lazy=False),
to_grid(db.object_categories))
panel = selector_panel
panel.baseUrl = URL("plugin_event", "grid")
panel.baseParams = {"id_list": row.id}
node.sort_children()
add_child(row.name, panel)
return node
@staticmethod
def list_node(db, T, selector_panel):
"""To deal with lists.
def metric2d_node(db, T, selector_panel):
"""To deal with two-dimension metrics.
Args:
db (pyDAL.DAL): database connection
......@@ -231,23 +229,55 @@ class ViewportUi(object):
dbui.Node:
the configuration of a tree node.
"""
node = Node(T("The lists"))
node = Node(T("The metrics 2d"))
add_child = node.add_child
for row in db(db.lists2.id > 0).select(orderby=db.lists2.name):
for row in db(db.metrics2d2.id > 0).select(orderby=db.metrics2d2.name):
panel = selector_panel
panel.baseUrl = URL("plugin_event", "grid")
panel.baseParams = {"id_list": row.id}
panel.baseUrl = URL("plugin_event", "metric2d")
panel.baseParams = {"id_metric2d": row.id}
add_child(row.name, panel)
return node
@staticmethod
def metric2d_node(db, T, selector_panel):
"""To deal with two-dimension metrics.
def people_object_node(db, T):
"""To deal with people and objects.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
Returns:
dbui.Node:
the configuration of a tree node.
"""
node = Node(T("People and objects"))
# NOTE
# Immediate translation is required by node.short_children
add_child = node.add_child
add_child(T("people", lazy=False), to_grid(db.people))
add_child(T("people_categories", lazy=False),
to_grid(db.people_categories))
add_child(T("objects", lazy=False), to_grid(db.objects))
add_child(T("object_categories", lazy=False),
to_grid(db.object_categories))
node.sort_children()
return node
@staticmethod
def source_node(db, T, selector_panel):
"""To deal with sources.
Args:
db (pyDAL.DAL): database connection
......@@ -259,16 +289,17 @@ class ViewportUi(object):
dbui.Node:
the configuration of a tree node.
"""
node = Node(T("The metrics 2d"))
node = Node(T("The sources"))
add_child = node.add_child
for row in db(db.metrics2d2.id > 0).select(orderby=db.metrics2d2.name):
for source in sorted(Event.get_sources()):
panel = selector_panel
panel.baseUrl = URL("plugin_event", "metric2d")
panel.baseParams = {"id_metric2d": row.id}
panel.baseUrl = URL("plugin_event", "source")
panel.baseParams = {"source": source}
add_child(row.name, panel)
add_child(source, panel)
return node
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment