Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tev
plugin_event
Commits
e32e1b87
Commit
e32e1b87
authored
Feb 20, 2017
by
LE GAC Renaud
Browse files
Add the database table lists2.
parent
399c9848
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
211 additions
and
0 deletions
+211
-0
docs/db_schema/database.png
docs/db_schema/database.png
+0
-0
docs/db_schema/database.xml
docs/db_schema/database.xml
+38
-0
models/common_settings.py
models/common_settings.py
+1
-0
modules/plugin_event/model_report.py
modules/plugin_event/model_report.py
+48
-0
modules/plugin_event/ui_report.py
modules/plugin_event/ui_report.py
+94
-0
modules/plugin_event/ui_viewport.py
modules/plugin_event/ui_viewport.py
+30
-0
No files found.
docs/db_schema/database.png
View replaced file @
399c9848
View file @
e32e1b87
127 KB
|
W:
|
H:
173 KB
|
W:
|
H:
2-up
Swipe
Onion skin
docs/db_schema/database.xml
View file @
e32e1b87
...
...
@@ -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>
models/common_settings.py
View file @
e32e1b87
...
...
@@ -85,6 +85,7 @@ if ctrl == "plugin_dbui" and fnct in ("call", "dbui_conf"):
"fundings"
,
"graphs"
,
"lists"
,
"lists2"
,
"metrics1d"
,
"metrics2d"
,
"object_categories"
,
...
...
modules/plugin_event/model_report.py
View file @
e32e1b87
...
...
@@ -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
...
...
modules/plugin_event/ui_report.py
View file @
e32e1b87
...
...
@@ -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
...
...
modules/plugin_event/ui_viewport.py
View file @
e32e1b87
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment