diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-04-25 23:53:56 +0200 |
---|---|---|
committer | Robert Kowalski <rok@kowalski.gd> | 2014-05-07 19:06:04 +0200 |
commit | 2fe69e704bf3520334082a03fcf07434eda44ea0 (patch) | |
tree | 1bf362fcfe090339c42b6230745c9f3e9a25ab31 | |
parent | cf90e098dc3e14726f92001453510a75ea3c165e (diff) | |
download | couchdb-2fe69e704bf3520334082a03fcf07434eda44ea0.tar.gz |
Fauxton: fix sorting for tasks on click
there is no node property, but a target, source or database
depending on the task
-rw-r--r-- | src/fauxton/app/addons/activetasks/resources.js | 16 | ||||
-rw-r--r-- | src/fauxton/app/addons/activetasks/templates/table.html | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/fauxton/app/addons/activetasks/resources.js b/src/fauxton/app/addons/activetasks/resources.js index 3ac0898b2..3c5a513c8 100644 --- a/src/fauxton/app/addons/activetasks/resources.js +++ b/src/fauxton/app/addons/activetasks/resources.js @@ -23,7 +23,7 @@ function (app, backbone, Fauxton) { app.taskSortBy = 'type'; Active.Task = Backbone.Model.extend({ - initialize: function() { + initialize: function() { this.set({"id": this.get('pid')}); } }); @@ -109,7 +109,19 @@ function (app, backbone, Fauxton) { this.sort(); }, comparator: function(item) { - return item.get(app.taskSortBy); + var value = app.taskSortBy, + values; + + if (value.indexOf(',') !== -1) { + values = value.split(','); + _.each(values, function (val) { + if (item.get(val)) { + value = val; + } + }); + } + + return item.get(value); } }); diff --git a/src/fauxton/app/addons/activetasks/templates/table.html b/src/fauxton/app/addons/activetasks/templates/table.html index 885cb47d4..77d2a4239 100644 --- a/src/fauxton/app/addons/activetasks/templates/table.html +++ b/src/fauxton/app/addons/activetasks/templates/table.html @@ -37,7 +37,7 @@ the License. <thead> <tr> <th data-type="type">Type</th> - <th data-type="node">Object</th> + <th data-type="source,target,database">Object</th> <th data-type="started_on">Started on</th> <th data-type="updated_on">Last updated on</th> <th data-type="pid">PID</th> |