Commit b6e14bd2 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Rename the views table as lists and polish metrics table.

parent e3f8e373
......@@ -17,38 +17,38 @@ from reporting_tools import Report, repr_duration, to_dataFields
def list():
"""List renders by an Ext.grid.Panel.
The controller extracts the configuration of the view
The controller extracts the configuration of the list
and builds the configuration for the Ext.data.Array.
The latter is the core component embedded in the grid.
The view identifier is defined in the viewport
The list identifier is defined in the viewport
and send using the baseParams techniques.
"""
# alias
now = date.today()
view = db.views[request.vars.id_views]
list = db.lists[request.vars.id_lists]
report = Report(virtdb.list_selector, exclude_fields=('category',
'period_end',
'period_start',
'year'))
# apply filter condition from the view
if view.conditions:
q_conditions = smart_query(db.history, view.conditions)
# apply filter condition from the list
if list.conditions:
q_conditions = smart_query(db.history, list.conditions)
report.append_query(q_conditions)
# configure the Ext.data.ArrayStore
cfg = dict()
cfg['data'] = []
cfg['fields'] = to_dataFields(view.columns)
cfg['fields'] = to_dataFields(list.columns)
if view.group_field:
cfg['groupField'] = view.group_field
if list.group_field:
cfg['groupField'] = list.group_field
if view.sorters:
cfg['sorters'] = view.sorters
if list.sorters:
cfg['sorters'] = list.sorters
# fill the data block
# It is mandatory to preserve the data fields order
......@@ -84,7 +84,7 @@ def list():
cfg['data'].append(li)
response.view = 'report/grid.html'
return dict(cfg_store=cfg, view=view)
return dict(cfg_store=cfg, view=list)
def metric1D():
......
......@@ -58,12 +58,12 @@ tables = ['auth_group',
'events',
'fundings',
'history',
'lists',
'metrics',
'people',
'people_categories',
'projects',
'teams',
'views']
'teams']
dbui.configure_forms(tables, plugins=['pFormToolTip'], width=350)
......
# -*- coding: utf-8 -*-
""" views
""" lists
"""
tp_columns = \
......@@ -30,12 +30,13 @@ def_columns = \
def_features = \
"[{ftype:'grouping', groupHeaderTpl: '{name}', startCollapsed: false}]"
db.define_table("views",
Field("view", "string", length=255, notnull=True, unique=True),
db.define_table("lists",
Field("list", "string", length=255, notnull=True, unique=True),
Field("title", "string", length=255),
Field("conditions", "text", comment=tp_conditions),
Field("group_field", "string", length=255, comment=tp_fields),
Field("sorters", "list:string", comment=tp_fields),
Field("columns", "text", default=def_columns, comment=tp_columns, notnull=True),
Field("features", "text", default=def_features, comment=tp_features),
migrate="views.table")
Field("definition", "text"),
migrate="lists.table")
......@@ -20,7 +20,5 @@ db.define_table("metrics",
Field("conditions", "text", comment=tp_conditions),
Field("field_vertical", "string", length=255, notnull=True, comment=tp_fields),
Field("field_horizontal", "string", length=255, comment=tp_fields),
Field("sorters_vertical", "list:string", comment=tp_fields),
Field("sorters_horizontal", "list:string", comment=tp_fields),
Field("definition", "text", comment=tp_conditions),
Field("definition", "text"),
migrate="metrics.table")
# -*- coding: utf-8 -*-
""" views
""" lists
"""
#-------------------------------------------------------------------------------
......@@ -7,27 +7,33 @@
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
fieldsModifier = dbui.FieldsModifier('views')
fieldsModifier = dbui.FieldsModifier('lists')
fieldsModifier.configure_field('columns',
height=240,
hideLabel=True)
fieldsModifier.configure_field('definition', height=100)
fieldsModifier.configure_field('features',
height=240,
hideLabel=True)
fieldsModifier.configure_field('sorters',
hideHeader=True)
fieldsModifier.configure_field('sorters',
height=210,
hideHeader=True,
minimumRows=10)
#-------------------------------------------------------------------------------
#
# FORM CONFIGURATiON
#
#-------------------------------------------------------------------------------
formModifier = dbui.FormModifier('views')
formModifier = dbui.FormModifier('lists')
formModifier.merge_fields('view',
formModifier.merge_fields('list',
'title',
'definition',
'conditions',
title=T('General'))
......@@ -49,8 +55,8 @@ formModifier.configure(width=500)
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('views')
gridModifier.configure_column('group_field', width=30)
gridModifier = dbui.GridModifier('lists')
gridModifier.configure_column('list', width=30)
gridModifier.hide_columns('title',
'columns',
'conditions',
......@@ -63,5 +69,5 @@ gridModifier.hide_columns('title',
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('views')
storeModifier.orderby(db.views.view)
\ No newline at end of file
storeModifier = dbui.StoreModifier('lists')
storeModifier.orderby(db.lists.list)
\ No newline at end of file
......@@ -11,8 +11,6 @@ fieldsModifier = dbui.FieldsModifier('metrics')
fieldsModifier.configure_field('conditions', height=120)
fieldsModifier.configure_field('definition', height=120)
fieldsModifier.configure_field('sorters_horizontal', height=120)
fieldsModifier.configure_field('sorters_vertical', height=120)
#-------------------------------------------------------------------------------
#
......@@ -30,11 +28,7 @@ formModifier.merge_fields('field_vertical',
'field_horizontal',
'conditions',
title=T('Count by'))
formModifier.merge_fields('sorters_vertical',
'sorters_horizontal',
title=T('sorters'))
formModifier.set_mapper(dbui.map_tabpanel)
#-------------------------------------------------------------------------------
......@@ -47,9 +41,7 @@ gridModifier.configure_column('metric', width=30)
gridModifier.hide_columns('title',
'conditions',
'field_vertical',
'field_horizontal',
'sorters_vertical',
'sorters_horizontal')
'field_horizontal')
#-------------------------------------------------------------------------------
#
......
......@@ -61,8 +61,8 @@ helpNode.sort_children()
#
#-------------------------------------------------------------------------------
cfgNode = Node(T('Configure'))
cfgNode.add_child(T('Configure lists'), to_grid('views'))
cfgNode.add_child(T('Configure metrics'), to_grid('metrics'))
cfgNode.add_child(T('The lists'), to_grid('lists'))
cfgNode.add_child(T('The metrics'), to_grid('metrics'))
#-------------------------------------------------------------------------------
#
......@@ -93,13 +93,13 @@ eventNode.add_child(T('history'), to_grid('history'))
#-------------------------------------------------------------------------------
listNode = Node(T('The lists'))
for row in db(db.views.id > 0).select():
for row in db(db.lists.id > 0).select():
leaf = PanelWithUrlSelector(virtdb.list_selector,
baseUrl=URL('report', 'list'),
baseParams={'id_views': row.id})
baseParams={'id_lists': row.id})
listNode.add_child(row.view, leaf)
listNode.add_child(row.list, leaf)
#-------------------------------------------------------------------------------
#
......
static/docs/database.png

91.4 KB | W: | H:

static/docs/database.png

86.7 KB | W: | H:

static/docs/database.png
static/docs/database.png
static/docs/database.png
static/docs/database.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -22,4 +22,4 @@
<type label="Upload" length="0" sql="upload" quote="'"/>
<type label="Password" length="0" sql="password" quote="'"/>
</group>
</datatypes><table x="303" y="21" name="people"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="first_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="last_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="initials" null="0" autoincrement="0"><datatype>string</datatype></row><row name="birth_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="302" y="174" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><row name="domain" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="303" y="285" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><row name="agencies" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="618" y="19" name="people_categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="category" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="452" y="71" name="history"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_people_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people_categories" row="id" /></row><row name="id_fundings" null="0" autoincrement="0"><datatype>integer</datatype><relation table="fundings" row="id" /></row><row name="id_events" null="0" autoincrement="0"><datatype>integer</datatype><relation table="events" row="id" /></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="percentage" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="633" y="149" name="fundings"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="agency" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="638" y="266" name="events"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="event" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definitiion" null="1" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="819" y="193" name="views"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="view" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="group_field" null="1" autoincrement="0"><datatype>string</datatype></row><row name="sorters" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="columns" null="0" autoincrement="0"><datatype>text</datatype></row><row name="features" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="920" y="190" name="metrics"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="metric" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="field_vertical" null="0" autoincrement="0"><datatype>string</datatype></row><row name="field_horizontal" null="1" autoincrement="0"><datatype>string</datatype></row><row name="sorters_vertical" null="1" autoincrement="0"><datatype>string</datatype></row><row name="sorters_horizontal" null="1" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
</datatypes><table x="303" y="21" name="people"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="first_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="last_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="initials" null="0" autoincrement="0"><datatype>string</datatype></row><row name="birth_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="302" y="174" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><row name="domain" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="303" y="285" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><row name="agencies" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="618" y="19" name="people_categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="category" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="452" y="71" name="history"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_people_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people_categories" row="id" /></row><row name="id_fundings" null="0" autoincrement="0"><datatype>integer</datatype><relation table="fundings" row="id" /></row><row name="id_events" null="0" autoincrement="0"><datatype>integer</datatype><relation table="events" row="id" /></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="percentage" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="633" y="149" name="fundings"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="agency" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="638" y="266" name="events"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="event" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definitiion" null="1" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="818" y="192" name="lists"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="list" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="group_field" null="1" autoincrement="0"><datatype>string</datatype></row><row name="sorters" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="columns" null="0" autoincrement="0"><datatype>text</datatype></row><row name="features" null="1" autoincrement="0"><datatype>text</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="920" y="190" name="metrics"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="metric" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="field_vertical" null="0" autoincrement="0"><datatype>string</datatype></row><row name="field_horizontal" null="1" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
......@@ -18,7 +18,7 @@
#
divgrid = id(cfg_store)
response.write(H2(view.view, _class="dbui-h2 dbui-small-cap"))
response.write(H2(view.title, _class="dbui-h2 dbui-small-cap"))
response.write(DIV(_id="grid-%s" % divgrid))
#
......
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