diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-23 21:56:42 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-23 21:56:42 +0100 |
commit | 6e8a0f79f5ad7182a0bc35308ae06c63222667ed (patch) | |
tree | 0026179d34f19b64bc689c63af85b949ce57fb83 /module/web/static/js/collections | |
parent | show button when files are selected (diff) | |
download | pyload-6e8a0f79f5ad7182a0bc35308ae06c63222667ed.tar.xz |
implemented interactions for multi user, show waiting queries on webui
Diffstat (limited to 'module/web/static/js/collections')
-rw-r--r-- | module/web/static/js/collections/InteractionList.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/module/web/static/js/collections/InteractionList.js b/module/web/static/js/collections/InteractionList.js new file mode 100644 index 000000000..88651970e --- /dev/null +++ b/module/web/static/js/collections/InteractionList.js @@ -0,0 +1,47 @@ +define(['jquery', 'backbone', 'underscore', 'app', 'models/InteractionTask'], + function($, Backbone, _, App, InteractionTask) { + + return Backbone.Collection.extend({ + + model: InteractionTask, + + comparator: function(task) { + return task.get('iid'); + }, + + fetch: function(options) { + options = App.apiRequest('getInteractionTasks/0'); + + return Backbone.Collection.prototype.fetch.apply(this, options); + }, + + toJSON: function() { + var data = {queries: 0, notifications: 0, empty: false}; + + this.map(function(task) { + if (task.isNotification()) + data.notifications++; + else + data.queries++; + }); + + if (!data.queries && !data.notifications) + data.empty = true; + + return data; + }, + + // a task is waiting for attention (no notification) + hasTaskWaiting: function() { + var tasks = 0; + this.map(function(task) { + if (!task.isNotification()) + tasks++; + }); + + return tasks > 0; + } + + }); + + });
\ No newline at end of file |