Commit 69a8c61b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Polish the metric interface.

parent b6e14bd2
......@@ -99,11 +99,13 @@ def metric1D():
"""
metric = db.metrics[request.vars.id_metrics]
report = Report(virtdb.metric_selector, exclude_fields=('category',
'metric',
'period_end',
'period_start',
'year'))
selector = virtdb.metric_selector_1D
report = Report(selector, exclude_fields=('category',
'metric',
'period_end',
'period_start',
'year'))
# apply filter condition from the metric
if metric.conditions:
......@@ -128,7 +130,7 @@ def metric1D():
cfg['data'].append([di['group'], di['count'], di['sum_fte'], di['avg_age']])
# customize the standard view (Ext.grid.Panel)
view = Storage(columns=[], features=[])
view = Storage(columns=[], features=[], title=metric.title)
view.columns = [{'text': T(label.title()),
'dataIndex': 'group',
'flex': 0.8},
......@@ -174,11 +176,12 @@ def metric2D():
"""
metric = db.metrics[request.vars.id_metrics]
report = Report(virtdb.metric_selector, exclude_fields=('category',
'metric',
'period_end',
'period_start',
'year'))
selector = virtdb.metric_selector_2D
report = Report(selector, exclude_fields=('category',
'metric',
'period_end',
'period_start',
'year'))
# decode filter condition from the metric
if metric.conditions:
......@@ -251,7 +254,7 @@ def metric2D():
cfg['data'].append(data[k])
# customize the standard view (Ext.grid.Panel)
view = Storage(columns=[], features=[])
view = Storage(columns=[], features=[], title=metric.title)
view.columns.append({'text': T(label_v.title()),
'dataIndex': 'group',
'flex': 0.8})
......
......@@ -52,12 +52,12 @@
'Conditions': 'Conditions',
'Configuration': 'Configuration',
'Configure': 'Configurer',
'Configure lists': 'Configurer les listes',
'contains': 'contiens',
'Contract': 'Contrat',
'Controller': 'Controller',
'Copyright': 'Copyright',
'Cost': 'Coût',
'Count by': 'Compter par',
'Count people': 'Nombre de personne',
'Coverage': 'Coverage',
'Coverage 2': 'Coverage 2',
......@@ -84,8 +84,8 @@
'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.columnname while the value is a string.': 'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.columnname while the value is a string.',
'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.fieldname. The value is a string.': 'Dictionary associating the column name with the column label. The key is a column name encoded as tablename.fieldname. The value is a string.',
'Documentation for developers': 'Documentation développeurs',
'documentations': 'documentations',
'Documentations': 'Documentations',
'documentations': 'documentations',
'Domain': 'Domaine',
'Domaine': 'Domaine',
'Duration': 'Durée',
......@@ -108,6 +108,8 @@
'Feature not yet implemented ...': 'Feature not yet implemented ...',
'Features': 'Features',
'Field': 'Champ',
'Field Horizontal': 'Champ horizontal',
'Field Vertical': 'Champ vertical',
'Filter agencies': 'Filtrer les agences',
'Filter budgets': 'Filtrer les budgets',
'Filter careers': 'Filtrer les carrières',
......@@ -278,6 +280,7 @@
'select...': 'selectionner...',
'since %s': 'depuis %s',
'Software versions': 'Versions des logiciels',
'sorters': 'sorters',
'Sorters': 'Sorters',
'Stage': 'Stage',
'Start': 'Début',
......
# -*- coding: utf-8 -*-
""" metric_selector_1D
"""
virtdb.define_table('metric_selector_1D',
Field('year', 'integer', default=year),
Field('id_teams', 'reference teams', label=T('Team')),
Field('category', 'string'),
Field('id_people_categories', 'reference people_categories', label= T("Quality")),
Field('period_start', 'date'),
Field('period_end', 'date'),
Field('id_projects', 'reference projects', label=T('Project')))
virtdb.metric_selector_1D.category.requires = IS_IN_SET(PEOPLE_CATEGORIES)
virtdb.metric_selector_1D.id_people_categories.requires = IS_IN_DB(db, 'people_categories.code')
virtdb.metric_selector_1D.id_projects.requires = IS_IN_DB(db, 'projects.project')
virtdb.metric_selector_1D.id_teams.requires = IS_IN_DB(db, 'teams.team')
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
fieldsModifier = dbui.FieldsModifier('metric_selector_1D')
fieldsModifier.configure_field('period_start', flex=1)
fieldsModifier.configure_field('period_end', flex=1)
fieldsModifier.merge_fields('period_start', 'period_end', fieldLabel=T('Period'))
mytype = 'xcomboboxuserreset'
text = T('select...')
fieldsModifier.configure_field('id_people_categories', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_teams', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_projects', emptyText=text, xtype=mytype)
#-------------------------------------------------------------------------------
#
# FORM CONFIGURATiON
#
#-------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
""" metric_selector
""" metric_selector_2D
"""
virtdb.define_table('metric_selector',
virtdb.define_table('metric_selector_2D',
Field('year', 'integer', default=year),
Field('id_teams', 'reference teams', label=T('Team')),
Field('category', 'string'),
......@@ -12,20 +12,20 @@ virtdb.define_table('metric_selector',
Field('id_projects', 'reference projects', label=T('Project')),
Field('metric', 'string', default='sum_fte'))
virtdb.metric_selector.category.requires = IS_IN_SET(PEOPLE_CATEGORIES)
virtdb.metric_selector.id_people_categories.requires = IS_IN_DB(db, 'people_categories.code')
virtdb.metric_selector_2D.category.requires = IS_IN_SET(PEOPLE_CATEGORIES)
virtdb.metric_selector_2D.id_people_categories.requires = IS_IN_DB(db, 'people_categories.code')
virtdb.metric_selector.id_projects.requires = IS_IN_DB(db, 'projects.project')
virtdb.metric_selector.id_teams.requires = IS_IN_DB(db, 'teams.team')
virtdb.metric_selector_2D.id_projects.requires = IS_IN_DB(db, 'projects.project')
virtdb.metric_selector_2D.id_teams.requires = IS_IN_DB(db, 'teams.team')
virtdb.metric_selector.metric.requires = IS_IN_SET(('avg_age', 'count', 'sum_fte'))
virtdb.metric_selector_2D.metric.requires = IS_IN_SET(('count', 'sum_fte'))
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
fieldsModifier = dbui.FieldsModifier('metric_selector')
fieldsModifier = dbui.FieldsModifier('metric_selector_2D')
fieldsModifier.configure_field('period_start', flex=1)
fieldsModifier.configure_field('period_end', flex=1)
fieldsModifier.merge_fields('period_start', 'period_end', fieldLabel=T('Period'))
......
......@@ -93,7 +93,7 @@ eventNode.add_child(T('history'), to_grid('history'))
#-------------------------------------------------------------------------------
listNode = Node(T('The lists'))
for row in db(db.lists.id > 0).select():
for row in db(db.lists.id > 0).select(orderby=db.lists.list):
leaf = PanelWithUrlSelector(virtdb.list_selector,
baseUrl=URL('report', 'list'),
......@@ -106,49 +106,20 @@ for row in db(db.lists.id > 0).select():
# METRIC
#
#-------------------------------------------------------------------------------
metricNode2 = Node(T('The metrics'))
metricNode = Node(T('The metrics'))
for row in db(db.metrics.id > 0).select():
for row in db(db.metrics.id > 0).select(orderby=db.metrics.metric):
# select the action
action = 'metric1D'
# select the action and the selector
action, selector = 'metric1D', virtdb.metric_selector_1D
if row.field_horizontal:
action = 'metric2D'
action, selector = 'metric2D', virtdb.metric_selector_2D
leaf = PanelWithUrlSelector(virtdb.metric_selector,
leaf = PanelWithUrlSelector(selector,
baseUrl=URL('report', action),
baseParams={'id_metrics': row.id})
metricNode2.add_child(row.metric, leaf)
#-------------------------------------------------------------------------------
#
# METRIC (OLD)
#
#-------------------------------------------------------------------------------
metricNode = Node(T('The metrics (old)'))
leaf1 = PanelWithUrlSelector(virtdb.metric_selector,
baseParams={'group': 'people_categories.category'},
baseUrl=URL('report', 'metric'))
leaf2 = PanelWithUrlSelector(virtdb.metric_selector,
baseParams={'group': 'people_categories.code'},
baseUrl=URL('report', 'metric'))
leaf3 = PanelWithUrlSelector(virtdb.metric_selector,
baseParams={'group': 'people_categories.category'},
baseUrl=URL('report', 'metric_per_year'))
leaf4 = PanelWithUrlSelector(virtdb.metric_selector,
baseParams={'group': 'people_categories.code'},
baseUrl=URL('report', 'metric_per_year'))
metricNode.add_child(T('Metrics / category'), leaf1)
metricNode.add_child(T('Metrics / quality'), leaf2)
metricNode.add_child(T('Metric / year / category'), leaf3)
metricNode.add_child(T('Metric / year / quality'), leaf4)
metricNode.sort_children()
metricNode.add_child(row.metric, leaf)
#-------------------------------------------------------------------------------
#
......@@ -168,7 +139,6 @@ nodes = [helpNode,
metaNode,
eventNode,
listNode,
metricNode2,
metricNode,
graphNode]
......
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