Only update the moving item when moving items in worklists

This makes moving things around in boards and worklists much more
sensible, by not sending a PUT request for every item in the affected
worklist(s) when a single item moves.

This improvement makes concurrent editing safer and less confusing.

This patch requires https://review.openstack.org/273562 in order to
function correctly.

Change-Id: I00a98c9ac9b8c5640d8beb664b0a5a162e82b215
This commit is contained in:
Adam Coldrick
2016-01-28 14:10:54 +00:00
parent 61e2e002c6
commit 1e8bf0acbf
3 changed files with 27 additions and 49 deletions

View File

@@ -207,14 +207,15 @@ angular.module('sb.worklist').controller('WorklistDetailController',
},
orderChanged: function (result) {
var list = result.dest.sortableScope.$parent.worklist;
for (var i = 0; i < list.items.length; i++) {
var item = list.items[i];
Worklist.ItemsController.update({
id: list.id,
item_id: item.id,
list_position: i
});
}
var position = result.dest.index;
var item = list.items[position];
item.list_position = position;
Worklist.ItemsController.update({
id: list.id,
item_id: item.id,
list_position: item.list_position
});
}
};