Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
147
Merge Requests
147
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
f558136b
Commit
f558136b
authored
Mar 05, 2020
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_project_ui: fix front page test result query
parent
e084fba2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
13 deletions
+111
-13
bt5/erp5_web_project_ui/PathTemplateItem/web_page_module/project_gadget_page_project_front_page_js.js
..._page_module/project_gadget_page_project_front_page_js.js
+29
-11
bt5/erp5_web_project_ui/PathTemplateItem/web_page_module/project_gadget_page_project_front_page_js.xml
...page_module/project_gadget_page_project_front_page_js.xml
+2
-2
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/ERP5Site_getProjectTestStatusData.py
...ins/erp5_web_project/ERP5Site_getProjectTestStatusData.py
+18
-0
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/ERP5Site_getProjectTestStatusData.xml
...ns/erp5_web_project/ERP5Site_getProjectTestStatusData.xml
+62
-0
No files found.
bt5/erp5_web_project_ui/PathTemplateItem/web_page_module/project_gadget_page_project_front_page_js.js
View file @
f558136b
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, document, SimpleQuery, ComplexQuery, Query, parseInt*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
SimpleQuery
,
ComplexQuery
,
Query
,
parseInt
)
{
/*global window, rJS, RSVP, document, SimpleQuery, ComplexQuery, Query, parseInt
, jIO
*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
SimpleQuery
,
ComplexQuery
,
Query
,
parseInt
,
jIO
)
{
"
use strict
"
;
var
STATUS_OK
=
"
green
"
,
...
...
@@ -421,14 +421,32 @@
return
renderProjectDocumentLines
(
this
,
LIMIT_DATE
);
})
.
declareJob
(
"
renderTestResultInfo
"
,
function
(
project_list
)
{
var
gadget
=
this
,
i
,
test_result
,
query_list
=
[],
test_result_query
,
test_state_list
=
[
"
failed
"
,
"
stopped
"
,
"
public_stopped
"
];
.
declareJob
(
"
renderTestResultInfo
"
,
function
()
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
//TODO fix "erp5" part of the url
url
:
document
.
location
.
origin
+
"
/erp5/ERP5Site_getProjectTestStatusData
"
});
})
.
push
(
function
(
result
)
{
var
project_id
,
project_test_status_dict
;
project_test_status_dict
=
JSON
.
parse
(
result
.
target
.
response
);
for
(
project_id
in
project_test_status_dict
)
{
if
(
project_test_status_dict
.
hasOwnProperty
(
project_id
))
{
renderProjectLine
(
project_id
,
"
Test Result
"
,
parseInt
(
project_test_status_dict
[
project_id
].
all_tests
,
RADIX
),
parseInt
(
project_test_status_dict
[
project_id
].
failures
,
RADIX
));
}
}
});
//alternative using jio queries ends up in a query per project, inefficient
//one shot query isn't possible because getting the most recent element AFTER group
//involves not supported clauses like MAX, HAVING or nested queries
/*var test_state_list = ["failed", "stopped", "public_stopped"];
.push(function () {
var promise_list = [];
for (i = 0; i < project_list.length; i += 1) {
...
...
@@ -460,7 +478,7 @@
parseInt(test_result.value.failures, RADIX));
}
}
});
});
*/
})
.
declareJob
(
"
renderProjectForumLink
"
,
function
()
{
...
...
@@ -508,4 +526,4 @@
return
true
;
});
}(
window
,
rJS
,
RSVP
,
document
,
SimpleQuery
,
ComplexQuery
,
Query
,
parseInt
));
\ No newline at end of file
}(
window
,
rJS
,
RSVP
,
document
,
SimpleQuery
,
ComplexQuery
,
Query
,
parseInt
,
jIO
));
\ No newline at end of file
bt5/erp5_web_project_ui/PathTemplateItem/web_page_module/project_gadget_page_project_front_page_js.xml
View file @
f558136b
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
982.
19902.51210.17083
</string>
</value>
<value>
<string>
982.
21116.37524.56610
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
1583
343312.59
</float>
<float>
1583
416131.77
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/ERP5Site_getProjectTestStatusData.py
0 → 100644
View file @
f558136b
import
json
from
DateTime
import
DateTime
result_dict
=
{}
catalog_kw
=
{
'portal_type'
:
'Test Result'
,
'simulation_state'
:
(
'stopped'
,
'failed'
),
'source_project__validation_state'
:
'validated'
,
'delivery.start_date'
:
">= "
+
(
DateTime
()
-
365
).
strftime
(
"%Y/%m/%d"
),
}
sort_on
=
[(
'modification_date'
,
'descending'
)]
select_list
=
[
'source_project__relative_url'
]
for
test_result
in
context
.
portal_catalog
(
sort_on
=
sort_on
,
select_list
=
select_list
,
**
catalog_kw
):
# get the first test result (most recent) for each project
if
not
test_result
.
source_project__relative_url
in
result_dict
:
result_dict
[
test_result
.
source_project__relative_url
]
=
{
'all_tests'
:
test_result
.
all_tests
,
'failures'
:
test_result
.
failures
}
return
json
.
dumps
(
result_dict
,
indent
=
2
)
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/ERP5Site_getProjectTestStatusData.xml
0 → 100644
View file @
f558136b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getProjectTestStatusData
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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