Commit 96851e6a authored by Roque's avatar Roque

erp5_officejs: fix on page loading speed up

- revert parallel gadget loading
- minor refactoring on appcache storage creation
parent 40b23070
...@@ -3,46 +3,6 @@ ...@@ -3,46 +3,6 @@
(function (document, window, rJS, RSVP, jIO, console) { (function (document, window, rJS, RSVP, jIO, console) {
"use strict"; "use strict";
var warmup_gadget_done = false,
warmup_list = [
//officejs gadgets
'gadget_officejs_form_view.html',
'gadget_officejs_common_util.html',
'gadget_erp5_label_field.html',
'gadget_html5_element.html',
'gadget_erp5_field_datetime.html',
'gadget_erp5_field_string.html',
'gadget_erp5_form.html',
'gadget_erp5_field_float.html',
'gadget_erp5_field_listbox.html',
// Used in panel
'gadget_translation.html',
'gadget_erp5_panel.html',
'gadget_erp5_header.html',
'gadget_erp5_searchfield.html',
'gadget_erp5_field_multicheckbox.html',
'gadget_html5_input.html',
//following elements should be split in at list 2 groups (doclist and doc)
'gadget_erp5_pt_form_list',
'gadget_erp5_pt_form_view.html',
//
'gadget_erp5_pt_form_view_editable.html',
'gadget_erp5_field_textarea.html',
'gadget_erp5_field_gadget.html',
'gadget_html5_textarea.html',
'gadget_editor.html'
];
function warmupGadgetList(gadget, url_list) {
var i;
for (i = 0; i < url_list.length; i += 1) {
// No need to check the result, as it will fail later
// when rJS will try to instanciate one of this gadget
rJS.declareGadgetKlass(rJS.getAbsoluteURL(url_list[i],
gadget.__path));
}
}
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -90,10 +50,6 @@ ...@@ -90,10 +50,6 @@
} }
}) })
.push(function () { .push(function () {
if (!warmup_gadget_done) {
warmupGadgetList(gadget, warmup_list);
warmup_gadget_done = true;
}
return gadget.getDeclaredGadget("common_util"); return gadget.getDeclaredGadget("common_util");
}) })
.push(function (result) { .push(function (result) {
......
...@@ -90,10 +90,9 @@ ...@@ -90,10 +90,9 @@
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod('getUrlFor', 'getUrlFor') .declareAcquiredMethod('getUrlFor', 'getUrlFor')
.declareMethod('updateConfiguration', function (jio_appchache_options, origin_url, .declareMethod('updateConfiguration', function (appcache_storage, origin_url,
migration_version, current_version, migration_version, current_version,
storage_name) { storage_name) {
var appcache_storage = jIO.createJIO(jio_appchache_options);
if (!appcache_storage) { return; } if (!appcache_storage) { return; }
var gadget = this, var gadget = this,
document_id_list = [origin_url, document_id_list = [origin_url,
...@@ -200,14 +199,14 @@ ...@@ -200,14 +199,14 @@
if (result_list[0] === undefined) { return; } if (result_list[0] === undefined) { return; }
if (selected_storage_name === undefined) { return; } if (selected_storage_name === undefined) { return; }
gadget.state_parameter_dict.jio_storage_name = selected_storage_name; gadget.state_parameter_dict.jio_storage_name = selected_storage_name;
appcache_storage = jIO.createJIO(jio_appchache_options);
current_version = window.location.href.replace(window.location.hash, ""); current_version = window.location.href.replace(window.location.hash, "");
index = current_version.indexOf(window.location.host) + window.location.host.length; index = current_version.indexOf(window.location.host) + window.location.host.length;
current_version = current_version.substr(index); current_version = current_version.substr(index);
if (migration_version !== current_version || if (migration_version !== current_version ||
previous_storage_name !== selected_storage_name) { previous_storage_name !== selected_storage_name) {
return gadget.updateConfiguration(jio_appchache_options, origin_url, return gadget.updateConfiguration(appcache_storage, origin_url, migration_version,
migration_version, current_version, current_version, selected_storage_name);
selected_storage_name);
} }
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
......
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