Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 3a277f19 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the table objects, objects_categories and polish the interface.

parent f540b4d2
docs/db_schema/database.png

95.7 KB | W: | H:

docs/db_schema/database.png

130 KB | W: | H:

docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/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><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="806" y="19" name="lists"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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="903" y="18" name="metrics2d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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_x" null="0" autoincrement="0"><datatype>string</datatype></row><row name="group_field_y" null="0" autoincrement="0"><datatype>string</datatype></row><row name="metric_field_z" null="0" autoincrement="0"><datatype>string</datatype></row><row name="aggregate_z" 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="909" y="224" name="graphs"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="report_type" null="0" autoincrement="0"><datatype>string</datatype></row><row name="report_name" null="1" autoincrement="0"><datatype>string</datatype></row><row name="plot" null="0" 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="777" y="225" name="metrics1d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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="columns" null="0" 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></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><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_objects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="objects" row="id" /></row><row name="id_object_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="object_categories" 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="827" y="22" name="lists"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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="934" y="193" name="metrics2d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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_x" null="0" autoincrement="0"><datatype>string</datatype></row><row name="group_field_y" null="0" autoincrement="0"><datatype>string</datatype></row><row name="metric_field_z" null="0" autoincrement="0"><datatype>string</datatype></row><row name="aggregate_z" 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="1065" y="22" name="graphs"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="report_type" null="0" autoincrement="0"><datatype>string</datatype></row><row name="report_name" null="1" autoincrement="0"><datatype>string</datatype></row><row name="plot" null="0" 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="929" y="19" name="metrics1d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" 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="columns" null="0" 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="616" y="391" name="object_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>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="324" y="372" name="objects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="reference" null="1" autoincrement="0"><datatype>string</datatype></row><row name="serial_number" null="0" autoincrement="0"><datatype>string</datatype></row><row name="batch_number" null="0" autoincrement="0"><datatype>string</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
......@@ -242,6 +242,8 @@
'Nom de famille': 'Nom de famille',
'Note': 'Note',
'Notified': 'Notifié',
'Object': 'Objet',
'Object category': "Cat. objet",
'Object or table name': 'Object or table name',
'Open source': 'Code open source',
'Order by': 'Trié par',
......@@ -251,6 +253,7 @@
"Password fields don't match": "Password fields don't match",
'People': 'Personnes',
'people': 'personnes',
'People category': "Cat. personne",
'People per category': 'Personnes par catégorie',
'People per quality': 'Personnes par qualité',
'People per team': 'Personnes par équipe',
......@@ -284,6 +287,7 @@
'Qualité': 'Qualité',
'Ratio': 'Ratio',
'Record ID': 'Record ID',
'Reference': 'Référence',
'Register': 'Register',
'Registration identifier': 'Registration identifier',
'Registration key': 'Registration key',
......
......@@ -62,6 +62,8 @@ tables = ['auth_group',
'lists',
'metrics1d',
'metrics2d',
'object_categories',
'objects',
'people',
'people_categories',
'projects',
......
# -*- coding: utf-8 -*-
""" object_categories
"""
db.define_table("object_categories",
Field("code", "string", length=255, notnull=True, unique=True),
Field("category", "string", length=255, notnull=True),
Field("definition", "text"),
migrate="object_categories.table")
db.object_categories._before_delete.append(INHIBIT_CASCADE_DELETE)
db.object_categories._before_delete.append(dbui.INHIBIT_DELETE_UNDEF)
db.object_categories._before_update.append(dbui.INHIBIT_UPDATE_UNDEF)
# -*- coding: utf-8 -*-
""" objects
"""
db.define_table("objects",
Field("reference", "string", length=255, notnull=True, unique=True),
Field("serial_number", "string", length=255),
Field("batch_number", "string", length=255),
Field("note", "text"),
migrate="objects.table")
db.objects._before_delete.append(INHIBIT_CASCADE_DELETE)
db.objects._before_delete.append(dbui.INHIBIT_DELETE_UNDEF)
db.objects._before_update.append(dbui.INHIBIT_UPDATE_UNDEF)
......@@ -3,15 +3,17 @@
"""
db.define_table("history",
Field("id_people", "reference people", default=undef_id, label='Person'),
Field("id_events", "reference events", default=undef_id, label='Event'),
Field("id_teams", "reference teams", default=undef_id, label='Team'),
Field("id_projects", "reference projects", default=undef_id, label='Project'),
Field("id_people_categories", "reference people_categories", default=undef_id, label='Category'),
Field("id_fundings", "reference fundings", default=undef_id, label='Funding'),
Field("id_events", "reference events", default=undef_id, label='Event'),
Field("id_people", "reference people", default=undef_id, label='Person'),
Field("id_people_categories", "reference people_categories", default=undef_id, label='People category'),
Field("percentage", "integer", default=None),
Field("id_objects", "reference objects", default=undef_id, label='Object'),
Field("id_object_categories", "reference object_categories", default=undef_id, label='Object category'),
Field("start_date", "date", default=today, notnull=True),
Field("end_date", "date"),
Field("percentage", "integer", default=None, label='Perc.'),
Field("note", "text"),
Field("data", "json"),
migrate="history.table")
......
......@@ -28,20 +28,25 @@ fieldsModifier.configure_field('note', height=150)
#
#-------------------------------------------------------------------------------
formModifier = dbui.FormModifier('history')
formModifier.merge_fields('id_people',
'id_teams',
formModifier.merge_fields('id_teams',
'id_projects',
'id_people_categories',
'id_fundings',
'percentage',
title=T('Metadata'))
formModifier.merge_fields('start_date',
'id_events',
formModifier.merge_fields('id_people',
'id_people_categories',
'percentage',
title=T('Person'))
formModifier.merge_fields('id_objects',
'id_object_categories',
title=T('Object'))
formModifier.merge_fields('id_events',
'start_date',
'data',
title=T('Event'))
formModifier.merge_fields('note',
title=T('Note'))
......@@ -57,26 +62,20 @@ formModifier.configure(buttonAlign='right', width=450)
gridModifier = dbui.GridModifier('history')
gridModifier.configure(plugins=['pGridPaging'])
gridModifier.hide_columns('cdd_flag',
'data',
'id_organization_levels',
'id_organizations',
'id_projects',
'id_fundings',
'hardware_cost',
'hardware_model',
gridModifier.hide_columns('data',
'id_object_categories',
'id_people_categories',
'note',
'percentage',
'responsibility',
'trainee_category',
'trainee_title',
'trainee_university')
'percentage')
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_events', '==', T('is equal to')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('id_fundings', '==', T('is equal to')))
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_people_categories', '==', T('is equal to')))
gridModifier.append_filter(('id_events', '==', T('is equal to')))
gridModifier.append_filter(('objects.reference', 'contains', T('contains')))
gridModifier.append_filter(('id_object_categories', '==', T('is equal to')))
gridModifier.append_filter(('start_date', '>=', T('greater or equal to')))
gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
......
# -*- coding: utf-8 -*-
""" object_categories
"""
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# FORM CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('object_categories')
gridModifier.configure_column('code', width=20)
gridModifier.configure_column('category', width=20)
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('object_categories')
storeModifier.orderby(db.object_categories.code)
# -*- coding: utf-8 -*-
""" objects
"""
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# FORM CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('objects')
gridModifier.append_filter(('reference', 'contains', T('contains')))
gridModifier.append_filter(('serial_number', 'contains', T('contains')))
gridModifier.append_filter(('batch_number', 'contains', T('contains')))
gridModifier.configure_filters(plugins=['pFormToolTip'], width=300)
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('objects')
storeModifier.orderby(db.objects.reference)
......@@ -11,12 +11,27 @@ if not db(db.events.id).count():
definition=undef)
if not db(db.fundings.id).count():
db.fundings.insert(id=undef_id, agency=undef, definition=undef)
db.fundings.insert(id=undef_id,
agency=undef,
definition=undef)
if not db(db.object_categories.id).count():
db.object_categories.insert(id=undef_id,
code=undef,
category=undef,
definition=undef)
if not db(db.objects.id).count():
db.objects.insert(id=undef_id,
reference=undef,
serial_number=undef,
batch_number=undef)
if not db(db.people.id).count():
db.people.insert(id=undef_id, first_name=undef,
last_name=undef,
initials=undef)
db.people.insert(id=undef_id,
first_name=undef,
last_name=undef,
initials=undef)
if not db(db.people_categories.id).count():
db.people_categories.insert(id=undef_id,
......@@ -25,7 +40,10 @@ if not db(db.people_categories.id).count():
definition=undef)
if not db(db.projects.id).count():
db.projects.insert(id=undef_id, project=undef)
db.projects.insert(id=undef_id,
project=undef)
if not db(db.teams.id).count():
db.teams.insert(id=undef_id, team=undef, domain=undef)
\ No newline at end of file
db.teams.insert(id=undef_id,
team=undef,
domain=undef)
\ No newline at end of file
# -*- coding: utf-8 -*-
""" NAME
fix-object
SYNOPSIS
Set undef_id for id_objects and id_object_categories.
DESCRIPTION
When adding the new tables objects and object_categories,
the values are wrong for the foreign keys in the history
table. They have to equal to 1 instead of NULL.
OPTIONS
-h, --help
Display the help and exit.
EXAMPLE
> cd ...track_lhcbfrance/scripts
> ./run fix-object
AUTHOR
R. Le Gac -- Jan 2015
"""
if __name__ == "__main__":
import re
import sys
from argparse import ArgumentParser
# command line options
parser = ArgumentParser()
args = parser.parse_args()
# scan the history table
for row in db(db.history).select():
print row.id, row.id_objects, row.id_object_categories
db.history[row.id] = dict(id_objects=1, id_object_categories=1)
# commit and close
rep = raw_input("Commit change [n]?")
if rep.lower().startswith('y'):
db.commit()
print "database modified"
sys.exit(0)
--------------------------------- CHANGE LOG ----------------------------------
HEAD
- Major relealse non backward compatible
- Add the tables objects and object_categories for a more generic tool.
- List, Metric1D and 2D works with missing data.
It appends when several events are selected at at the same time.
It appends when several events with different user blocks are merged.
- Re-enforce column configuration rules: xtype has always to be defined,
dataIndex is required with eval.
......
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