mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 12:41:19 -03:30
Fixed several workflow prompting and edge type bugs
This commit is contained in:
parent
c98e7f6ecd
commit
982b83c2d3
@ -349,7 +349,7 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
||||
|
||||
let processed = PromptService.processSurveyQuestions({
|
||||
surveyQuestions: surveyQuestionRes.data.spec,
|
||||
extra_data: data.extra_data
|
||||
extra_data: _.cloneDeep(data.extra_data)
|
||||
});
|
||||
|
||||
$scope.missingSurveyValue = processed.missingSurveyValue;
|
||||
|
||||
@ -12,7 +12,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
Empty, PromptService, Rest) {
|
||||
|
||||
let form = WorkflowMakerForm();
|
||||
let promptWatcher;
|
||||
let promptWatcher, surveyQuestionWatcher;
|
||||
|
||||
$scope.workflowMakerFormConfig = {
|
||||
nodeMode: "idle",
|
||||
@ -549,6 +549,10 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
promptWatcher();
|
||||
}
|
||||
|
||||
if(surveyQuestionWatcher) {
|
||||
surveyQuestionWatcher();
|
||||
}
|
||||
|
||||
$scope.promptData = null;
|
||||
|
||||
// Reset the edgeConflict flag
|
||||
@ -572,6 +576,10 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
promptWatcher();
|
||||
}
|
||||
|
||||
if(surveyQuestionWatcher) {
|
||||
surveyQuestionWatcher();
|
||||
}
|
||||
|
||||
$scope.promptData = null;
|
||||
|
||||
// Reset the edgeConflict flag
|
||||
@ -692,7 +700,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
|
||||
let processed = PromptService.processSurveyQuestions({
|
||||
surveyQuestions: surveyQuestionRes.data.spec,
|
||||
extra_data: $scope.nodeBeingEdited.originalNodeObj.extra_data
|
||||
extra_data: _.cloneDeep($scope.nodeBeingEdited.originalNodeObj.extra_data)
|
||||
});
|
||||
|
||||
$scope.missingSurveyValue = processed.missingSurveyValue;
|
||||
@ -707,7 +715,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
template: $scope.nodeBeingEdited.unifiedJobTemplate.id
|
||||
};
|
||||
|
||||
$scope.$watch('promptData.surveyQuestions', () => {
|
||||
surveyQuestionWatcher = $scope.$watch('promptData.surveyQuestions', () => {
|
||||
let missingSurveyValue = false;
|
||||
_.each($scope.promptData.surveyQuestions, (question) => {
|
||||
if(question.required && (Empty(question.model) || question.model === [])) {
|
||||
@ -778,19 +786,19 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
switch($scope.nodeBeingEdited.edgeType) {
|
||||
case "always":
|
||||
$scope.edgeType = {label: "Always", value: "always"};
|
||||
if(siblingConnectionTypes.length === 0 || (siblingConnectionTypes.length === 1 && _.includes(siblingConnectionTypes, "always"))) {
|
||||
if(siblingConnectionTypes.length === 1 && _.includes(siblingConnectionTypes, "always")) {
|
||||
edgeDropdownOptions = ["always"];
|
||||
}
|
||||
break;
|
||||
case "success":
|
||||
$scope.edgeType = {label: "On Success", value: "success"};
|
||||
if(siblingConnectionTypes.length === 0 || (!_.includes(siblingConnectionTypes, "always"))) {
|
||||
if(siblingConnectionTypes.length !== 0 && (!_.includes(siblingConnectionTypes, "always"))) {
|
||||
edgeDropdownOptions = ["success", "failure"];
|
||||
}
|
||||
break;
|
||||
case "failure":
|
||||
$scope.edgeType = {label: "On Failure", value: "failure"};
|
||||
if(siblingConnectionTypes.length === 0 || (!_.includes(siblingConnectionTypes, "always"))) {
|
||||
if(siblingConnectionTypes.length !== 0 && (!_.includes(siblingConnectionTypes, "always"))) {
|
||||
edgeDropdownOptions = ["success", "failure"];
|
||||
}
|
||||
break;
|
||||
@ -869,9 +877,10 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
$scope.$broadcast("refreshWorkflowChart");
|
||||
|
||||
if($scope.placeholderNode) {
|
||||
let edgeType = "success";
|
||||
let edgeType = {label: "On Success", value: "success"};
|
||||
if($scope.placeholderNode.isRoot) {
|
||||
edgeType = "always";
|
||||
updateEdgeDropdownOptions(["always"]);
|
||||
edgeType = {label: "Always", value: "always"};
|
||||
}
|
||||
else {
|
||||
// we need to update the possible edges based on any new siblings
|
||||
@ -881,18 +890,24 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
childId: $scope.placeholderNode.id
|
||||
});
|
||||
|
||||
if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
||||
if (
|
||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
||||
!_.includes(siblingConnectionTypes, "always")
|
||||
) {
|
||||
updateEdgeDropdownOptions(["success", "failure"]);
|
||||
} else if (_.includes(siblingConnectionTypes, "always")) {
|
||||
} else if (
|
||||
_.includes(siblingConnectionTypes, "always") &&
|
||||
!_.includes(siblingConnectionTypes, "success") &&
|
||||
!_.includes(siblingConnectionTypes, "failure")
|
||||
) {
|
||||
updateEdgeDropdownOptions(["always"]);
|
||||
edgeType = "always";
|
||||
edgeType = {label: "Always", value: "always"};
|
||||
} else {
|
||||
updateEdgeDropdownOptions();
|
||||
}
|
||||
|
||||
}
|
||||
$scope.edgeType = edgeType;
|
||||
// $scope.$broadcast("setEdgeType", edgeType);
|
||||
}
|
||||
else if($scope.nodeBeingEdited) {
|
||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
||||
@ -912,12 +927,37 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
switch($scope.nodeBeingEdited.edgeType) {
|
||||
case "always":
|
||||
$scope.edgeType = {label: "Always", value: "always"};
|
||||
if (
|
||||
_.includes(siblingConnectionTypes, "always") &&
|
||||
!_.includes(siblingConnectionTypes, "success") &&
|
||||
!_.includes(siblingConnectionTypes, "failure")
|
||||
) {
|
||||
updateEdgeDropdownOptions(["always"]);
|
||||
} else {
|
||||
updateEdgeDropdownOptions();
|
||||
}
|
||||
break;
|
||||
case "success":
|
||||
$scope.edgeType = {label: "On Success", value: "success"};
|
||||
if (
|
||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
||||
!_.includes(siblingConnectionTypes, "always")
|
||||
) {
|
||||
updateEdgeDropdownOptions(["success", "failure"]);
|
||||
} else {
|
||||
updateEdgeDropdownOptions();
|
||||
}
|
||||
break;
|
||||
case "failure":
|
||||
$scope.edgeType = {label: "On Failure", value: "failure"};
|
||||
if (
|
||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
||||
!_.includes(siblingConnectionTypes, "always")
|
||||
) {
|
||||
updateEdgeDropdownOptions(["success", "failure"]);
|
||||
} else {
|
||||
updateEdgeDropdownOptions();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user