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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
66bc7bea
Commit
66bc7bea
authored
Aug 30, 2016
by
Boris Kocherov
Committed by
Boris Kocherov
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: speedup caching serviceworker
parent
b5ca46fa
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
418 additions
and
59 deletions
+418
-59
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.js
...TemplateItem/web_page_module/gadget_officejs_router_js.js
+8
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.xml
...emplateItem/web_page_module/gadget_officejs_router_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.js
...eItem/web_page_module/gadget_officejs_serviceworker_js.js
+41
-52
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.xml
...Item/web_page_module/gadget_officejs_serviceworker_js.xml
+3
-3
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_getContentType.py
...ortal_skins/erp5_officejs_theme/WebPage_getContentType.py
+14
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_getContentType.xml
...rtal_skins/erp5_officejs_theme/WebPage_getContentType.xml
+62
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml
...em/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml
+1
-0
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/my_content_type.xml
...erp5_officejs_theme/WebPage_viewAsJio/my_content_type.xml
+287
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.js
View file @
66bc7bea
...
...
@@ -154,8 +154,14 @@
local_sub_storage
:
{
type
:
"
attachasproperty
"
,
map
:
{
text_content
:
"
text_content
"
,
data
:
"
data
"
text_content
:
{
body_name
:
"
text_content
"
,
content_type_name
:
"
content_type
"
},
data
:
{
body_name
:
"
data
"
,
content_type_name
:
"
content_type
"
}
},
sub_storage
:
get_jio_cache_storage
(
name
)
},
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_router_js.xml
View file @
66bc7bea
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
953.3
0941.12978.1897
8
</string>
</value>
<value>
<string>
953.3
6709.37743.2071
8
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1472
135853.24
</float>
<float>
1472
479075.38
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.js
View file @
66bc7bea
...
...
@@ -51,12 +51,24 @@ var global = self,
// 2. readonly cache for end user
self
.
jio_erp5_cache_storage
=
{
type
:
"
query
"
,
type
:
"
memoryindex
"
,
select_list
:
[
'
reference
'
,
'
url_string
'
],
index
:
{
url_string
:
null
,
reference
:
function
(
obj
)
{
if
(
!
obj
.
url_string
)
{
return
obj
.
reference
;
}
}
},
sub_storage
:
{
type
:
"
uuid
"
,
type
:
"
query
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
self
.
jio_cache
.
name
+
'
_erp5
'
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
self
.
jio_cache
.
name
+
'
_erp5
'
}
}
}
};
...
...
@@ -196,12 +208,13 @@ var global = self,
storage
=
self
.
jio_cache_storage
;
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
storage
.
get
(
jio_key
)
.
push
(
function
(
metadata
)
{
return
storage
.
getAttachment
(
jio_key
,
'
body
'
)
.
push
(
function
(
body
)
{
resolve
(
new
Response
(
body
,
{
'
headers
'
:
metadata
.
headers
}));
});
storage
.
getAttachment
(
jio_key
,
'
body
'
)
.
push
(
function
(
body
)
{
resolve
(
new
Response
(
body
,
{
'
headers
'
:
{
'
content-type
'
:
body
.
type
}
}));
})
.
push
(
undefined
,
function
(
error
)
{
reject
(
error
);
...
...
@@ -227,15 +240,15 @@ var global = self,
if
(
!
storage
)
{
storage
=
self
.
jio_dev_storage
;
}
query
.
limit
=
[
0
,
1
];
query
.
select_list
=
[
'
portal_type
'
];
return
storage
.
allDocs
(
query
)
.
push
(
function
(
result
)
{
if
(
result
.
data
.
total_rows
>=
1
)
{
var
id
=
result
.
data
.
rows
[
0
].
id
;
return
storage
.
get
(
id
)
.
push
(
function
(
doc
)
{
doc
.
id
=
id
;
return
doc
;
});
if
(
result
.
data
.
total_rows
==
1
)
{
return
{
id
:
result
.
data
.
rows
[
0
].
id
,
portal_type
:
result
.
data
.
rows
[
0
].
value
.
portal_type
};
}
else
{
throw
{
status_code
:
404
};
}
...
...
@@ -244,6 +257,7 @@ var global = self,
get_from_storage
=
function
(
url
,
storage
)
{
var
url_string
=
get_specific_url
(
url
),
url_object
=
new
URI
(
url
),
key
,
reference
=
url_object
.
filename
();
if
(
!
storage
)
{
storage
=
self
.
jio_dev_storage
;
...
...
@@ -251,50 +265,25 @@ var global = self,
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
find_queue
;
if
(
url_string
!==
undefined
)
{
find_queue
=
find_and_get
({
query
:
query_portal_types
+
'
AND (url_string: ="
'
+
url_string
+
'
")
'
},
storage
);
if
(
!
self
.
jio_cache
.
development_mode
)
{
find_queue
=
find_queue
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
return
find_and_get
({
query
:
query_portal_types
+
'
AND (reference: ="
'
+
reference
+
'
")
'
,
sort_on
:
[[
"
url_string
"
,
"
ascending
"
]]
},
storage
);
}
else
{
throw
error
;
}
});
}
//} else if (reference !== "") {
key
=
storage
.
__storage
.
_find_key
(
'
url_string
'
,
url_string
);
//if (!self.jio_cache.development_mode && !key) {
// key = storage.__storage._find_key('reference', reference);
//}
}
else
if
(
reference
===
get_relative_url
(
url
))
{
// i use sort_on for emulate query:
// '(url_string: "" ) AND (reference: "' + reference + '")'
find_queue
=
find_and_get
({
query
:
query_portal_types
+
'
AND (reference: ="
'
+
reference
+
'
")
'
,
sort_on
:
[[
"
url_string
"
,
"
ascending
"
]]
},
storage
);
}
else
{
key
=
storage
.
__storage
.
_find_key
(
'
reference
'
,
reference
);
}
if
(
!
key
)
{
reject
({
status_code
:
404
});
return
;
}
find_queue
.
push
(
function
(
doc
)
{
return
storage
.
getAttachment
(
doc
.
id
,
portal_type2attach_name
(
doc
.
portal_type
))
find_queue
=
storage
.
getAttachment
(
key
,
'
text_content
'
)
.
push
(
function
(
body
)
{
var
content_type
;
content_type
=
doc
.
content_type
;
if
(
content_type
===
undefined
)
{
content_type
=
map_portal_type2content_type
[
doc
.
portal_type
];
}
resolve
(
new
Response
(
body
,
{
'
headers
'
:
{
'
content-type
'
:
content_
type
'
content-type
'
:
body
.
type
}
}));
});
})
})
.
push
(
undefined
,
function
(
error
)
{
reject
(
error
);
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_serviceworker_js.xml
View file @
66bc7bea
...
...
@@ -249,7 +249,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
953.
27011.49620.36881
</string>
</value>
<value>
<string>
953.
37175.9141.55876
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -267,7 +267,7 @@
</tuple>
<state>
<tuple>
<float>
147
1898009.02
</float>
<float>
147
2507149.74
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
@@ -324,7 +324,7 @@
</tuple>
<state>
<tuple>
<float>
1461754648.2
5
</float>
<float>
1461754648.2
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_getContentType.py
0 → 100644
View file @
66bc7bea
web_page
=
context
portal_type
=
web_page
.
getPortalType
()
content_type
=
web_page
.
getContentType
()
if
not
content_type
:
if
(
portal_type
==
"Web Script"
):
content_type
=
'application/javascript'
elif
(
portal_type
==
"Web Style"
):
content_type
=
'text/css'
elif
(
portal_type
==
"Web Page"
):
content_type
=
'text/html'
return
content_type
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_getContentType.xml
0 → 100644
View file @
66bc7bea
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebPage_getContentType
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio.xml
View file @
66bc7bea
...
...
@@ -82,6 +82,7 @@
<string>
my_portal_type
</string>
<string>
your_modification_date
</string>
<string>
my_url_string
</string>
<string>
my_content_type
</string>
</list>
</value>
</item>
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_theme/WebPage_viewAsJio/my_content_type.xml
0 → 100644
View file @
66bc7bea
This diff is collapsed.
Click to expand it.
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