Commit 8fcfe975 authored by Roque's avatar Roque

erp5_web_project_ui: don't show number of elements (0) until info is fetch

parent 6eb5b706
...@@ -102,7 +102,8 @@ div[data-gadget-url$="gadget_erp5_page_project_front_page.html"] .ui-icon-spinne ...@@ -102,7 +102,8 @@ div[data-gadget-url$="gadget_erp5_page_project_front_page.html"] .ui-icon-spinne
animation: spin 0.5s infinite linear; animation: spin 0.5s infinite linear;
} }
div[data-gadget-url$="gadget_erp5_page_project_front_page.html"] .ui-icon-spinner.ui-hidden { div[data-gadget-url$="gadget_erp5_page_project_page.html"] .ui-hidden,
div[data-gadget-url$="gadget_erp5_page_project_front_page.html"] .ui-hidden {
visibility: hidden; visibility: hidden;
} }
...@@ -152,14 +153,6 @@ input[type="submit"] { ...@@ -152,14 +153,6 @@ input[type="submit"] {
min-width: 8em; min-width: 8em;
} }
.gadget-content svg.test-result.ui-hidden {
visibility: hidden;
}
.gadget-content svg.test-result path.ui-hidden {
visibility: hidden;
}
.gadget-content svg.test-result { .gadget-content svg.test-result {
margin-right: 7px; margin-right: 7px;
} }
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.9353.43613.6587</string> </value> <value> <string>982.9523.61078.50312</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1582883147.24</float> <float>1582894069.61</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
const STATUS_SPAN = "status"; const STATUS_SPAN = "status";
const TOTAL_SPAN = "total"; const TOTAL_SPAN = "total";
const OUTDATED_SPAN = "outdated"; const OUTDATED_SPAN = "outdated";
const NUMBER_SPAN = "number";
const QUERY_LIMIT = 100000; const QUERY_LIMIT = 100000;
const SUPERVISOR_FIELD_TITLE = "Supervisor"; const SUPERVISOR_FIELD_TITLE = "Supervisor";
//XXX hardcoded one year old date to define outdated elements //XXX hardcoded one year old date to define outdated elements
...@@ -104,7 +105,8 @@ ...@@ -104,7 +105,8 @@
function renderProjectLine(project_id, portal_type, total_count, outdated_count) { function renderProjectLine(project_id, portal_type, total_count, outdated_count) {
var total_span = document.getElementById(getProjectSpanId(project_id, portal_type, TOTAL_SPAN)), var total_span = document.getElementById(getProjectSpanId(project_id, portal_type, TOTAL_SPAN)),
outdated_span = document.getElementById(getProjectSpanId(project_id, portal_type, OUTDATED_SPAN)), outdated_span = document.getElementById(getProjectSpanId(project_id, portal_type, OUTDATED_SPAN)),
status_span = document.getElementById(getProjectSpanId(project_id, portal_type, STATUS_SPAN)); status_span = document.getElementById(getProjectSpanId(project_id, portal_type, STATUS_SPAN)),
number_span = document.getElementById(getProjectSpanId(project_id, portal_type, NUMBER_SPAN));
total_span.textContent = parseInt(total_span.textContent, RADIX) + total_count; total_span.textContent = parseInt(total_span.textContent, RADIX) + total_count;
outdated_span.textContent = parseInt(outdated_span.textContent, RADIX) + outdated_count; outdated_span.textContent = parseInt(outdated_span.textContent, RADIX) + outdated_count;
if (outdated_count > 0) { if (outdated_count > 0) {
...@@ -113,6 +115,7 @@ ...@@ -113,6 +115,7 @@
} else if (!status_span.classList.value.includes(STATUS_NOT_OK)) { } else if (!status_span.classList.value.includes(STATUS_NOT_OK)) {
status_span.classList.add(STATUS_OK); status_span.classList.add(STATUS_OK);
} }
number_span.classList.remove("ui-hidden");
} }
function renderProjectList(gadget, project_list) { function renderProjectList(gadget, project_list) {
...@@ -130,7 +133,7 @@ ...@@ -130,7 +133,7 @@
outdated; outdated;
function createProjectHtmlElement(project_id, project_title, project_url, supervisor) { function createProjectHtmlElement(project_id, project_title, project_url, supervisor) {
var project_element = document.createElement('li'), var project_li = document.createElement('li'),
box_div = document.createElement('div'), box_div = document.createElement('div'),
title_div = document.createElement('div'), title_div = document.createElement('div'),
info_div = document.createElement('div'), info_div = document.createElement('div'),
...@@ -167,39 +170,43 @@ ...@@ -167,39 +170,43 @@
info_div.appendChild(right_div); info_div.appendChild(right_div);
box_div.appendChild(title_div); box_div.appendChild(title_div);
box_div.appendChild(info_div); box_div.appendChild(info_div);
project_element.appendChild(box_div); project_li.appendChild(box_div);
return [project_element, left_info_div]; return [project_li, left_info_div];
} }
function createProjectLineHtmlElement(project_id, portal_type, title, total_count, out_count, status_color) { function createProjectLineHtmlElement(project_id, portal_type, title, total_count, out_count, status_color) {
var line_div = document.createElement('div'), var line_div = document.createElement('div'),
status = document.createElement('span'), status_span = document.createElement('span'),
name = document.createElement('span'), name_span = document.createElement('span'),
outdated = document.createElement('span'), number_span = document.createElement('span'),
total = document.createElement('span'), outdated_span = document.createElement('span'),
open_bracket = document.createElement('span'), total_span = document.createElement('span'),
close_bracket = document.createElement('span'); open_bracket_span = document.createElement('span'),
close_bracket_span = document.createElement('span');
line_div.classList.add("project-line"); line_div.classList.add("project-line");
status.classList.add(STATUS_SPAN); status_span.classList.add(STATUS_SPAN);
status.classList.add(status_color); status_span.classList.add(status_color);
status.classList.add("margined"); status_span.classList.add("margined");
status.setAttribute("id", getProjectSpanId(project_id, portal_type, STATUS_SPAN)); status_span.setAttribute("id", getProjectSpanId(project_id, portal_type, STATUS_SPAN));
name.classList.add("name"); name_span.classList.add("name");
name.classList.add("margined"); name_span.classList.add("margined");
name.innerHTML = title; name_span.innerHTML = title;
total.classList.add("margined"); total_span.classList.add("margined");
total.innerHTML = total_count; total_span.innerHTML = total_count;
total.setAttribute("id", getProjectSpanId(project_id, portal_type, TOTAL_SPAN)); total_span.setAttribute("id", getProjectSpanId(project_id, portal_type, TOTAL_SPAN));
outdated.innerHTML = out_count; outdated_span.innerHTML = out_count;
outdated.setAttribute("id", getProjectSpanId(project_id, portal_type, OUTDATED_SPAN)); outdated_span.setAttribute("id", getProjectSpanId(project_id, portal_type, OUTDATED_SPAN));
line_div.appendChild(status); open_bracket_span.innerHTML = "(";
line_div.appendChild(name); close_bracket_span.innerHTML = ")";
line_div.appendChild(total); number_span.appendChild(total_span);
open_bracket.innerHTML = "("; number_span.appendChild(open_bracket_span);
close_bracket.innerHTML = ")"; number_span.appendChild(outdated_span);
line_div.appendChild(open_bracket); number_span.appendChild(close_bracket_span);
line_div.appendChild(outdated); number_span.setAttribute("id", getProjectSpanId(project_id, portal_type, NUMBER_SPAN));
line_div.appendChild(close_bracket); number_span.classList.add("ui-hidden");
line_div.appendChild(status_span);
line_div.appendChild(name_span);
line_div.appendChild(number_span);
return line_div; return line_div;
} }
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.7901.64054.59665</string> </value> <value> <string>982.9532.59635.1928</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1582796562.97</float> <float>1582894107.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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