Fixed workflow bug deleting root parent while creating child

This commit is contained in:
mabashian 2017-08-07 12:45:32 -04:00
parent 2eaa00b633
commit 93dca5a317
4 changed files with 11 additions and 12 deletions

View File

@ -326,7 +326,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplates.
},
views: {
'modal': {
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate"></workflow-maker>`
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate" edge-type="edgeType"></workflow-maker>`
},
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
@ -620,9 +620,6 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplates.
});
});
$scope.$on('setEdgeType', function(e, edgeType) {
$scope.edgeType = edgeType;
});
}
]
}

View File

@ -365,12 +365,12 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
});
// Set the default to success
let edgeType = "success";
$scope.edgeType = "success";
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
// We don't want to give the user the option to select
// a type as this node will always be executed
edgeType = "always";
$scope.edgeType = "always";
$scope.edgeFlags.showTypeOptions = false;
} else {
if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
@ -378,10 +378,10 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
$scope.edgeFlags.typeRestriction = null;
} else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
$scope.edgeFlags.typeRestriction = "successFailure";
edgeType = "success";
$scope.edgeType = "success";
} else if (_.includes(siblingConnectionTypes, "always")) {
$scope.edgeFlags.typeRestriction = "always";
edgeType = "always";
$scope.edgeType = "always";
} else {
$scope.edgeFlags.typeRestriction = null;
}
@ -392,7 +392,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
// Reset the edgeConflict flag
resetEdgeConflict();
$scope.$broadcast("setEdgeType", edgeType);
$scope.$broadcast("refreshWorkflowChart");
};
@ -661,7 +660,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
$scope.edgeFlags.showTypeOptions = true;
}
$scope.$broadcast('setEdgeType', $scope.nodeBeingEdited.edgeType);
$scope.edgeType = $scope.nodeBeingEdited.edgeType;
$scope.$broadcast('templateSelected', {
presetValues: formValues,
@ -764,6 +763,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
if($scope.workflowMakerFormConfig.nodeMode === "add") {
if($scope.placeholderNode.isRoot) {
$scope.edgeType = "always";
$scope.edgeFlags.showTypeOptions = false;
}
}

View File

@ -11,7 +11,8 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
return {
scope: {
workflowJobTemplateObj: '=',
canAddWorkflowJobTemplate: '='
canAddWorkflowJobTemplate: '=',
edgeType: '='
},
restrict: 'E',
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),

View File

@ -74,7 +74,8 @@ export default ['$q', function($q){
canAddTo: true,
placeholder: true,
isNew: true,
edited: false
edited: false,
isRoot: params.parent.isStartNode ? true : false
};
let parentNode = (params.betweenTwoNodes) ? this.searchTree({element: params.tree, matchingId: params.parent.source.id}) : this.searchTree({element: params.tree, matchingId: params.parent.id});