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
c09f5bbd
Commit
c09f5bbd
authored
Feb 28, 2017
by
LE GAC Renaud
Browse files
Modify the database schema for the table list2 (eval, query).
parent
a96ea15c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
20 deletions
+47
-20
docs/db_schema/database.png
docs/db_schema/database.png
+0
-0
docs/db_schema/database.xml
docs/db_schema/database.xml
+4
-1
modules/plugin_event/model_report.py
modules/plugin_event/model_report.py
+4
-5
modules/plugin_event/report_tools.py
modules/plugin_event/report_tools.py
+5
-2
modules/plugin_event/ui_report.py
modules/plugin_event/ui_report.py
+34
-12
No files found.
docs/db_schema/database.png
View replaced file @
a96ea15c
View file @
c09f5bbd
177 KB
|
W:
|
H:
178 KB
|
W:
|
H:
2-up
Swipe
Onion skin
docs/db_schema/database.xml
View file @
c09f5bbd
...
...
@@ -362,7 +362,10 @@
<datatype>
integer
</datatype>
<relation
table=
"events"
row=
"id"
/>
</row>
<row
name=
"transform"
null=
"1"
autoincrement=
"0"
>
<row
name=
"eval"
null=
"1"
autoincrement=
"0"
>
<datatype>
string
</datatype>
<default>
NULL
</default></row>
<row
name=
"query"
null=
"1"
autoincrement=
"0"
>
<datatype>
string
</datatype>
<default>
NULL
</default></row>
<row
name=
"group_field"
null=
"1"
autoincrement=
"0"
>
...
...
modules/plugin_event/model_report.py
View file @
c09f5bbd
...
...
@@ -196,7 +196,8 @@ class Report(object):
notnull
=
True
,
label
=
"Event"
),
Field
(
"transform"
,
"text"
),
Field
(
"eval"
,
"text"
),
Field
(
"query"
,
"text"
),
Field
(
"group_field"
,
"string"
,
...
...
@@ -205,11 +206,9 @@ class Report(object):
Field
(
"sorters"
,
"list:string"
,
comment
=
TP_SORTERS
),
Field
(
"columns"
,
"text"
,
Field
(
"columns"
,
"text"
,
default
=
def_columns
,
comment
=
T
(
TP_COLUMNS
),
notnull
=
True
),
comment
=
T
(
TP_COLUMNS
)),
Field
(
"features"
,
"text"
,
...
...
modules/plugin_event/report_tools.py
View file @
c09f5bbd
...
...
@@ -118,8 +118,11 @@ class List2(object):
df
=
func
(
**
criteria
)
if
not
df
.
empty
and
config
.
transform
not
in
(
None
,
""
):
df
.
eval
(
config
.
transform
,
inplace
=
True
)
if
not
df
.
empty
and
config
.
eval
not
in
(
None
,
""
):
df
.
eval
(
config
.
eval
,
inplace
=
True
)
if
not
df
.
empty
and
config
.
query
not
in
(
None
,
""
):
df
.
query
(
config
.
query
,
inplace
=
True
)
# ....................................................................
#
...
...
modules/plugin_event/ui_report.py
View file @
c09f5bbd
...
...
@@ -10,6 +10,20 @@ formModifier = dbui.FormModifier
gridModifier
=
dbui
.
GridModifier
storeModifier
=
dbui
.
StoreModifier
COLUMN_GUIDE
=
"All columns will be created when the field is empty"
EVAL_GUIDE
=
"""
It is possible to transform the source by creating new columns from existing
ones using arithmetical expressions. The expression is written in natural
language with one assignment per line. For more details have a look to the
function pandas.eval and to the method pandas.DataFrame.eval.
"""
QUERY_GUIDE
=
"""
It is possible to select data by applying a query on fields of the source.
The query is written in natural language using and / or operator.
For more details have a look to the method pandas.DataFrame.query.
"""
class
ReportUi
(
object
):
...
...
@@ -205,12 +219,19 @@ class ReportUi(object):
mdf
.
configure_field
(
"columns"
,
editorHeight
=
240
,
hideLabel
=
True
,
fieldLabel
=
COLUMN_GUIDE
,
hideLabel
=
False
,
labelAlign
=
"top"
,
language
=
"json"
,
xtype
=
"xaceeditorfield"
)
mdf
.
configure_field
(
"definition"
,
height
=
100
)
mdf
.
configure_field
(
"eval"
,
emptyText
=
EVAL_GUIDE
,
height
=
120
,
hideLabel
=
True
)
mdf
.
configure_field
(
"features"
,
editorHeight
=
240
,
hideLabel
=
True
,
...
...
@@ -219,17 +240,16 @@ class ReportUi(object):
mdf
.
configure_field
(
"id_events"
,
emptyText
=
" "
)
mdf
.
configure_field
(
"query"
,
emptyText
=
QUERY_GUIDE
,
height
=
120
,
hideLabel
=
True
)
mdf
.
configure_field
(
"sorters"
,
height
=
210
,
hideHeader
=
True
,
minimumRows
=
10
)
mdf
.
configure_field
(
"transform"
,
editorHeight
=
240
,
hideLabel
=
True
,
language
=
"python"
,
xtype
=
"xaceeditorfield"
)
#.....................................................................
#
# Form
...
...
@@ -243,13 +263,14 @@ class ReportUi(object):
"definition"
,
title
=
T
(
"General"
))
mdf
.
merge_fields
(
"transform"
,
title
=
T
(
"Transform"
))
mdf
.
merge_fields
(
"group_field"
,
"sorters"
,
title
=
T
(
"Group"
))
mdf
.
merge_fields
(
"eval"
,
"query"
,
title
=
T
(
"Transform"
))
mdf
.
merge_fields
(
"columns"
,
title
=
T
(
"Columns"
))
...
...
@@ -267,14 +288,15 @@ class ReportUi(object):
mdf
.
configure_column
(
"name"
,
width
=
30
)
mdf
.
hide_columns
(
"columns"
,
"conditions"
,
"eval"
,
"features"
,
"group_field"
,
"id_events"
,
"kwargs"
,
"query"
,
"sorters"
,
"source"
,
"title"
,
"transform"
)
"title"
)
#.....................................................................
#
...
...
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