mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Merge pull request #4811 from mabashian/4557-workflow-nodes-pagination
WFJT node pagination
This commit is contained in:
commit
2e7a1eb3fe
@ -184,6 +184,12 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('clearWorkflowLists', function() {
|
||||
$scope.job_templates.forEach(function(row, i) {
|
||||
$scope.job_templates[i].checked = 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -258,6 +264,12 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('clearWorkflowLists', function() {
|
||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
$scope.workflow_inventory_sources[i].checked = 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -330,6 +342,12 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('clearWorkflowLists', function() {
|
||||
$scope.projects.forEach(function(row, i) {
|
||||
$scope.projects[i].checked = 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -84,11 +84,15 @@ export default ['Rest', 'GetBasePath', '$q', function(Rest, GetBasePath, $q){
|
||||
Rest.setUrl(url);
|
||||
return Rest.get();
|
||||
},
|
||||
getWorkflowJobTemplateNodes: function(id) {
|
||||
getWorkflowJobTemplateNodes: function(id, page) {
|
||||
var url = GetBasePath('workflow_job_templates');
|
||||
|
||||
url = url + id + '/workflow_nodes';
|
||||
|
||||
if(page) {
|
||||
url += '/?page=' + page;
|
||||
}
|
||||
|
||||
Rest.setUrl(url);
|
||||
return Rest.get();
|
||||
},
|
||||
|
||||
@ -149,12 +149,12 @@
|
||||
$scope.url = workflowJobTemplateData.url;
|
||||
$scope.survey_enabled = workflowJobTemplateData.survey_enabled;
|
||||
|
||||
// Get the workflow nodes
|
||||
TemplatesService.getWorkflowJobTemplateNodes(id)
|
||||
.then(function(data){
|
||||
let allNodes = [];
|
||||
let page = 1;
|
||||
|
||||
let buildTreeFromNodes = function(){
|
||||
$scope.workflowTree = WorkflowService.buildTree({
|
||||
workflowNodes: data.data.results
|
||||
workflowNodes: allNodes
|
||||
});
|
||||
|
||||
// TODO: I think that the workflow chart directive (and eventually d3) is meddling with
|
||||
@ -169,14 +169,34 @@
|
||||
// In the partial, the workflow maker directive has an ng-if attribute which is pointed at this scope variable.
|
||||
// It won't get included until this the tree has been built - I'm open to better ways of doing this.
|
||||
$scope.includeWorkflowMaker = true;
|
||||
};
|
||||
|
||||
}, function(error){
|
||||
ProcessErrors($scope, error.data, error.status, form, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get workflow job template nodes. GET returned ' +
|
||||
'status: ' + error.status
|
||||
let getNodes = function(){
|
||||
// Get the workflow nodes
|
||||
TemplatesService.getWorkflowJobTemplateNodes(id, page)
|
||||
.then(function(data){
|
||||
for(var i=0; i<data.data.results.length; i++) {
|
||||
allNodes.push(data.data.results[i]);
|
||||
}
|
||||
if(data.data.next) {
|
||||
// Get the next page
|
||||
page++;
|
||||
getNodes();
|
||||
}
|
||||
else {
|
||||
// This is the last page
|
||||
buildTreeFromNodes();
|
||||
}
|
||||
}, function(error){
|
||||
ProcessErrors($scope, error.data, error.status, form, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get workflow job template nodes. GET returned ' +
|
||||
'status: ' + error.status
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
getNodes();
|
||||
|
||||
}, function(error){
|
||||
ProcessErrors($scope, error.data, error.status, form, {
|
||||
|
||||
@ -49,14 +49,13 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr
|
||||
$scope.workflowMakerFormConfig.nodeMode = "idle";
|
||||
$scope.edgeFlags.showTypeOptions = false;
|
||||
delete $scope.selectedTemplate;
|
||||
delete $scope.workflow_job_templates;
|
||||
delete $scope.workflow_projects;
|
||||
delete $scope.workflow_inventory_sources;
|
||||
delete $scope.placeholderNode;
|
||||
delete $scope.betweenTwoNodes;
|
||||
$scope.nodeBeingEdited = null;
|
||||
$scope.edgeFlags.typeRestriction = null;
|
||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||
|
||||
$scope.$broadcast('clearWorkflowLists');
|
||||
}
|
||||
|
||||
function recursiveNodeUpdates(params, completionCallback) {
|
||||
|
||||
@ -160,13 +160,13 @@ export default [function(){
|
||||
allNodeIds.push(node.id);
|
||||
|
||||
_.forEach(node.success_nodes, function(nodeId){
|
||||
nonRootNodeIds.push(nodeId);
|
||||
nonRootNodeIds.push(nodeId);
|
||||
});
|
||||
_.forEach(node.failure_nodes, function(nodeId){
|
||||
nonRootNodeIds.push(nodeId);
|
||||
nonRootNodeIds.push(nodeId);
|
||||
});
|
||||
_.forEach(node.always_nodes, function(nodeId){
|
||||
nonRootNodeIds.push(nodeId);
|
||||
nonRootNodeIds.push(nodeId);
|
||||
});
|
||||
});
|
||||
|
||||
@ -223,12 +223,14 @@ export default [function(){
|
||||
treeNode.originalParentId = params.parentId;
|
||||
}
|
||||
|
||||
if(params.nodesObj[params.nodeId].summary_fields.job) {
|
||||
treeNode.job = _.clone(params.nodesObj[params.nodeId].summary_fields.job);
|
||||
}
|
||||
if(params.nodesObj[params.nodeId].summary_fields) {
|
||||
if(params.nodesObj[params.nodeId].summary_fields.job) {
|
||||
treeNode.job = _.clone(params.nodesObj[params.nodeId].summary_fields.job);
|
||||
}
|
||||
|
||||
if(params.nodesObj[params.nodeId].summary_fields.unified_job_template) {
|
||||
treeNode.unifiedJobTemplate = _.clone(params.nodesObj[params.nodeId].summary_fields.unified_job_template);
|
||||
if(params.nodesObj[params.nodeId].summary_fields.unified_job_template) {
|
||||
treeNode.unifiedJobTemplate = _.clone(params.nodesObj[params.nodeId].summary_fields.unified_job_template);
|
||||
}
|
||||
}
|
||||
|
||||
// Loop across the success nodes and add them recursively
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user