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
fd45d525
Commit
fd45d525
authored
Oct 08, 2019
by
Roque
Committed by
Roque
Oct 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: fix sync on every page reload
parent
e5f90f35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
30 deletions
+40
-30
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.js
...plateItem/web_page_module/gadget_officejs_local_jio_js.js
+38
-28
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_local_jio_js.js
View file @
fd45d525
...
...
@@ -90,7 +90,9 @@
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareAcquiredMethod
(
'
getUrlFor
'
,
'
getUrlFor
'
)
.
declareMethod
(
'
clean
'
,
function
(
appcache_storage
,
origin_url
)
{
.
declareMethod
(
'
updateConfiguration
'
,
function
(
appcache_storage
,
origin_url
,
migration_version
,
current_version
,
storage_name
)
{
if
(
!
appcache_storage
)
{
return
;
}
var
gadget
=
this
,
document_id_list
=
[
origin_url
,
...
...
@@ -108,26 +110,25 @@
"
portal_types/Web Page Module/text_editor_view
"
,
"
portal_types/Web Page/text_editor_clone
"
],
promise_list
=
[],
i
=
0
,
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
)
{
for
(
i
=
0
;
i
<
document_id_list
.
length
;
i
+=
1
)
{
promise_list
=
[
safeJioRemove
(
appcache_storage
,
document_id_list
[
i
])];
}
return
RSVP
.
all
(
promise_list
);
}
i
=
0
;
if
(
migration_version
!==
current_version
)
{
//clean storage if app version changed
for
(
i
=
0
;
i
<
document_id_list
.
length
;
i
+=
1
)
{
promise_list
=
[
safeJioRemove
(
appcache_storage
,
document_id_list
[
i
])];
}
}
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
()
{
return
gadget
.
setSetting
(
"
migration_version
"
,
current_version
);
})
.
push
(
function
()
{
return
current_version
;
return
gadget
.
setSetting
(
"
previous_storage_name
"
,
storage_name
);
})
.
push
(
function
()
{
return
appcache_storage
.
repair
(
current_version
);
});
})
...
...
@@ -135,15 +136,25 @@
if
(
jio_options
===
undefined
)
{
return
;
}
var
gadget
=
this
,
appcache_storage
,
current_version
,
migration_version
,
selected_storage_name
,
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
(
'
jio_storage_name
'
),
gadget
.
getSetting
(
'
previous_storage_name
'
),
gadget
.
getSetting
(
'
migration_version
'
)
]);
})
.
push
(
function
(
result_list
)
{
selected_storage_name
=
result_list
[
1
];
previous_storage_name
=
result_list
[
2
];
migration_version
=
result_list
[
3
];
var
jio_appchache_options
=
{
type
:
"
replicate
"
,
parallel_operation_attachment_amount
:
10
,
...
...
@@ -161,7 +172,7 @@
type
:
"
query
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
result_list
[
1
]
+
"
-configuration-hash
"
database
:
selected_storage_name
+
"
-configuration-hash
"
}
},
local_sub_storage
:
JSON
.
parse
(
JSON
.
stringify
(
jio_options
)),
...
...
@@ -191,17 +202,16 @@
gadget
.
state_parameter_dict
.
jio_storage
=
undefined
;
}
if
(
result_list
[
0
]
===
undefined
)
{
return
;
}
if
(
result_list
[
1
]
===
undefined
)
{
return
;
}
gadget
.
state_parameter_dict
.
jio_storage_name
=
result_list
[
1
]
;
if
(
selected_storage_name
===
undefined
)
{
return
;
}
gadget
.
state_parameter_dict
.
jio_storage_name
=
selected_storage_name
;
appcache_storage
=
jIO
.
createJIO
(
jio_appchache_options
);
})
.
push
(
function
()
{
return
gadget
.
clean
(
appcache_storage
,
origin_url
);
})
.
push
(
function
(
current_version
)
{
if
(
appcache_storage
)
{
//if the app version has changed, force configuration storage sync
return
appcache_storage
.
repair
(
current_version
);
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
);
}
})
.
push
(
undefined
,
function
(
error
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.xml
View file @
fd45d525
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
21248.62721.2184
</string>
</value>
<value>
<string>
978.
63040.35215.11502
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
15
68041535.9
5
</float>
<float>
15
70462130.4
5
</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