Commit 3d350c00 authored by Roque's avatar Roque

erp5_officejs: action page handles new configuration fields

parent e59a7e4d
......@@ -38,6 +38,16 @@
);
}
function filterViews(views_dict, app_view, default_view) {
//TODO: there must be only one "View" action (title = "View")
// this is for scenarios were the portal type has several "View" (like view, jio_view, custom_view)
// priority: app_view ; default_view ; other (reference=view)
// if views_dict contains app_view -> remove all "View" entries
// else if contains default_view -> remove all "View" entries
// else get first "View" and remove all other "View" entries
return views_dict;
}
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
......@@ -90,19 +100,26 @@
action_info_dict = {views: {}, actions: {}},
//TODO use Query to avoid strings
query = 'portal_type: "Action Information" AND parent_relative_url: "portal_types/' + portal_type + '"',
app_actions;
app_actions,
app_view,
default_view;
return RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.declareGadget("gadget_officejs_common_utils.html"),
gadget.getSetting('app_view_reference'),
gadget.getSetting('default_view_reference')
]);
})
.push(function (result_list) {
app_view = result_list[1];
default_view = result_list[2];
return result_list[0].getAppActions(portal_type);
})
.push(function (app_actions_result) {
app_actions = app_actions_result;
app_actions = app_actions_result.map(function (pair) {
return pair[1];
});
return gadget.jio_allDocs({query: query})
.push(function (action_list) {
var path_for_jio_get_list = [], row;
......@@ -114,12 +131,11 @@
return RSVP.all(path_for_jio_get_list);
})
.push(function (action_document_list) {
var action_settings_list = [], page, action_key, action_doc, key, action_settings;
var page, action_key, action_doc, key, action_settings;
for (action_key in action_document_list) {
//TODO filter actions: discard actions that are not in getSettings("app_actions")
//there must be one "View" action. If not, use default view (like jio_view in getsettings)
if (action_document_list.hasOwnProperty(action_key)) {
action_doc = action_document_list[action_key];
if (app_actions.includes(action_doc.reference)) {
action_settings = {
page: undefined,
jio_key: options.jio_key,
......@@ -138,6 +154,8 @@
}
}
}
}
action_info_dict.views = filterViews(action_info_dict.views, app_view, default_view);
return action_info_dict;
});
});
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.31000.44303.9591</string> </value>
<value> <string>976.31395.21170.7816</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1560848207.92</float>
<float>1560871889.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