Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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 @@
...
@@ -90,7 +90,9 @@
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareAcquiredMethod
(
'
getUrlFor
'
,
'
getUrlFor
'
)
.
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
;
}
if
(
!
appcache_storage
)
{
return
;
}
var
gadget
=
this
,
var
gadget
=
this
,
document_id_list
=
[
origin_url
,
document_id_list
=
[
origin_url
,
...
@@ -108,26 +110,25 @@
...
@@ -108,26 +110,25 @@
"
portal_types/Web Page Module/text_editor_view
"
,
"
portal_types/Web Page Module/text_editor_view
"
,
"
portal_types/Web Page/text_editor_clone
"
],
"
portal_types/Web Page/text_editor_clone
"
],
promise_list
=
[],
promise_list
=
[],
i
=
0
,
i
=
0
;
current_version
,
if
(
migration_version
!==
current_version
)
{
index
;
//clean storage if app version changed
current_version
=
window
.
location
.
href
.
replace
(
window
.
location
.
hash
,
""
);
for
(
i
=
0
;
i
<
document_id_list
.
length
;
i
+=
1
)
{
index
=
current_version
.
indexOf
(
window
.
location
.
host
)
+
window
.
location
.
host
.
length
;
promise_list
=
[
safeJioRemove
(
appcache_storage
,
document_id_list
[
i
])];
current_version
=
current_version
.
substr
(
index
);
}
return
gadget
.
getSetting
(
"
migration_version
"
)
}
.
push
(
function
(
migration_version
)
{
return
RSVP
.
Queue
()
if
(
migration_version
!==
current_version
)
{
.
push
(
function
()
{
for
(
i
=
0
;
i
<
document_id_list
.
length
;
i
+=
1
)
{
return
RSVP
.
all
(
promise_list
);
promise_list
=
[
safeJioRemove
(
appcache_storage
,
document_id_list
[
i
])];
}
return
RSVP
.
all
(
promise_list
);
}
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
setSetting
(
"
migration_version
"
,
current_version
);
return
gadget
.
setSetting
(
"
migration_version
"
,
current_version
);
})
})
.
push
(
function
()
{
.
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 @@
...
@@ -135,15 +136,25 @@
if
(
jio_options
===
undefined
)
{
return
;
}
if
(
jio_options
===
undefined
)
{
return
;
}
var
gadget
=
this
,
var
gadget
=
this
,
appcache_storage
,
appcache_storage
,
current_version
,
migration_version
,
selected_storage_name
,
previous_storage_name
,
index
,
origin_url
=
window
.
location
.
href
;
origin_url
=
window
.
location
.
href
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getSetting
(
'
configuration_manifest
'
),
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
)
{
.
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
=
{
var
jio_appchache_options
=
{
type
:
"
replicate
"
,
type
:
"
replicate
"
,
parallel_operation_attachment_amount
:
10
,
parallel_operation_attachment_amount
:
10
,
...
@@ -161,7 +172,7 @@
...
@@ -161,7 +172,7 @@
type
:
"
query
"
,
type
:
"
query
"
,
sub_storage
:
{
sub_storage
:
{
type
:
"
indexeddb
"
,
type
:
"
indexeddb
"
,
database
:
result_list
[
1
]
+
"
-configuration-hash
"
database
:
selected_storage_name
+
"
-configuration-hash
"
}
}
},
},
local_sub_storage
:
JSON
.
parse
(
JSON
.
stringify
(
jio_options
)),
local_sub_storage
:
JSON
.
parse
(
JSON
.
stringify
(
jio_options
)),
...
@@ -191,17 +202,16 @@
...
@@ -191,17 +202,16 @@
gadget
.
state_parameter_dict
.
jio_storage
=
undefined
;
gadget
.
state_parameter_dict
.
jio_storage
=
undefined
;
}
}
if
(
result_list
[
0
]
===
undefined
)
{
return
;
}
if
(
result_list
[
0
]
===
undefined
)
{
return
;
}
if
(
result_list
[
1
]
===
undefined
)
{
return
;
}
if
(
selected_storage_name
===
undefined
)
{
return
;
}
gadget
.
state_parameter_dict
.
jio_storage_name
=
result_list
[
1
]
;
gadget
.
state_parameter_dict
.
jio_storage_name
=
selected_storage_name
;
appcache_storage
=
jIO
.
createJIO
(
jio_appchache_options
);
appcache_storage
=
jIO
.
createJIO
(
jio_appchache_options
);
})
current_version
=
window
.
location
.
href
.
replace
(
window
.
location
.
hash
,
""
);
.
push
(
function
()
{
index
=
current_version
.
indexOf
(
window
.
location
.
host
)
+
window
.
location
.
host
.
length
;
return
gadget
.
clean
(
appcache_storage
,
origin_url
);
current_version
=
current_version
.
substr
(
index
);
})
if
(
migration_version
!==
current_version
||
.
push
(
function
(
current_version
)
{
previous_storage_name
!==
selected_storage_name
)
{
if
(
appcache_storage
)
{
return
gadget
.
updateConfiguration
(
appcache_storage
,
origin_url
,
migration_version
,
//if the app version has changed, force configuration storage sync
current_version
,
selected_storage_name
);
return
appcache_storage
.
repair
(
current_version
);
}
}
})
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_local_jio_js.xml
View file @
fd45d525
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
978.
21248.62721.2184
</string>
</value>
<value>
<string>
978.
63040.35215.11502
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
68041535.9
5
</float>
<float>
15
70462130.4
5
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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