Commit 00e18d22 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Use embedded the form definition if returned by the server

Removing one query improves the speed of the UI.
parent b05a67b3
......@@ -158,6 +158,9 @@ and handling data send&receive.
return promise_queue
.push(function () {
if (new_state.erp5_document._embedded._view.hasOwnProperty('_embedded')) {
return new_state.erp5_document._embedded._view._embedded.form_definition;
}
var uri = new URI(new_state.erp5_document._embedded._view._links.form_definition.href);
return gadget.jio_getAttachment(uri.segment(2), "view");
})
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.24634.17714.15001</string> </value>
<value> <string>967.46234.55453.11827</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1526655457.44</float>
<float>1527598665.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,10 +5,13 @@
function createSectionGadget(gadget, queue, report_section,
section_list_element) {
var uri = new URI(report_section._links.form_definition.href),
form_definition;
var form_definition;
queue
.push(function () {
if (report_section.hasOwnProperty('_embedded')) {
return report_section._embedded.form_definition;
}
var uri = new URI(report_section._links.form_definition.href);
return gadget.jio_getAttachment(uri.segment(2), "view");
})
.push(function (result) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.56167.53905.31470</string> </value>
<value> <string>964.58561.19908.14080</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1508400391.84</float>
<float>1527668285.72</float>
<string>UTC</string>
</tuple>
</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