Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
4c25f638
Commit
4c25f638
authored
Oct 14, 2019
by
Roque
Committed by
Roque
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: refactoring to speed up page loading
/reviewed-on
nexedi/erp5!965
parent
cf632afb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
99 additions
and
58 deletions
+99
-58
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.js
...ateItem/web_page_module/gadget_officejs_common_util_js.js
+7
-16
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.xml
...teItem/web_page_module/gadget_officejs_common_util_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_html.html
...adget_officejs_controller_page_local_controller_html.html
+5
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_html.xml
...gadget_officejs_controller_page_local_controller_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
...le/gadget_officejs_controller_page_local_controller_js.js
+57
-12
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.xml
...e/gadget_officejs_controller_page_local_controller_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
...plateItem/web_page_module/gadget_officejs_form_view_js.js
+10
-6
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
...lateItem/web_page_module/gadget_officejs_form_view_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.js
...plateItem/web_page_module/gadget_officejs_local_jio_js.js
+10
-14
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.xml
...lateItem/web_page_module/gadget_officejs_local_jio_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.js
View file @
4c25f638
...
...
@@ -120,6 +120,7 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSettingList
"
,
"
getSettingList
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
...
...
@@ -134,14 +135,9 @@
app_actions
,
app_view
,
default_view
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
app_view_reference
'
),
gadget
.
getSetting
(
'
default_view_reference
'
),
gadget
.
getSetting
(
'
app_actions
'
)
]);
})
return
gadget
.
getSettingList
([
'
app_view_reference
'
,
'
default_view_reference
'
,
'
app_actions
'
])
.
push
(
function
(
result_list
)
{
app_view
=
result_list
[
0
];
default_view
=
result_list
[
1
];
...
...
@@ -240,14 +236,9 @@
app_allowed_sub_types
,
form_info
,
error
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
portal_type_dict_setting
),
gadget
.
getSetting
(
"
portal_skin_folder
"
),
gadget
.
getSetting
(
"
app_allowed_sub_types
"
)
]);
})
return
gadget
.
getSettingList
([
portal_type_dict_setting
,
'
portal_skin_folder
'
,
'
app_allowed_sub_types
'
])
.
push
(
function
(
result_list
)
{
app_allowed_sub_types
=
result_list
[
2
];
if
(
!
result_list
[
1
])
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_common_util_js.xml
View file @
4c25f638
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
8.26807.33358.5717
</string>
</value>
<value>
<string>
97
9.7531.30512.46370
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15
68651276.38
</float>
<float>
15
71065275.72
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_html.html
View file @
4c25f638
...
...
@@ -12,6 +12,11 @@
<!-- custom script -->
<script
src=
"gadget_erp5_page_ojs_local_controller.js"
type=
"text/javascript"
></script>
<div
data-gadget-url=
"gadget_officejs_common_util.html"
data-gadget-scope=
"common_util"
data-gadget-sandbox=
"public"
>
</div>
</head>
<body>
</body>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_html.xml
View file @
4c25f638
...
...
@@ -232,7 +232,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
7.15823.10779.36625
</string>
</value>
<value>
<string>
97
9.7467.57626.53282
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>
15
63811084.56
</float>
<float>
15
71061400.65
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.js
View file @
4c25f638
...
...
@@ -3,6 +3,46 @@
(
function
(
document
,
window
,
rJS
,
RSVP
,
jIO
,
console
)
{
"
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
)
/////////////////////////////////////////////////////////////////
...
...
@@ -11,7 +51,7 @@
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
List
"
,
"
getSettingList
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
...
...
@@ -25,15 +65,20 @@
gadget_util
,
jio_document
,
portal_type
,
parent_portal_type
,
current_version
,
index
;
current_version
=
window
.
location
.
href
.
replace
(
window
.
location
.
hash
,
""
);
index
=
current_version
.
indexOf
(
window
.
location
.
host
)
+
window
.
location
.
host
.
length
;
current_version
=
current_version
.
substr
(
index
);
return
gadget
.
getSetting
(
"
migration_version
"
)
.
push
(
function
(
migration_version
)
{
if
(
migration_version
!==
current_version
)
{
return
gadget
.
getSettingList
([
"
migration_version
"
,
"
app_view_reference
"
,
"
parent_portal_type
"
])
.
push
(
function
(
setting_list
)
{
app_view
=
options
.
action
||
setting_list
[
1
];
parent_portal_type
=
setting_list
[
2
];
if
(
setting_list
[
0
]
!==
current_version
)
{
//if app version has changed, force storage selection
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
...
...
@@ -45,14 +90,14 @@
}
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
declareGadget
(
"
gadget_officejs_common_util.html
"
),
gadget
.
getSetting
(
'
app_view_reference
'
)
]);
if
(
!
warmup_gadget_done
)
{
warmupGadgetList
(
gadget
,
warmup_list
);
warmup_gadget_done
=
true
;
}
return
gadget
.
getDeclaredGadget
(
"
common_util
"
);
})
.
push
(
function
(
result_list
)
{
gadget_util
=
result_list
[
0
];
app_view
=
options
.
action
||
result_list
[
1
];
.
push
(
function
(
result
)
{
gadget_util
=
result
;
return
gadget
.
jio_get
(
options
.
jio_key
);
})
.
push
(
function
(
result
)
{
...
...
@@ -63,7 +108,7 @@
},
function
(
error
)
{
// instaceof error is Object, so use status_code and undefined jio_key
if
(
error
.
status_code
===
400
&&
!
options
.
jio_key
)
{
return
gadget
.
getSetting
(
'
parent_portal_type
'
)
;
return
parent_portal_type
;
}
throw
error
;
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_local_controller_js.xml
View file @
4c25f638
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
8.57300.17773.6331
</string>
</value>
<value>
<string>
97
9.7618.39284.59767
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>
157
0117898.93
</float>
<float>
157
1070879.6
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
4c25f638
...
...
@@ -175,6 +175,13 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getContent
"
,
function
(
argument_list
)
{
return
this
.
getDeclaredGadget
(
'
erp5_pt_gadget
'
)
.
push
(
function
(
child_gadget
)
{
return
child_gadget
.
getContent
();
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
(
argument_list
)
{
var
gadget
=
this
,
child_gadget
,
content_dict
;
return
gadget
.
getDeclaredGadget
(
'
erp5_pt_gadget
'
)
...
...
@@ -306,13 +313,10 @@
}}
];
erp5_document
=
form_json
.
erp5_document
;
return
RSVP
.
all
([
gadget
.
getUrlForList
(
url_for_parameter_list
)
]);
return
gadget
.
getUrlForList
(
url_for_parameter_list
);
})
.
push
(
function
(
result_list
)
{
var
url_list
=
result_list
[
0
],
header_dict
=
{
"
page_title
"
:
page_title
};
.
push
(
function
(
url_list
)
{
var
header_dict
=
{
"
page_title
"
:
page_title
};
if
(
options
.
form_type
===
'
dialog
'
)
{
//TODO: find correct url
header_dict
.
cancel_url
=
url_list
[
6
];
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.xml
View file @
4c25f638
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
8.63202.6561.35293
</string>
</value>
<value>
<string>
97
9.7520.54247.47189
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
157
0539644.03
</float>
<float>
157
1065315.5
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.js
View file @
4c25f638
...
...
@@ -86,13 +86,14 @@
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
List
"
,
"
getSettingList
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareAcquiredMethod
(
'
getUrlFor
'
,
'
getUrlFor
'
)
.
declareMethod
(
'
updateConfiguration
'
,
function
(
appcache_storage
,
origin_url
,
.
declareMethod
(
'
updateConfiguration
'
,
function
(
jio_appchache_options
,
origin_url
,
migration_version
,
current_version
,
storage_name
)
{
var
appcache_storage
=
jIO
.
createJIO
(
jio_appchache_options
);
if
(
!
appcache_storage
)
{
return
;
}
var
gadget
=
this
,
document_id_list
=
[
origin_url
,
...
...
@@ -142,15 +143,10 @@
previous_storage_name
,
index
,
origin_url
=
window
.
location
.
href
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
configuration_manifest
'
),
gadget
.
getSetting
(
'
jio_storage_name
'
),
gadget
.
getSetting
(
'
previous_storage_name
'
),
gadget
.
getSetting
(
'
migration_version
'
)
]);
})
return
gadget
.
getSettingList
([
'
configuration_manifest
'
,
'
jio_storage_name
'
,
'
previous_storage_name
'
,
'
migration_version
'
])
.
push
(
function
(
result_list
)
{
selected_storage_name
=
result_list
[
1
];
previous_storage_name
=
result_list
[
2
];
...
...
@@ -204,14 +200,14 @@
if
(
result_list
[
0
]
===
undefined
)
{
return
;
}
if
(
selected_storage_name
===
undefined
)
{
return
;
}
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
,
""
);
index
=
current_version
.
indexOf
(
window
.
location
.
host
)
+
window
.
location
.
host
.
length
;
current_version
=
current_version
.
substr
(
index
);
if
(
migration_version
!==
current_version
||
previous_storage_name
!==
selected_storage_name
)
{
return
gadget
.
updateConfiguration
(
appcache_storage
,
origin_url
,
migration_version
,
current_version
,
selected_storage_name
);
return
gadget
.
updateConfiguration
(
jio_appchache_options
,
origin_url
,
migration_version
,
current_version
,
selected_storage_name
);
}
})
.
push
(
undefined
,
function
(
error
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.xml
View file @
4c25f638
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
979.
3132.57631.22818
</string>
</value>
<value>
<string>
979.
7652.21916.23961
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
157
0799816.86
</float>
<float>
157
1071046.04
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment