Commit 3198538b authored by Roque's avatar Roque

[WIP] erp5_officejs: get rid of hardcoded form name in controller gadget

- form name comes from the document portal type action
- for now, path to action is hardcoded. It will come from a allDocs query (not implemented yet in appcachestorage sync)
parent c53cda55
......@@ -79,6 +79,7 @@
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
......@@ -89,14 +90,14 @@
/////////////////////////////////////////////////////////////////
.declareMethod("getFormDefinition", function (portal_type) {
var gadget = this,
// TODO: task "Remove the hardcoded form name"
form_path = 'portal_skins/erp5_officejs_jio_connector/' +
portal_type.replace(/ /g, '') +
'_viewAsJio';
return gadget.jio_get(form_path)
.push(function (result) {
return result._embedded._view.my_form_definition["default"];
var gadget = this;
//TODO: the corresponding action must be get via allDocs -not implemented in appcachestorage yet
return gadget.jio_get("portal_types/HTML Post/2")
.push(function (action_result) {
return gadget.jio_get(action_result._embedded._view.my_action["default"])
.push(function (result) {
return result._embedded._view.my_form_definition["default"];
});
});
})
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29059.59883.56200</string> </value>
<value> <string>974.31714.23130.16571</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1552953883.94</float>
<float>1553262870.8</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -240,6 +240,7 @@ jio_appcachestorage.js\n
\n
#configuration resources\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
\n
gadget_erp5_page_ojs_controller.html\n
gadget_erp5_page_ojs_controller.js\n
......@@ -733,7 +734,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.31239.34087.42410</string> </value>
<value> <string>974.31714.43269.18500</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -751,7 +752,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1553089034.71</float>
<float>1553114789.83</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -117,6 +117,7 @@ CACHE:\n
\n
#discussion tool\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_skins%2Ferp5_officejs_jio_connector%2FHTMLPost_viewAsJio&view=jio_view&appcache=1\n
hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=portal_types%2FHTML%20Post%2F2&view=view&appcache=1\n
\n
NETWORK:\n
*
......@@ -262,7 +263,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29872.40794.13499</string> </value>
<value> <string>974.31673.260.28774</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -280,7 +281,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1553006157.09</float>
<float>1553110789.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -159,6 +159,9 @@
var urlParams = new URLSearchParams(parser.search);
id = urlParams.get("relative_url");
if (id === null) { id = configuration_ids_dict["" + i]; }
//TODO: remember that the content is the pure hateoas dict returned by the script
// it should be processed in order to save a json document that allows allDocs queries
// without nested levels like _embedded, _view, etc
promise_list.push(appcache_storage.put(id, content_list[i]));
}
return RSVP.all(promise_list);
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.31278.59358.47462</string> </value>
<value> <string>974.31702.6932.56797</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1553089225.04</float>
<float>1553112587.71</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