Commit c4e7bbde authored by Romain Courteaud's avatar Romain Courteaud

Release version 3.10.0

parent 1cb52dfb
......@@ -6969,11 +6969,12 @@ return new Parser;
}
function checkSignatureDifference(queue, source, destination, id,
conflict_force, conflict_ignore) {
conflict_force, conflict_ignore,
getMethod) {
queue
.push(function () {
return RSVP.all([
source.get(id),
getMethod(id),
context._signature_sub_storage.get(id)
]);
})
......@@ -7021,6 +7022,35 @@ return new Parser;
});
}
function checkBulkSignatureDifference(queue, source, destination, id_list,
conflict_force, conflict_ignore) {
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) {
checkSignatureDifference(sub_queue, source, destination,
id_list[i].parameter_list[0],
conflict_force, conflict_ignore,
getResult(i));
}
return sub_queue;
});
}
function pushStorage(source, destination, options) {
var queue = new RSVP.Queue();
if (!options.hasOwnProperty("use_post")) {
......@@ -7037,6 +7067,7 @@ return new Parser;
var i,
local_dict = {},
new_list = [],
change_list = [],
signature_dict = {},
key;
for (i = 0; i < result_list[0].data.total_rows; i += 1) {
......@@ -7079,9 +7110,17 @@ return new Parser;
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]
});
} else {
checkSignatureDifference(queue, source, destination, key,
options.conflict_force,
options.conflict_ignore);
options.conflict_ignore,
source.get.bind(source));
}
}
} else {
if (options.check_deletion === true) {
......@@ -7090,6 +7129,12 @@ return new Parser;
}
}
}
if ((options.use_bulk_get === true) && (change_list.length !== 0)) {
checkBulkSignatureDifference(queue, source, destination,
change_list,
options.conflict_force,
options.conflict_ignore);
}
});
}
......@@ -8952,8 +8997,10 @@ return new Parser;
});
};
ERP5Storage.prototype.getAttachment = function (id, action) {
ERP5Storage.prototype.getAttachment = function (id, action, options) {
if (options === undefined) {
options = {};
}
if (action === "view") {
if (this._default_view_reference === undefined) {
throw new jIO.util.jIOError(
......@@ -8965,7 +9012,6 @@ return new Parser;
{"_view": this._default_view_reference})
.push(function (response) {
var result = JSON.parse(response.target.responseText);
result._id = id;
result.portal_type = result._links.type.name;
// Remove all ERP5 hateoas links / convert them into jIO ID
......@@ -8991,21 +9037,47 @@ return new Parser;
if (action.indexOf(this._url) === 0) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
var start,
end,
range,
request_options = {
"type": "GET",
"dataType": "blob",
"url": action,
"xhrFields": {
withCredentials: true
}
});
};
if (options.start !== undefined || options.end !== undefined) {
start = options.start || 0;
end = options.end;
if (end !== undefined && end < 0) {
throw new jIO.util.jIOError("end must be positive",
400);
}
if (start < 0) {
range = "bytes=" + start;
} else if (end === undefined) {
range = "bytes=" + start + "-";
} else {
if (start > end) {
throw new jIO.util.jIOError("start is greater than end",
400);
}
range = "bytes=" + start + "-" + end;
}
request_options.headers = {Range: range};
}
return jIO.util.ajax(request_options);
})
.push(function (evt) {
var result = JSON.parse(evt.target.responseText);
result._id = id;
if (evt.target.response === undefined) {
return new Blob(
[JSON.stringify(result)],
[evt.target.responseText],
{"type": evt.target.getResponseHeader("Content-Type")}
);
}
return evt.target.response;
});
}
throw new jIO.util.jIOError("ERP5: not support get attachment: " + action,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "jio",
"version": "v3.9.0",
"version": "v3.10.0",
"license": "LGPLv3",
"author": "Nexedi SA",
"contributors": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment