Commit 9f6e79ee authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_web_renderjs_ui: make sure that an object's _links.view is an array

It may not be the case if there is only one view, as defined by the hateoas spec
parent c5f05bf6
/*global window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean */ /*global window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean, ensureArray */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
/** /**
Page Form is a top-level gadget (a "Page") taking care of rendering form Page Form is a top-level gadget (a "Page") taking care of rendering form
and handling data send&receive. and handling data send&receive.
*/ */
(function (window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean) { (function (window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean, ensureArray) {
"use strict"; "use strict";
/*jslint regexp: true*/ /*jslint regexp: true*/
...@@ -233,7 +233,7 @@ and handling data send&receive. ...@@ -233,7 +233,7 @@ and handling data send&receive.
.push(function (result2) { .push(function (result2) {
return gadget.redirect({command: 'display_with_history', options: { return gadget.redirect({command: 'display_with_history', options: {
jio_key: options.jio_key, jio_key: options.jio_key,
view: result2._links.view[0].href view: ensureArray(result2._links.view)[0].href
}}); }});
}); });
} }
...@@ -656,4 +656,4 @@ and handling data send&receive. ...@@ -656,4 +656,4 @@ and handling data send&receive.
}); });
}(window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean)); }(window, document, rJS, URI, RSVP, jIO, Blob, URL, asBoolean, ensureArray));
\ No newline at end of file \ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>980.19453.2043.40055</string> </value> <value> <string>983.16778.9416.38758</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>1575625017.2</float> <float>1587089012.07</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