add docstring for instance group service

This commit is contained in:
Jake McDermott 2019-05-10 07:16:50 -04:00
parent 8725d3e539
commit 232c706b75
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7

View File

@ -7,6 +7,24 @@ export default
let defers = groups.map((group) => Rest.post(group));
return Promise.all(defers);
},
/**
* This function compares the currently saved ids and the selected ids - as soon as
* we encounter a difference between the two arrays, we mark all remaining currently
* saved ids in the array for disassociation.
*
* Example Scenario
* -----------------
* page is loaded with [1,2,3,4,5,6] as the currently selected tags
* user removes tag 3 from the middle
* user adds a new tag 7 to the end
* user appends tag 3 to the end
*
* _______ all ids here and to the right are disassociated
* |
* current: [1,2,3,4,5,6]
* selected: [1,2,4,5,6,7,3]
* |_______ all ids here and to the right are (re)associated
*/
editInstanceGroups: function(url, instance_groups) {
Rest.setUrl(url);
return Rest.get()