Commit 2a0d8e8f authored by Roque's avatar Roque Committed by Roque

Fixes on project management

/reviewed-on nexedi/erp5!999
parent 041b0614
......@@ -91,12 +91,28 @@ input[type="submit"] {
min-width: 8em;
}
.gadget-content span.pass {
background-color: #00a616;
.gadget-content svg.test-result.ui-hidden {
visibility: hidden;
}
.gadget-content span.fail {
background-color: #ff0400;
.gadget-content svg.test-result path.ui-hidden {
visibility: hidden;
}
.gadget-content svg.test-result.fail {
fill: red;
}
.gadget-content svg.test-result.pass {
fill: green;
}
.gadget-content svg.test-result.running {
fill: blue;
}
.gadget-content svg.test-result.cancelled {
fill: grey;
}
.gadget-content span.test-result a {
......
......@@ -40,6 +40,7 @@
<a id="test_result_link" class="ui-disabled" data-i18n="[value]Last test result" disabled >Last test result</a>
</span>
<a id="test_suite_link" class="first-line-buttons ui-disabled" data-i18n="[value]Test suite" disabled >Test suite</a>
<svg id="test_result_svg" class="test-result ui-hidden" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><path d="M0 7a7 7 0 1 1 14 0A7 7 0 0 1 0 7z"></path><path d="M13 7A6 6 0 1 0 1 7a6 6 0 0 0 12 0z" fill="#FFF"></path><path id="test_result_fail" class="ui-hidden" d="M7 5.969L5.599 4.568a.29.29 0 0 0-.413.004l-.614.614a.294.294 0 0 0-.004.413L5.968 7l-1.4 1.401a.29.29 0 0 0 .004.413l.614.614c.113.114.3.117.413.004L7 8.032l1.401 1.4a.29.29 0 0 0 .413-.004l.614-.614a.294.294 0 0 0 .004-.413L8.032 7l1.4-1.401a.29.29 0 0 0-.004-.413l-.614-.614a.294.294 0 0 0-.413-.004L7 5.968z"></path><path id="test_result_pass" class="ui-hidden" d="M6.278 7.697L5.045 6.464a.296.296 0 0 0-.42-.002l-.613.614a.298.298 0 0 0 .002.42l1.91 1.909a.5.5 0 0 0 .703.005l.265-.265L9.997 6.04a.291.291 0 0 0-.009-.408l-.614-.614a.29.29 0 0 0-.408-.009L6.278 7.697z"></path><path id="test_result_running" class="ui-hidden" d="M7 3c2.2 0 4 1.8 4 4s-1.8 4-4 4c-1.3 0-2.5-.7-3.3-1.7L7 7V3"></path></g></svg>
</p>
</div>
<div class="ui-field-contain project_links">
......
......@@ -33,28 +33,42 @@
return view_list.filter(d => d.name === name)[0].href;
}
function setLastTestResult(gadget, project_title, span_element) {
function setLastTestResult(gadget, project_title, span_element, svg_element) {
span_element.classList.remove("ui-disabled");
var query = createProjectQuery(project_title,
[["portal_type", "Benchmark Result"]]);
return gadget.jio_allDocs({
query: query,
limit: 2, //first result could be the running test
limit: 1,
sort_on: [['creation_date', 'descending']],
select_list: ['simulation_state']
})
.push(function (result_list) {
var i, state;
var state;
result_list = result_list.data.rows;
for (i = 0; i < result_list.length; i = i + 1) {
state = result_list[i].value.simulation_state;
if (state === "stopped" || state === "public_stopped") {
span_element.classList.add("pass");
if (result_list.length > 0) {
svg_element.classList.remove("ui-hidden");
state = result_list[0].value.simulation_state;
switch (state) {
case 'started':
svg_element.classList.add("running");
document.getElementById("test_result_running").classList.remove("ui-hidden");
break;
}
if (state === "failed") {
span_element.classList.add("fail");
case 'failed':
svg_element.classList.add("fail");
document.getElementById("test_result_fail").classList.remove("ui-hidden");
break;
case 'cancelled':
svg_element.classList.add("cancelled");
document.getElementById("test_result_running").classList.remove("ui-hidden");
break;
case 'stopped':
case 'public_stopped':
svg_element.classList.add("pass");
document.getElementById("test_result_pass").classList.remove("ui-hidden");
break;
default:
svg_element.classList.add("ui-hidden");
}
}
});
......@@ -91,7 +105,8 @@
edit_view,
redirector_ulr,
query,
query_list = [];
query_list = [],
valid_state_list = ["shared_alive", "released_alive", "published_alive"];
query_list.push(new SimpleQuery({
key: "portal_type",
operator: "=",
......@@ -104,12 +119,6 @@
type: "simple",
value: project_reference + '-Home.Page'
}));
query_list.push(new SimpleQuery({
key: "validation_state",
operator: "=",
type: "simple",
value: "published_alive"
}));
query = new ComplexQuery({
operator: "AND",
query_list: query_list,
......@@ -121,21 +130,31 @@
return gadget.jio_allDocs({
query: Query.objectToSearchText(query),
limit: 1,
select_list: ['text_content']
select_list: ['validation_state', 'text_content']
});
})
.push(function (result_list) {
if (result_list.data.rows[0]) {
id = result_list.data.rows[0].id;
content = parseHTMLLinks(result_list.data.rows[0].value.text_content, redirector_ulr);
return gadget.jio_getAttachment(id, "links")
.push(function (web_page_document) {
edit_view = getActionListByName(
ensureArray(web_page_document._links.view),
"view_editor"
);
return {"id": id, "content": content, "edit_view": edit_view};
});
var i, state, web_page;
for (i = 0; i < result_list.data.rows.length; i = i + 1) {
state = result_list.data.rows[i].value.validation_state;
if (valid_state_list.includes(state)) {
web_page = result_list.data.rows[i];
break;
}
}
if (web_page) {
id = web_page.id;
content = parseHTMLLinks(web_page.value.text_content, redirector_ulr);
return gadget.jio_getAttachment(id, "links")
.push(function (web_page_document) {
edit_view = getActionListByName(
ensureArray(web_page_document._links.view),
"view_editor"
);
return {"id": id, "content": content, "edit_view": edit_view};
});
}
}
return {"id": id, "content": content, "edit_view": edit_view};
});
......@@ -206,8 +225,7 @@
[["selection_domain_state_task_domain", "confirmed"]])),
getUrlParameterDict('support_request_module', "view", [["delivery.start_date", "descending"]],
null, createProjectQuery(modification_dict.project_title,
[["destination_project_title", modification_dict.project_title],
["selection_domain_state_support_domain", "validated"]])),
[["selection_domain_state_support_domain", "validated"]])),
getUrlParameterDict('bug_module', "view", [["delivery.start_date", "descending"]],
["title", "description", "delivery.start_date"],
createProjectQuery(modification_dict.project_title,
......@@ -256,7 +274,8 @@
}
enableLink(document.getElementById("document_link"), url_list[11]);
setLastTestResult(gadget, modification_dict.project_title,
document.getElementById("test_result_span"));
document.getElementById("test_result_span"),
document.getElementById("test_result_svg"));
});
})
......
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