Commit 4d4068b1 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: keep loader visible for a minimal amount of time

parent 821d5707
...@@ -111,17 +111,17 @@ ...@@ -111,17 +111,17 @@
return route(gadget, 'panel', 'render', [gadget.props.panel_argument_list]); return route(gadget, 'panel', 'render', [gadget.props.panel_argument_list]);
} }
function refreshHeaderAndPanel(gadget, refresh) { function refreshHeaderAndPanel(gadget, refresh, loading_delay_promise) {
var promise; return RSVP.all([
updatePanel(gadget),
new RSVP.Queue(loading_delay_promise)
.push(function () {
if (refresh) { if (refresh) {
promise = route(gadget, "header", 'render', return route(gadget, "header", 'render',
[gadget.props.header_argument_list]); [gadget.props.header_argument_list]);
} else {
promise = updateHeader(gadget);
} }
return RSVP.all([ return updateHeader(gadget);
promise, })
updatePanel(gadget)
]); ]);
} }
...@@ -778,7 +778,8 @@ ...@@ -778,7 +778,8 @@
.onStateChange(function onStateChange(modification_dict) { .onStateChange(function onStateChange(modification_dict) {
var gadget = this, var gadget = this,
route_result = gadget.state, route_result = gadget.state,
promise_list; promise_list,
slow_loading_promise;
if (modification_dict.hasOwnProperty('error_text')) { if (modification_dict.hasOwnProperty('error_text')) {
return gadget.dropGadget(MAIN_SCOPE) return gadget.dropGadget(MAIN_SCOPE)
...@@ -856,6 +857,7 @@ ...@@ -856,6 +857,7 @@
initHeaderOptions(gadget); initHeaderOptions(gadget);
initPanelOptions(gadget); initPanelOptions(gadget);
if (!modification_dict.hasOwnProperty('first_bootstrap')) { if (!modification_dict.hasOwnProperty('first_bootstrap')) {
slow_loading_promise = RSVP.delay(50);
promise_list.push(route(gadget, 'header', 'notifyLoading')); promise_list.push(route(gadget, 'header', 'notifyLoading'));
} }
} }
...@@ -880,11 +882,8 @@ ...@@ -880,11 +882,8 @@
} }
content_container.appendChild(main_gadget.element); content_container.appendChild(main_gadget.element);
element.appendChild(content_container); element.appendChild(content_container);
return refreshHeaderAndPanel(gadget);
// XXX Drop notification
// return header_gadget.notifyLoaded();
} }
return refreshHeaderAndPanel(gadget, false, slow_loading_promise);
})); }));
} else if (modification_dict.hasOwnProperty('render_timestamp')) { } else if (modification_dict.hasOwnProperty('render_timestamp')) {
// Same subgadget // Same subgadget
...@@ -893,7 +892,7 @@ ...@@ -893,7 +892,7 @@
return page_gadget.render(gadget.state.options); return page_gadget.render(gadget.state.options);
}) })
.push(function () { .push(function () {
return refreshHeaderAndPanel(gadget); return refreshHeaderAndPanel(gadget, false, slow_loading_promise);
})); }));
} }
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>993.37256.4522.58726</string> </value> <value> <string>999.1512.55448.47445</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1626860658.98</float> <float>1647877106.56</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