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

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

Add the database table lists2.

parent 399c9848
docs/db_schema/database.png

127 KB | W: | H:

docs/db_schema/database.png

173 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
......@@ -342,4 +342,42 @@
<part>id</part>
</key>
</table>
<table x="819" y="246" name="lists2">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="title" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="source" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="kwargs" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="transform" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="group_field" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="sorters" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="columns" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="features" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
</sql>
......@@ -85,6 +85,7 @@ if ctrl == "plugin_dbui" and fnct in ("call", "dbui_conf"):
"fundings",
"graphs",
"lists",
"lists2",
"metrics1d",
"metrics2d",
"object_categories",
......
......@@ -8,6 +8,7 @@ import plugin_dbui as dbui
from callbacks import INHIBIT_CASCADE_DELETE
from gluon import current, IS_IN_DB
from pydal import Field
from pygments.lexer import default
DEF_COLUMNS_LISTS = \
......@@ -94,6 +95,7 @@ class Report(object):
Report.graphs(db, T)
Report.lists(db, T)
Report.lists2(db, T)
Report.metrics1d(db, T)
Report.metrics2d(db, T)
......@@ -167,6 +169,52 @@ class Report(object):
return table
@staticmethod
def lists2(db, T):
"""lists2 table
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
Returns:
pyDAL.Table
"""
def_columns = (None if db._migrate else DEF_COLUMNS_LISTS)
def_features = (None if db._migrate else DEF_FEATURES)
table = db.define_table(
"lists2",
Field("name", "string", length=255, notnull=True, unique=True),
Field("title", "string", length=255),
Field("definition", "text"),
Field("source", "string", length=255, notnull=True),
Field("kwargs", "json", default=dict()),
Field("transform", "text"),
Field("group_field",
"string",
length=255,
comment=T(TP_GROUP_FIELD_LISTS)),
Field("sorters", "list:string", comment=TP_SORTERS),
Field("columns",
"text",
default=def_columns,
comment=T(TP_COLUMNS),
notnull=True),
Field("features",
"text",
default=def_features,
comment=T(TP_FEATURES)),
migrate="lists2.table")
return table
@staticmethod
def metrics1d(db, T):
"""metrics1d table
......
......@@ -25,6 +25,7 @@ class ReportUi(object):
"""
ReportUi.graphs(db, T)
ReportUi.lists(db, T)
ReportUi.lists2(db, T)
ReportUi.metrics1d(db, T)
ReportUi.metrics2d(db, T)
......@@ -187,6 +188,99 @@ class ReportUi(object):
#
storeModifier("lists").orderby(db.lists.name)
@staticmethod
def lists2(db, T):
"""UI for the lists table
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
#.....................................................................
#
# Fields
#
mdf = fieldsModifier("lists2")
mdf.configure_field("columns",
editorHeight=240,
hideLabel=True,
language="json",
xtype="xaceeditorfield")
mdf.configure_field("definition", height=100)
mdf.configure_field("features",
editorHeight=240,
hideLabel=True,
language="json",
xtype="xaceeditorfield")
mdf.configure_field("sorters",
height=210,
hideHeader=True,
minimumRows=10)
mdf.configure_field("transform",
editorHeight=240,
hideLabel=True,
language="python",
xtype="xaceeditorfield")
#.....................................................................
#
# Form
#
mdf = formModifier("lists2")
mdf.merge_fields("name",
"title",
"definition",
title=T("General"))
mdf.merge_fields("source",
"kwargs",
title=T("Source"))
mdf.merge_fields("transform",
title=T("Transform"))
mdf.merge_fields("group_field",
"sorters",
title=T("Group"))
mdf.merge_fields("columns",
title=T("Columns"))
mdf.merge_fields("features",
title=T("Summary"))
mdf.set_mapper(dbui.map_tabpanel)
mdf.configure(width=450)
#.....................................................................
#
# Grid
#
mdf = gridModifier("lists2")
mdf.configure_column("name", width=30)
mdf.hide_columns("title",
"columns",
"conditions",
"features",
"group_field",
"kwargs",
"sorters",
"source",
"transform")
#.....................................................................
#
# Store
#
storeModifier("lists2").orderby(db.lists2.name)
@staticmethod
def metrics1d(db, T):
"""UI for the metrics1d table
......
......@@ -35,6 +35,7 @@ class ViewportUi(object):
ViewportUi.object_node(db, T),
ViewportUi.event_node(db, T),
ViewportUi.list_node(db, T, selector_panel),
ViewportUi.list2_node(db, T, selector_panel),
ViewportUi.metric1d_node(db, T, selector_panel),
ViewportUi.metric2d_node(db, T, selector_panel),
ViewportUi.graph_node(db, T, selector_panel)]
......@@ -136,6 +137,7 @@ class ViewportUi(object):
add_child = node.add_child
add_child(T("the lists"), to_grid(db.lists))
add_child(T("the lists #2"), to_grid(db.lists2))
add_child(T("the metrics 1d"), to_grid(db.metrics1d))
add_child(T("the metrics 2d"), to_grid(db.metrics2d))
add_child(T("the graphs"), to_grid(db.graphs))
......@@ -244,6 +246,34 @@ class ViewportUi(object):
return node
@staticmethod
def list2_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("The lists #2"))
add_child = node.add_child
for row in db(db.lists2.id > 0).select(orderby=db.lists.name):
panel = selector_panel
panel.baseUrl = URL("plugin_event", "grid")
panel.baseParams = {"id_lists": row.id}
add_child(row.name, panel)
return node
@staticmethod
def metric1d_node(db, T, selector_panel):
"""To deal with one-dimension metrics.
......
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