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
f0fc59b2
Commit
f0fc59b2
authored
Jul 29, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Update jio.js to 3.12.0
parent
5cf3d2e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
148 deletions
+122
-148
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
...enderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
+120
-146
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
View file @
f0fc59b2
...
...
@@ -7458,11 +7458,17 @@ return new Parser;
};
}(
window
,
moment
));
;
/*global window, RSVP, Blob, XMLHttpRequest, QueryFactory, Query, atob,
FileReader, ArrayBuffer, Uint8Array */
FileReader, ArrayBuffer, Uint8Array
, navigator
*/
(
function
(
window
,
RSVP
,
Blob
,
QueryFactory
,
Query
,
atob
,
FileReader
,
ArrayBuffer
,
Uint8Array
)
{
FileReader
,
ArrayBuffer
,
Uint8Array
,
navigator
)
{
"
use strict
"
;
if
(
window
.
openDatabase
===
undefined
)
{
window
.
openDatabase
=
function
()
{
throw
new
Error
(
'
WebSQL is not supported by
'
+
navigator
.
userAgent
);
};
}
var
util
=
{},
jIO
;
...
...
@@ -7569,6 +7575,38 @@ return new Parser;
}
util
.
readBlobAsDataURL
=
readBlobAsDataURL
;
function
stringify
(
obj
)
{
// Implement a stable JSON.stringify
// Object's keys are alphabetically ordered
var
key
,
key_list
,
i
,
value
,
result_list
;
if
(
obj
.
constructor
===
Object
)
{
key_list
=
Object
.
keys
(
obj
).
sort
();
result_list
=
[];
for
(
i
=
0
;
i
<
key_list
.
length
;
i
+=
1
)
{
key
=
key_list
[
i
];
value
=
stringify
(
obj
[
key
]);
if
(
value
!==
undefined
)
{
result_list
.
push
(
stringify
(
key
)
+
'
:
'
+
value
);
}
}
return
'
{
'
+
result_list
.
join
(
'
,
'
)
+
'
}
'
;
}
if
(
obj
.
constructor
===
Array
)
{
result_list
=
[];
for
(
i
=
0
;
i
<
obj
.
length
;
i
+=
1
)
{
result_list
.
push
(
stringify
(
obj
[
i
]));
}
return
'
[
'
+
result_list
.
join
(
'
,
'
)
+
'
]
'
;
}
return
JSON
.
stringify
(
obj
);
}
util
.
stringify
=
stringify
;
// https://gist.github.com/davoclavo/4424731
function
dataURItoBlob
(
dataURI
)
{
// convert base64 to raw binary data held in a string
...
...
@@ -7931,7 +7969,7 @@ return new Parser;
window
.
jIO
=
jIO
;
}(
window
,
RSVP
,
Blob
,
QueryFactory
,
Query
,
atob
,
FileReader
,
ArrayBuffer
,
Uint8Array
));
FileReader
,
ArrayBuffer
,
Uint8Array
,
navigator
));
;
/*
* Rusha, a JavaScript implementation of the Secure Hash Algorithm, SHA-1,
* as defined in FIPS PUB 180-1, tuned for high performance with large inputs.
...
...
@@ -8158,7 +8196,7 @@ return new Parser;
var
ceilHeapSize
=
function
(
v
)
{
// The asm.js spec says:
// The heap object's byteLength must be either
// 2^n for n in [12, 24) or 2^24 * n for n
≥
1.
// 2^n for n in [12, 24) or 2^24 * n for n
≥
1.
// Also, byteLengths smaller than 2^16 are deprecated.
var
p
;
// If v is smaller than 2^16, the smallest possible solution
...
...
@@ -8370,7 +8408,7 @@ return new Parser;
/*jslint nomen: true*/
/*global jIO, RSVP, Rusha*/
(
function
(
jIO
,
RSVP
,
Rusha
)
{
(
function
(
jIO
,
RSVP
,
Rusha
,
stringify
)
{
"
use strict
"
;
var
rusha
=
new
Rusha
(),
...
...
@@ -8397,9 +8435,9 @@ return new Parser;
this
.
_remote_sub_storage
=
jIO
.
createJIO
(
spec
.
remote_sub_storage
);
this
.
_signature_hash
=
"
_replicate_
"
+
generateHash
(
JSON
.
stringify
(
spec
.
local_sub_storage
)
+
JSON
.
stringify
(
spec
.
remote_sub_storage
)
+
JSON
.
stringify
(
this
.
_query_options
)
stringify
(
spec
.
local_sub_storage
)
+
stringify
(
spec
.
remote_sub_storage
)
+
stringify
(
this
.
_query_options
)
);
this
.
_signature_sub_storage
=
jIO
.
createJIO
({
type
:
"
document
"
,
...
...
@@ -8540,90 +8578,6 @@ return new Parser;
});
}
function
checkLocalCreation
(
queue
,
source
,
destination
,
id
,
options
,
getMethod
)
{
var
remote_doc
;
queue
.
push
(
function
()
{
return
destination
.
get
(
id
);
})
.
push
(
function
(
doc
)
{
remote_doc
=
doc
;
},
function
(
error
)
{
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
(
error
.
status_code
===
404
))
{
// This document was never synced.
// Push it to the remote storage and store sync information
return
;
}
throw
error
;
})
.
push
(
function
()
{
// This document was never synced.
// Push it to the remote storage and store sync information
return
getMethod
(
id
);
})
.
push
(
function
(
doc
)
{
var
local_hash
=
generateHash
(
JSON
.
stringify
(
doc
)),
remote_hash
;
if
(
remote_doc
===
undefined
)
{
return
propagateModification
(
source
,
destination
,
doc
,
local_hash
,
id
,
options
);
}
remote_hash
=
generateHash
(
JSON
.
stringify
(
remote_doc
));
if
(
local_hash
===
remote_hash
)
{
// Same document
return
context
.
_signature_sub_storage
.
put
(
id
,
{
"
hash
"
:
local_hash
})
.
push
(
function
()
{
skip_document_dict
[
id
]
=
null
;
});
}
if
(
options
.
conflict_ignore
===
true
)
{
return
;
}
if
(
options
.
conflict_force
===
true
)
{
return
propagateModification
(
source
,
destination
,
doc
,
local_hash
,
id
,
options
);
}
// Already exists on destination
throw
new
jIO
.
util
.
jIOError
(
"
Conflict on '
"
+
id
+
"
':
"
+
JSON
.
stringify
(
doc
)
+
"
!==
"
+
JSON
.
stringify
(
remote_doc
),
409
);
});
}
function
checkBulkLocalCreation
(
queue
,
source
,
destination
,
id_list
,
options
)
{
queue
.
push
(
function
()
{
return
source
.
bulk
(
id_list
);
})
.
push
(
function
(
result_list
)
{
var
i
,
sub_queue
=
new
RSVP
.
Queue
();
function
getResult
(
j
)
{
return
function
(
id
)
{
if
(
id
!==
id_list
[
j
].
parameter_list
[
0
])
{
throw
new
Error
(
"
Does not access expected ID
"
+
id
);
}
return
result_list
[
j
];
};
}
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
checkLocalCreation
(
sub_queue
,
source
,
destination
,
id_list
[
i
].
parameter_list
[
0
],
options
,
getResult
(
i
));
}
return
sub_queue
;
});
}
function
checkLocalDeletion
(
queue
,
destination
,
id
,
source
)
{
var
status_hash
;
queue
...
...
@@ -8634,7 +8588,7 @@ return new Parser;
status_hash
=
result
.
hash
;
return
destination
.
get
(
id
)
.
push
(
function
(
doc
)
{
var
remote_hash
=
generateHash
(
JSON
.
stringify
(
doc
));
var
remote_hash
=
generateHash
(
stringify
(
doc
));
if
(
remote_hash
===
status_hash
)
{
return
destination
.
remove
(
id
)
.
push
(
function
()
{
...
...
@@ -8663,24 +8617,37 @@ return new Parser;
function
checkSignatureDifference
(
queue
,
source
,
destination
,
id
,
conflict_force
,
conflict_ignore
,
getMethod
)
{
is_creation
,
is_modification
,
getMethod
,
options
)
{
queue
.
push
(
function
()
{
// Optimisation to save a get call to signature storage
if
(
is_creation
===
true
)
{
return
RSVP
.
all
([
getMethod
(
id
),
{
hash
:
undefined
}
]);
}
if
(
is_modification
===
true
)
{
return
RSVP
.
all
([
getMethod
(
id
),
context
.
_signature_sub_storage
.
get
(
id
)
]);
}
throw
new
jIO
.
util
.
jIOError
(
"
Unexpected call of
"
+
"
checkSignatureDifference
"
,
409
);
})
.
push
(
function
(
result_list
)
{
var
doc
=
result_list
[
0
],
local_hash
=
generateHash
(
JSON
.
stringify
(
doc
)),
local_hash
=
generateHash
(
stringify
(
doc
)),
status_hash
=
result_list
[
1
].
hash
;
if
(
local_hash
!==
status_hash
)
{
// Local modifications
return
destination
.
get
(
id
)
.
push
(
function
(
remote_doc
)
{
var
remote_hash
=
generateHash
(
JSON
.
stringify
(
remote_doc
));
var
remote_hash
=
generateHash
(
stringify
(
remote_doc
));
if
(
remote_hash
!==
status_hash
)
{
// Modifications on both sides
if
(
local_hash
===
remote_hash
)
{
...
...
@@ -8697,19 +8664,29 @@ return new Parser;
}
if
(
conflict_force
!==
true
)
{
throw
new
jIO
.
util
.
jIOError
(
"
Conflict on '
"
+
id
+
"
':
"
+
JSON
.
stringify
(
doc
)
+
"
!==
"
+
JSON
.
stringify
(
remote_doc
),
stringify
(
doc
)
+
"
!==
"
+
stringify
(
remote_doc
),
409
);
}
}
return
propagateModification
(
source
,
destination
,
doc
,
local_hash
,
id
);
},
function
(
error
)
{
var
use_post
;
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
(
error
.
status_code
===
404
))
{
// Document has been deleted remotely
if
(
is_creation
)
{
// Remote document does not exists, create it following
// provided options
use_post
=
options
.
use_post
;
}
else
{
// Remote document has been erased, put it to save
// modification
use_post
=
false
;
}
return
propagateModification
(
source
,
destination
,
doc
,
local_hash
,
id
);
local_hash
,
id
,
{
use_post
:
use_post
});
}
throw
error
;
});
...
...
@@ -8718,6 +8695,7 @@ return new Parser;
}
function
checkBulkSignatureDifference
(
queue
,
source
,
destination
,
id_list
,
document_status_list
,
options
,
conflict_force
,
conflict_ignore
)
{
queue
.
push
(
function
()
{
...
...
@@ -8740,7 +8718,9 @@ return new Parser;
checkSignatureDifference
(
sub_queue
,
source
,
destination
,
id_list
[
i
].
parameter_list
[
0
],
conflict_force
,
conflict_ignore
,
getResult
(
i
));
document_status_list
[
i
].
is_creation
,
document_status_list
[
i
].
is_modification
,
getResult
(
i
),
options
);
}
return
sub_queue
;
});
...
...
@@ -8761,9 +8741,11 @@ return new Parser;
.
push
(
function
(
result_list
)
{
var
i
,
local_dict
=
{},
new
_list
=
[],
change
_list
=
[],
document
_list
=
[],
document_status
_list
=
[],
signature_dict
=
{},
is_modification
,
is_creation
,
key
;
for
(
i
=
0
;
i
<
result_list
[
0
].
data
.
total_rows
;
i
+=
1
)
{
if
(
!
skip_document_dict
.
hasOwnProperty
(
...
...
@@ -8779,54 +8761,46 @@ return new Parser;
signature_dict
[
result_list
[
1
].
data
.
rows
[
i
].
id
]
=
i
;
}
}
if
(
options
.
check_creation
===
true
)
{
for
(
key
in
local_dict
)
{
if
(
local_dict
.
hasOwnProperty
(
key
))
{
if
(
!
signature_dict
.
hasOwnProperty
(
key
))
{
is_modification
=
signature_dict
.
hasOwnProperty
(
key
)
&&
options
.
check_modification
;
is_creation
=
!
signature_dict
.
hasOwnProperty
(
key
)
&&
options
.
check_creation
;
if
(
is_modification
===
true
||
is_creation
===
true
)
{
if
(
options
.
use_bulk_get
===
true
)
{
new
_list
.
push
({
document
_list
.
push
({
method
:
"
get
"
,
parameter_list
:
[
key
]
});
}
else
{
checkLocalCreation
(
queue
,
source
,
destination
,
key
,
options
,
source
.
get
.
bind
(
source
));
}
}
}
}
if
((
options
.
use_bulk_get
===
true
)
&&
(
new_list
.
length
!==
0
))
{
checkBulkLocalCreation
(
queue
,
source
,
destination
,
new_list
,
options
);
}
}
for
(
key
in
signature_dict
)
{
if
(
signature_dict
.
hasOwnProperty
(
key
))
{
if
(
local_dict
.
hasOwnProperty
(
key
))
{
if
(
options
.
check_modification
===
true
)
{
if
(
options
.
use_bulk_get
===
true
)
{
change_list
.
push
({
method
:
"
get
"
,
parameter_list
:
[
key
]
document_status_list
.
push
({
is_creation
:
is_creation
,
is_modification
:
is_modification
});
}
else
{
checkSignatureDifference
(
queue
,
source
,
destination
,
key
,
options
.
conflict_force
,
options
.
conflict_ignore
,
source
.
get
.
bind
(
source
));
is_creation
,
is_modification
,
source
.
get
.
bind
(
source
),
options
);
}
}
}
}
}
else
{
if
(
options
.
check_deletion
===
true
)
{
for
(
key
in
signature_dict
)
{
if
(
signature_dict
.
hasOwnProperty
(
key
))
{
if
(
!
local_dict
.
hasOwnProperty
(
key
))
{
checkLocalDeletion
(
queue
,
destination
,
key
,
source
);
}
}
}
}
if
((
options
.
use_bulk_get
===
true
)
&&
(
change
_list
.
length
!==
0
))
{
if
((
options
.
use_bulk_get
===
true
)
&&
(
document
_list
.
length
!==
0
))
{
checkBulkSignatureDifference
(
queue
,
source
,
destination
,
change_list
,
document_list
,
document_status_list
,
options
,
options
.
conflict_force
,
options
.
conflict_ignore
);
}
...
...
@@ -8921,7 +8895,7 @@ return new Parser;
jIO
.
addStorage
(
'
replicate
'
,
ReplicateStorage
);
}(
jIO
,
RSVP
,
Rusha
));
}(
jIO
,
RSVP
,
Rusha
,
jIO
.
util
.
stringify
));
;
/*
* Copyright 2015, Nexedi SA
* Released under the LGPL license.
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
f0fc59b2
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
1.35286.47701.22630
</string>
</value>
<value>
<string>
95
2.21277.40593.7202
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
146
6697567.97
</float>
<float>
146
9783617.68
</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