mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
Merge pull request #4811 from mabashian/4557-workflow-nodes-pagination
WFJT node pagination
This commit is contained in:
@@ -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);
|
Rest.setUrl(url);
|
||||||
return Rest.get();
|
return Rest.get();
|
||||||
},
|
},
|
||||||
getWorkflowJobTemplateNodes: function(id) {
|
getWorkflowJobTemplateNodes: function(id, page) {
|
||||||
var url = GetBasePath('workflow_job_templates');
|
var url = GetBasePath('workflow_job_templates');
|
||||||
|
|
||||||
url = url + id + '/workflow_nodes';
|
url = url + id + '/workflow_nodes';
|
||||||
|
|
||||||
|
if(page) {
|
||||||
|
url += '/?page=' + page;
|
||||||
|
}
|
||||||
|
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
return Rest.get();
|
return Rest.get();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -149,12 +149,12 @@
|
|||||||
$scope.url = workflowJobTemplateData.url;
|
$scope.url = workflowJobTemplateData.url;
|
||||||
$scope.survey_enabled = workflowJobTemplateData.survey_enabled;
|
$scope.survey_enabled = workflowJobTemplateData.survey_enabled;
|
||||||
|
|
||||||
// Get the workflow nodes
|
let allNodes = [];
|
||||||
TemplatesService.getWorkflowJobTemplateNodes(id)
|
let page = 1;
|
||||||
.then(function(data){
|
|
||||||
|
|
||||||
|
let buildTreeFromNodes = function(){
|
||||||
$scope.workflowTree = WorkflowService.buildTree({
|
$scope.workflowTree = WorkflowService.buildTree({
|
||||||
workflowNodes: data.data.results
|
workflowNodes: allNodes
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: I think that the workflow chart directive (and eventually d3) is meddling with
|
// 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.
|
// 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.
|
// It won't get included until this the tree has been built - I'm open to better ways of doing this.
|
||||||
$scope.includeWorkflowMaker = true;
|
$scope.includeWorkflowMaker = true;
|
||||||
|
};
|
||||||
|
|
||||||
}, function(error){
|
let getNodes = function(){
|
||||||
ProcessErrors($scope, error.data, error.status, form, {
|
// Get the workflow nodes
|
||||||
hdr: 'Error!',
|
TemplatesService.getWorkflowJobTemplateNodes(id, page)
|
||||||
msg: 'Failed to get workflow job template nodes. GET returned ' +
|
.then(function(data){
|
||||||
'status: ' + error.status
|
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){
|
}, function(error){
|
||||||
ProcessErrors($scope, error.data, error.status, form, {
|
ProcessErrors($scope, error.data, error.status, form, {
|
||||||
|
|||||||
@@ -49,14 +49,13 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr
|
|||||||
$scope.workflowMakerFormConfig.nodeMode = "idle";
|
$scope.workflowMakerFormConfig.nodeMode = "idle";
|
||||||
$scope.edgeFlags.showTypeOptions = false;
|
$scope.edgeFlags.showTypeOptions = false;
|
||||||
delete $scope.selectedTemplate;
|
delete $scope.selectedTemplate;
|
||||||
delete $scope.workflow_job_templates;
|
|
||||||
delete $scope.workflow_projects;
|
|
||||||
delete $scope.workflow_inventory_sources;
|
|
||||||
delete $scope.placeholderNode;
|
delete $scope.placeholderNode;
|
||||||
delete $scope.betweenTwoNodes;
|
delete $scope.betweenTwoNodes;
|
||||||
$scope.nodeBeingEdited = null;
|
$scope.nodeBeingEdited = null;
|
||||||
$scope.edgeFlags.typeRestriction = null;
|
$scope.edgeFlags.typeRestriction = null;
|
||||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||||
|
|
||||||
|
$scope.$broadcast('clearWorkflowLists');
|
||||||
}
|
}
|
||||||
|
|
||||||
function recursiveNodeUpdates(params, completionCallback) {
|
function recursiveNodeUpdates(params, completionCallback) {
|
||||||
|
|||||||
@@ -160,13 +160,13 @@ export default [function(){
|
|||||||
allNodeIds.push(node.id);
|
allNodeIds.push(node.id);
|
||||||
|
|
||||||
_.forEach(node.success_nodes, function(nodeId){
|
_.forEach(node.success_nodes, function(nodeId){
|
||||||
nonRootNodeIds.push(nodeId);
|
nonRootNodeIds.push(nodeId);
|
||||||
});
|
});
|
||||||
_.forEach(node.failure_nodes, function(nodeId){
|
_.forEach(node.failure_nodes, function(nodeId){
|
||||||
nonRootNodeIds.push(nodeId);
|
nonRootNodeIds.push(nodeId);
|
||||||
});
|
});
|
||||||
_.forEach(node.always_nodes, function(nodeId){
|
_.forEach(node.always_nodes, function(nodeId){
|
||||||
nonRootNodeIds.push(nodeId);
|
nonRootNodeIds.push(nodeId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -223,12 +223,14 @@ export default [function(){
|
|||||||
treeNode.originalParentId = params.parentId;
|
treeNode.originalParentId = params.parentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params.nodesObj[params.nodeId].summary_fields.job) {
|
if(params.nodesObj[params.nodeId].summary_fields) {
|
||||||
treeNode.job = _.clone(params.nodesObj[params.nodeId].summary_fields.job);
|
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) {
|
if(params.nodesObj[params.nodeId].summary_fields.unified_job_template) {
|
||||||
treeNode.unifiedJobTemplate = _.clone(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
|
// Loop across the success nodes and add them recursively
|
||||||
|
|||||||
Reference in New Issue
Block a user