mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Recursively fetch workflow nodes when there is more than 1 page of nodes
This commit is contained in:
parent
81805c780f
commit
643c0e240c
@ -52,7 +52,30 @@ export default {
|
||||
Rest.setUrl(workflowData.related.workflow_nodes);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
defer.resolve(data.results);
|
||||
if(data.next) {
|
||||
let allNodes = data.results;
|
||||
let getNodes = function(nextUrl){
|
||||
// Get the workflow nodes
|
||||
Rest.setUrl(nextUrl);
|
||||
Rest.get()
|
||||
.success(function(nextData) {
|
||||
for(var i=0; i<nextData.results.length; i++) {
|
||||
allNodes.push(nextData.results[i]);
|
||||
}
|
||||
if(nextData.next) {
|
||||
// Get the next page
|
||||
getNodes(nextData.next);
|
||||
}
|
||||
else {
|
||||
defer.resolve(allNodes);
|
||||
}
|
||||
});
|
||||
};
|
||||
getNodes(data.next);
|
||||
}
|
||||
else {
|
||||
defer.resolve(data.results);
|
||||
}
|
||||
})
|
||||
.error(function() {
|
||||
// TODO: handle this
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user