Commit eed166fb authored by Romain Courteaud's avatar Romain Courteaud

[erp5_xhtml_style/web_renderjs_ui] Update RSVP

parent c219c40a
...@@ -379,10 +379,10 @@ define("rsvp/events", ...@@ -379,10 +379,10 @@ define("rsvp/events",
__exports__.EventTarget = EventTarget; __exports__.EventTarget = EventTarget;
}); });
define("rsvp/hash", define("rsvp/hash",
["rsvp/defer","exports"], ["rsvp/promise","exports"],
function(__dependency1__, __exports__) { function(__dependency1__, __exports__) {
"use strict"; "use strict";
var defer = __dependency1__.defer; var Promise = __dependency1__.Promise;
function size(object) { function size(object) {
var s = 0; var s = 0;
...@@ -395,38 +395,61 @@ define("rsvp/hash", ...@@ -395,38 +395,61 @@ define("rsvp/hash",
} }
function hash(promises) { function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises);
if (remaining === 0) { function canceller() {
deferred.resolve({}); var promise,
key;
for (key in promises) {
if (promises.hasOwnProperty(key)) {
promise = promises[key];
if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') {
promise.cancel();
}
}
}
} }
var resolver = function(prop) { return new Promise(function(resolve, reject) {
return function(value) { var results = {}, remaining = size(promises),
resolveAll(prop, value); promise;
};
};
var resolveAll = function(prop, value) { if (remaining === 0) {
results[prop] = value; resolve(results);
if (--remaining === 0) {
deferred.resolve(results);
} }
};
var rejectAll = function(error) { function resolver(key) {
deferred.reject(error); return function(value) {
}; resolveAll(key, value);
};
}
for (var prop in promises) { function resolveAll(key, value) {
if (promises[prop] && typeof promises[prop].then === 'function') { results[key] = value;
promises[prop].then(resolver(prop), rejectAll); if (--remaining === 0) {
} else { resolve(results);
resolveAll(prop, promises[prop]); }
} }
}
return deferred.promise; function cancelAll(rejectionValue) {
reject(rejectionValue);
canceller();
}
for (var prop in promises) {
promise = promises[prop];
if (promise && typeof promise.then === 'function') {
promise.then(resolver(prop), cancelAll);
} else {
resolveAll(prop, promise);
}
}
}, canceller
);
} }
......
...@@ -148,171 +148,183 @@ ...@@ -148,171 +148,183 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>publish_alive</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>publish_alive</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>romain</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>romain</string> </value>
<key> <string>comment</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>comment</string> </key>
<item> <value> <string></string> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1406898405.66</float> <state>
<string>GMT</string> <tuple>
</tuple> <float>1406898405.66</float>
</state> <string>GMT</string>
</object> </tuple>
</value> </state>
</item> </object>
<item> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>published_alive</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>published_alive</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>967.36619.48069.16759</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>977.38881.34981.23125</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1526454424.27</float> <state>
<string>UTC</string> <tuple>
</tuple> <float>1576579789.68</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>detect_converted_file</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>detect_converted_file</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>romain</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>romain</string> </value>
<key> <string>comment</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>comment</string> </key>
<item> <value> <string></string> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>external_processing_state</string> </key> </item>
<value> <string>converted</string> </value> <item>
</item> <key> <string>external_processing_state</string> </key>
<item> <value> <string>converted</string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>0.0.0.0</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>0.0.0.0</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1404997292.1</float> <state>
<string>GMT</string> <tuple>
</tuple> <float>1404997292.1</float>
</state> <string>GMT</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -379,10 +379,10 @@ define("rsvp/events", ...@@ -379,10 +379,10 @@ define("rsvp/events",
__exports__.EventTarget = EventTarget; __exports__.EventTarget = EventTarget;
}); });
define("rsvp/hash", define("rsvp/hash",
["rsvp/defer","exports"], ["rsvp/promise","exports"],
function(__dependency1__, __exports__) { function(__dependency1__, __exports__) {
"use strict"; "use strict";
var defer = __dependency1__.defer; var Promise = __dependency1__.Promise;
function size(object) { function size(object) {
var s = 0; var s = 0;
...@@ -395,38 +395,61 @@ define("rsvp/hash", ...@@ -395,38 +395,61 @@ define("rsvp/hash",
} }
function hash(promises) { function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises);
if (remaining === 0) { function canceller() {
deferred.resolve({}); var promise,
key;
for (key in promises) {
if (promises.hasOwnProperty(key)) {
promise = promises[key];
if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') {
promise.cancel();
}
}
}
} }
var resolver = function(prop) { return new Promise(function(resolve, reject) {
return function(value) { var results = {}, remaining = size(promises),
resolveAll(prop, value); promise;
};
};
var resolveAll = function(prop, value) { if (remaining === 0) {
results[prop] = value; resolve(results);
if (--remaining === 0) {
deferred.resolve(results);
} }
};
var rejectAll = function(error) { function resolver(key) {
deferred.reject(error); return function(value) {
}; resolveAll(key, value);
};
}
for (var prop in promises) { function resolveAll(key, value) {
if (promises[prop] && typeof promises[prop].then === 'function') { results[key] = value;
promises[prop].then(resolver(prop), rejectAll); if (--remaining === 0) {
} else { resolve(results);
resolveAll(prop, promises[prop]); }
} }
}
return deferred.promise; function cancelAll(rejectionValue) {
reject(rejectionValue);
canceller();
}
for (var prop in promises) {
promise = promises[prop];
if (promise && typeof promise.then === 'function') {
promise.then(resolver(prop), cancelAll);
} else {
resolveAll(prop, promise);
}
}
}, canceller
);
} }
......
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