mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 09:18:48 -03:30
Recursively fetch workflow nodes when there is more than 1 page of nodes
This commit is contained in:
@@ -52,7 +52,30 @@ export default {
|
|||||||
Rest.setUrl(workflowData.related.workflow_nodes);
|
Rest.setUrl(workflowData.related.workflow_nodes);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.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() {
|
.error(function() {
|
||||||
// TODO: handle this
|
// TODO: handle this
|
||||||
|
|||||||
Reference in New Issue
Block a user