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
90c87225
Commit
90c87225
authored
Jan 08, 2015
by
LE GAC Renaud
Browse files
Restore the metric reports using Ext.grid.Panel.
parent
9e7e0980
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
14 deletions
+83
-14
controllers/metric.py
controllers/metric.py
+3
-3
models/vt_people_selector.py
models/vt_people_selector.py
+1
-4
models/widgets_viewport.py
models/widgets_viewport.py
+3
-6
static/CHANGELOG
static/CHANGELOG
+1
-0
views/metric/metric.html
views/metric/metric.html
+74
-0
views/metric/people.cfg
views/metric/people.cfg
+1
-1
No files found.
controllers/metric.py
View file @
90c87225
...
...
@@ -23,7 +23,7 @@ def people_per_category():
# get the header and publish
header
=
'%s %s'
%
(
T
(
'People per category'
),
selector
.
header
(
db
))
response
.
view
=
BASE_VIEW
%
request
.
extension
response
.
view
=
'metric/metric.html'
return
dict
(
field
=
field
,
footer
=
''
,
header
=
header
,
rows
=
rows
)
...
...
@@ -45,7 +45,7 @@ def people_per_quality():
# get the header and publish
header
=
'%s %s'
%
(
T
(
'People per quality'
),
selector
.
header
(
db
))
response
.
view
=
BASE_VIEW
%
request
.
extension
response
.
view
=
'metric/metric.html'
return
dict
(
field
=
field
,
footer
=
''
,
header
=
header
,
rows
=
rows
)
...
...
@@ -67,6 +67,6 @@ def people_per_team():
# get the header and publish
header
=
'%s %s'
%
(
T
(
'People per team'
),
selector
.
header
(
db
))
response
.
view
=
BASE_VIEW
%
request
.
extension
response
.
view
=
'metric/metric.html'
return
dict
(
field
=
field
,
footer
=
''
,
header
=
header
,
rows
=
rows
)
models/vt_people_selector.py
View file @
90c87225
...
...
@@ -9,16 +9,13 @@ virtdb.define_table('people_selector',
Field
(
'category'
,
'string'
),
Field
(
'id_people_categories'
,
'reference people_categories'
,
label
=
T
(
"Quality"
)),
Field
(
'id_teams'
,
'reference teams'
,
label
=
T
(
'Team'
)),
Field
(
'id_projects'
,
'reference projects'
,
label
=
T
(
'Project'
)),
Field
(
'format'
,
'string'
,
default
=
'html'
))
Field
(
'id_projects'
,
'reference projects'
,
label
=
T
(
'Project'
)))
virtdb
.
people_selector
.
category
.
requires
=
IS_IN_SET
(
PEOPLE_CATEGORIES
)
virtdb
.
people_selector
.
id_people_categories
.
requires
=
IS_IN_DB
(
db
,
'people_categories.code'
)
virtdb
.
people_selector
.
id_projects
.
requires
=
IS_IN_DB
(
db
,
'projects.project'
)
virtdb
.
people_selector
.
id_teams
.
requires
=
IS_IN_DB
(
db
,
'teams.team'
)
virtdb
.
people_selector
.
format
.
requires
=
IS_IN_SET
(
FORMATS
)
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
...
...
models/widgets_viewport.py
View file @
90c87225
...
...
@@ -118,16 +118,13 @@ traineeLeaf = PanelWithUrlSelector(virtdb.trainee_selector,
extField
=
'format'
)
peopleCategoryLeaf
=
PanelWithUrlSelector
(
virtdb
.
people_selector
,
baseUrl
=
URL
(
'metric'
,
'people_per_category'
),
extField
=
'format'
)
baseUrl
=
URL
(
'metric'
,
'people_per_category'
))
peopleQualityLeaf
=
PanelWithUrlSelector
(
virtdb
.
people_selector
,
baseUrl
=
URL
(
'metric'
,
'people_per_quality'
),
extField
=
'format'
)
baseUrl
=
URL
(
'metric'
,
'people_per_quality'
))
peopleTeamLeaf
=
PanelWithUrlSelector
(
virtdb
.
people_selector
,
baseUrl
=
URL
(
'metric'
,
'people_per_team'
),
extField
=
'format'
)
baseUrl
=
URL
(
'metric'
,
'people_per_team'
))
reportNode
=
dbui
.
Node
(
T
(
'Reports'
))
reportNode
.
add_child
(
T
(
'List'
),
listLeaf
)
...
...
static/CHANGELOG
View file @
90c87225
...
...
@@ -2,6 +2,7 @@
HEAD
- Migrate to plugin_dbui 0.6.1.14 and Web2py 2.9.11.
- Restore the metric reports using Ext.grid.Panel.
1dec53b (Mar 14)
- Migrate to plugin_dbui 0.6.1.0 and Web2py 2.9.5.
...
...
views/metric/metric.html
0 → 100644
View file @
90c87225
{{=H3(header)}}
<br>
<br>
{{include '%s/%s.cfg' % (request.controller, request.function)}}
{{
import json
#
# Prepare the Ext.data.ArrayStore configuration
#
cfg = dict(fields=[], data=[])
for name in columns:
cfg['fields'].append({'name': name})
pass
for row in rows:
li = []
for name in columns:
li.append(row[name])
pass
cfg['data'].append(li)
pass
#
# unique identifier for the DIV block associated to the grid
#
divgrid = "grid-%s" % __builtins__['id'](cfg)
response.write(DIV(_id=divgrid))
#
# Export python variables to the javascript
#
jsvars = ["cfgStore = %s" % json.dumps(cfg),
"columns = %s" % json.dumps(columns),
"divgrid = '%s'" % divgrid,
"gridcolumns = []",
"headers = %s" % json.dumps(headers),
"i"]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script>
var
align
;
//
// columns configuration
//
for
(
i
=
0
;
i
<
columns
.
length
;
i
+=
1
)
{
gridcolumns
.
push
({
text
:
headers
[
columns
[
i
]],
dataIndex
:
columns
[
i
],
});
}
//
// instantiate the grid
//
Ext
.
create
(
'
Ext.grid.Panel
'
,
{
plugins
:
[
'
pGridExport
'
],
store
:
Ext
.
create
(
'
Ext.data.ArrayStore
'
,
cfgStore
),
columns
:
gridcolumns
,
forceFit
:
true
,
hideHeaders
:
false
,
padding
:
"
10 40 20 60
"
,
renderTo
:
divgrid
,
width
:
500
});
</script>
{{=footer}}
views/metric/people.cfg
View file @
90c87225
...
...
@@ -14,6 +14,6 @@
headers[str(field)] = T(field.name.title())
# virtual fields to be displayed in the view
extracolumns =
[]
extracolumns =
None
}}
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