mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 14:39:30 -02:30
Show all wf options when node is not a root node
* Edge type of root node is always "always" * If node is not a root node, show all options: always, success, fail * Remove edge conflict logic
This commit is contained in:
@@ -112,7 +112,6 @@ function TemplatesStrings (BaseString) {
|
|||||||
RUN: t.s('RUN'),
|
RUN: t.s('RUN'),
|
||||||
CHECK: t.s('CHECK'),
|
CHECK: t.s('CHECK'),
|
||||||
SELECT: t.s('SELECT'),
|
SELECT: t.s('SELECT'),
|
||||||
EDGE_CONFLICT: t.s('EDGE CONFLICT'),
|
|
||||||
DELETED: t.s('DELETED'),
|
DELETED: t.s('DELETED'),
|
||||||
START: t.s('START'),
|
START: t.s('START'),
|
||||||
DETAILS: t.s('DETAILS'),
|
DETAILS: t.s('DETAILS'),
|
||||||
|
|||||||
@@ -102,13 +102,6 @@
|
|||||||
width: 90px;
|
width: 90px;
|
||||||
color: @default-interface-txt;
|
color: @default-interface-txt;
|
||||||
}
|
}
|
||||||
.WorkflowChart-conflictIcon {
|
|
||||||
color: @default-err;
|
|
||||||
}
|
|
||||||
.WorkflowChart-conflictText {
|
|
||||||
width: 90px;
|
|
||||||
color: @default-interface-txt;
|
|
||||||
}
|
|
||||||
.WorkflowChart-activeNode {
|
.WorkflowChart-activeNode {
|
||||||
fill: @default-link;
|
fill: @default-link;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,16 +327,6 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
|||||||
return (d.unifiedJobTemplate && d.unifiedJobTemplate.name) ? d.unifiedJobTemplate.name : "";
|
return (d.unifiedJobTemplate && d.unifiedJobTemplate.name) ? d.unifiedJobTemplate.name : "";
|
||||||
}).each(wrap);
|
}).each(wrap);
|
||||||
|
|
||||||
thisNode.append("foreignObject")
|
|
||||||
.attr("x", 54)
|
|
||||||
.attr("y", 45)
|
|
||||||
.style("font-size","0.7em")
|
|
||||||
.attr("class", "WorkflowChart-conflictText")
|
|
||||||
.html(function () {
|
|
||||||
return `<span class=\"WorkflowChart-conflictIcon\">\uf06a</span><span> ${TemplatesStrings.get('workflow_maker.EDGE_CONFLICT')}</span>`;
|
|
||||||
})
|
|
||||||
.style("display", function(d) { return (d.edgeConflict && !d.placeholder) ? null : "none"; });
|
|
||||||
|
|
||||||
thisNode.append("foreignObject")
|
thisNode.append("foreignObject")
|
||||||
.attr("x", 62)
|
.attr("x", 62)
|
||||||
.attr("y", 22)
|
.attr("y", 22)
|
||||||
@@ -831,9 +821,6 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
|||||||
t.selectAll(".WorkflowChart-deletedText")
|
t.selectAll(".WorkflowChart-deletedText")
|
||||||
.style("display", function(d){ return d.unifiedJobTemplate || d.placeholder ? "none" : null; });
|
.style("display", function(d){ return d.unifiedJobTemplate || d.placeholder ? "none" : null; });
|
||||||
|
|
||||||
t.selectAll(".WorkflowChart-conflictText")
|
|
||||||
.style("display", function(d) { return (d.edgeConflict && !d.placeholder) ? null : "none"; });
|
|
||||||
|
|
||||||
t.selectAll(".WorkflowChart-activeNode")
|
t.selectAll(".WorkflowChart-activeNode")
|
||||||
.style("display", function(d) { return d.isActiveEdit ? null : "none"; });
|
.style("display", function(d) { return d.isActiveEdit ? null : "none"; });
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
export default ['$scope', 'WorkflowService', 'TemplatesService',
|
||||||
'$state', 'ProcessErrors', 'CreateSelect2', '$q', 'JobTemplateModel',
|
'ProcessErrors', 'CreateSelect2', '$q', 'JobTemplateModel',
|
||||||
'Empty', 'PromptService', 'Rest', 'TemplatesStrings', '$timeout',
|
'Empty', 'PromptService', 'Rest', 'TemplatesStrings', '$timeout',
|
||||||
'i18n',
|
'i18n',
|
||||||
function($scope, WorkflowService, GetBasePath, TemplatesService,
|
function ($scope, WorkflowService, TemplatesService,
|
||||||
$state, ProcessErrors, CreateSelect2, $q, JobTemplate,
|
ProcessErrors, CreateSelect2, $q, JobTemplate,
|
||||||
Empty, PromptService, Rest, TemplatesStrings, $timeout, i18n) {
|
Empty, PromptService, Rest, TemplatesStrings, $timeout, i18n) {
|
||||||
|
|
||||||
let promptWatcher, surveyQuestionWatcher, credentialsWatcher;
|
let promptWatcher, surveyQuestionWatcher, credentialsWatcher;
|
||||||
@@ -31,12 +31,19 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
value: "check"
|
value: "check"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
$scope.edgeFlags = {
|
$scope.edgeTypeOptions = createEdgeTypeOptions();
|
||||||
conflict: false
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.edgeTypeOptions = [
|
let editRequests = [];
|
||||||
{
|
let associateRequests = [];
|
||||||
|
let disassociateRequests = [];
|
||||||
|
let credentialRequests = [];
|
||||||
|
|
||||||
|
$scope.showKey = false;
|
||||||
|
$scope.toggleKey = () => $scope.showKey = !$scope.showKey;
|
||||||
|
$scope.keyClassList = `{ 'Key-menuIcon--active': showKey }`;
|
||||||
|
|
||||||
|
function createEdgeTypeOptions() {
|
||||||
|
return ([{
|
||||||
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
||||||
value: 'always'
|
value: 'always'
|
||||||
},
|
},
|
||||||
@@ -48,16 +55,8 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
label: $scope.strings.get('workflow_maker.ON_FAILURE'),
|
label: $scope.strings.get('workflow_maker.ON_FAILURE'),
|
||||||
value: 'failure'
|
value: 'failure'
|
||||||
}
|
}
|
||||||
];
|
]);
|
||||||
|
}
|
||||||
let editRequests = [];
|
|
||||||
let associateRequests = [];
|
|
||||||
let disassociateRequests = [];
|
|
||||||
let credentialRequests = [];
|
|
||||||
|
|
||||||
$scope.showKey = false;
|
|
||||||
$scope.toggleKey = () => $scope.showKey = !$scope.showKey;
|
|
||||||
$scope.keyClassList = `{ 'Key-menuIcon--active': showKey }`;
|
|
||||||
|
|
||||||
function resetNodeForm() {
|
function resetNodeForm() {
|
||||||
$scope.workflowMakerFormConfig.nodeMode = "idle";
|
$scope.workflowMakerFormConfig.nodeMode = "idle";
|
||||||
@@ -297,44 +296,15 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let updateEdgeDropdownOptions = (optionsToInclude) => {
|
let updateEdgeDropdownOptions = (edgeTypeValue) => {
|
||||||
// Not passing optionsToInclude will include all by default
|
// Not passing an edgeTypeValue will include all by default
|
||||||
if (!optionsToInclude) {
|
|
||||||
$scope.edgeTypeOptions = [
|
|
||||||
{
|
|
||||||
label: i18n._('Always'),
|
|
||||||
value: 'always'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: i18n._('On Success'),
|
|
||||||
value: 'success'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: i18n._('On Failure'),
|
|
||||||
value: 'failure'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$scope.edgeTypeOptions = [];
|
|
||||||
|
|
||||||
optionsToInclude.forEach((optionToInclude) => {
|
if (edgeTypeValue) {
|
||||||
if (optionToInclude === "always") {
|
$scope.edgeTypeOptions = _.filter(createEdgeTypeOptions(), {
|
||||||
$scope.edgeTypeOptions.push({
|
'value': edgeTypeValue
|
||||||
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
|
||||||
value: 'always'
|
|
||||||
});
|
|
||||||
} else if (optionToInclude === "success") {
|
|
||||||
$scope.edgeTypeOptions.push({
|
|
||||||
label: $scope.strings.get('workflow_maker.ON_SUCCESS'),
|
|
||||||
value: 'success'
|
|
||||||
});
|
|
||||||
} else if (optionToInclude === "failure") {
|
|
||||||
$scope.edgeTypeOptions.push({
|
|
||||||
label: $scope.strings.get('workflow_maker.ON_FAILURE'),
|
|
||||||
value: 'failure'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$scope.edgeTypeOptions = createEdgeTypeOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateSelect2({
|
CreateSelect2({
|
||||||
@@ -434,10 +404,16 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
$q.all(associatePromises.concat(credentialPromises))
|
$q.all(associatePromises.concat(credentialPromises))
|
||||||
.then(function () {
|
.then(function () {
|
||||||
$scope.closeDialog();
|
$scope.closeDialog();
|
||||||
}).catch(({data, status}) => {
|
}).catch(({
|
||||||
|
data,
|
||||||
|
status
|
||||||
|
}) => {
|
||||||
ProcessErrors($scope, data, status, null, {});
|
ProcessErrors($scope, data, status, null, {});
|
||||||
});
|
});
|
||||||
}).catch(({data, status}) => {
|
}).catch(({
|
||||||
|
data,
|
||||||
|
status
|
||||||
|
}) => {
|
||||||
ProcessErrors($scope, data, status, null, {});
|
ProcessErrors($scope, data, status, null, {});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -481,34 +457,22 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
|
|
||||||
$scope.treeData.nextIndex++;
|
$scope.treeData.nextIndex++;
|
||||||
|
|
||||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
|
||||||
tree: $scope.treeData.data,
|
|
||||||
parentId: betweenTwoNodes ? parent.source.id : parent.id,
|
|
||||||
childId: $scope.placeholderNode.id
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set the default to success
|
// Set the default to success
|
||||||
let edgeType = {label: $scope.strings.get('workflow_maker.ON_SUCCESS'), value: "success"};
|
let edgeType = {
|
||||||
|
label: $scope.strings.get('workflow_maker.ON_SUCCESS'),
|
||||||
|
value: "success"
|
||||||
|
};
|
||||||
|
|
||||||
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
||||||
// We don't want to give the user the option to select
|
// This node will always be executed
|
||||||
// a type as this node will always be executed
|
updateEdgeDropdownOptions('always');
|
||||||
updateEdgeDropdownOptions(["always"]);
|
edgeType = {
|
||||||
edgeType = {label: $scope.strings.get('workflow_maker.ALWAYS'), value: "always"};
|
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
||||||
} else {
|
value: "always"
|
||||||
if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
};
|
||||||
updateEdgeDropdownOptions(["success", "failure"]);
|
|
||||||
edgeType = {label: $scope.strings.get('workflow_maker.ON_SUCCESS'), value: "success"};
|
|
||||||
} else if (_.includes(siblingConnectionTypes, "always")) {
|
|
||||||
updateEdgeDropdownOptions(["always"]);
|
|
||||||
edgeType = {label: $scope.strings.get('workflow_maker.ALWAYS'), value: "always"};
|
|
||||||
} else {
|
} else {
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the edgeConflict flag
|
|
||||||
resetEdgeConflict();
|
|
||||||
|
|
||||||
$scope.edgeType = edgeType;
|
$scope.edgeType = edgeType;
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
$scope.$broadcast("refreshWorkflowChart");
|
||||||
@@ -565,9 +529,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
|
|
||||||
$scope.promptData = null;
|
$scope.promptData = null;
|
||||||
|
|
||||||
// Reset the edgeConflict flag
|
|
||||||
resetEdgeConflict();
|
|
||||||
|
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
$scope.$broadcast("refreshWorkflowChart");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -598,9 +559,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
$scope.selectedTemplateInvalid = false;
|
$scope.selectedTemplateInvalid = false;
|
||||||
$scope.showPromptButton = false;
|
$scope.showPromptButton = false;
|
||||||
|
|
||||||
// Reset the edgeConflict flag
|
|
||||||
resetEdgeConflict();
|
|
||||||
|
|
||||||
// Reset the form
|
// Reset the form
|
||||||
resetNodeForm();
|
resetNodeForm();
|
||||||
|
|
||||||
@@ -855,32 +813,30 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||||
}
|
}
|
||||||
|
|
||||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
|
||||||
tree: $scope.treeData.data,
|
|
||||||
parentId: parent.id,
|
|
||||||
childId: nodeToEdit.id
|
|
||||||
});
|
|
||||||
|
|
||||||
let edgeDropdownOptions = null;
|
let edgeDropdownOptions = null;
|
||||||
|
|
||||||
|
// Select RUN dropdown option
|
||||||
switch ($scope.nodeBeingEdited.edgeType) {
|
switch ($scope.nodeBeingEdited.edgeType) {
|
||||||
case "always":
|
case "always":
|
||||||
$scope.edgeType = {label: i18n._("Always"), value: "always"};
|
$scope.edgeType = {
|
||||||
if (siblingConnectionTypes.length === 1 && _.includes(siblingConnectionTypes, "always") || $scope.nodeBeingEdited.isRoot) {
|
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
||||||
edgeDropdownOptions = ["always"];
|
value: "always"
|
||||||
|
};
|
||||||
|
if ($scope.nodeBeingEdited.isRoot) {
|
||||||
|
edgeDropdownOptions = 'always';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "success":
|
case "success":
|
||||||
$scope.edgeType = {label: i18n._("On Success"), value: "success"};
|
$scope.edgeType = {
|
||||||
if (siblingConnectionTypes.length !== 0 && (!_.includes(siblingConnectionTypes, "always"))) {
|
label: $scope.strings.get('workflow_maker.ON_SUCCESS'),
|
||||||
edgeDropdownOptions = ["success", "failure"];
|
value: "success"
|
||||||
}
|
};
|
||||||
break;
|
break;
|
||||||
case "failure":
|
case "failure":
|
||||||
$scope.edgeType = {label: i18n._("On Failure"), value: "failure"};
|
$scope.edgeType = {
|
||||||
if (siblingConnectionTypes.length !== 0 && (!_.includes(siblingConnectionTypes, "always"))) {
|
label: $scope.strings.get('workflow_maker.ON_FAILURE'),
|
||||||
edgeDropdownOptions = ["success", "failure"];
|
value: "failure"
|
||||||
}
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,93 +905,54 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
resetNodeForm();
|
resetNodeForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the edgeConflict flag
|
|
||||||
resetEdgeConflict();
|
|
||||||
|
|
||||||
resetDeleteNode();
|
resetDeleteNode();
|
||||||
|
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
$scope.$broadcast("refreshWorkflowChart");
|
||||||
|
|
||||||
if ($scope.placeholderNode) {
|
if ($scope.placeholderNode) {
|
||||||
let edgeType = {label: "On Success", value: "success"};
|
let edgeType = {
|
||||||
if ($scope.placeholderNode.isRoot) {
|
label: $scope.strings.get('workflow_maker.ON_SUCCESS'),
|
||||||
updateEdgeDropdownOptions(["always"]);
|
value: "success"
|
||||||
edgeType = {label: "Always", value: "always"};
|
};
|
||||||
} else {
|
|
||||||
// we need to update the possible edges based on any new siblings
|
|
||||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
|
||||||
tree: $scope.treeData.data,
|
|
||||||
parentId: $scope.placeholderNode.parent.id,
|
|
||||||
childId: $scope.placeholderNode.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (
|
if ($scope.placeholderNode.isRoot) {
|
||||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
updateEdgeDropdownOptions('always');
|
||||||
!_.includes(siblingConnectionTypes, "always")
|
edgeType = {
|
||||||
) {
|
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
||||||
updateEdgeDropdownOptions(["success", "failure"]);
|
value: "always"
|
||||||
} else if (
|
};
|
||||||
_.includes(siblingConnectionTypes, "always") &&
|
|
||||||
!_.includes(siblingConnectionTypes, "success") &&
|
|
||||||
!_.includes(siblingConnectionTypes, "failure")
|
|
||||||
) {
|
|
||||||
updateEdgeDropdownOptions(["always"]);
|
|
||||||
edgeType = {label: "Always", value: "always"};
|
|
||||||
} else {
|
} else {
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
$scope.edgeType = edgeType;
|
$scope.edgeType = edgeType;
|
||||||
} else if ($scope.nodeBeingEdited) {
|
} else if ($scope.nodeBeingEdited) {
|
||||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
|
||||||
tree: $scope.treeData.data,
|
|
||||||
parentId: $scope.nodeBeingEdited.parent.id,
|
|
||||||
childId: $scope.nodeBeingEdited.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
|
||||||
updateEdgeDropdownOptions(["success", "failure"]);
|
|
||||||
} else if (_.includes(siblingConnectionTypes, "always") && $scope.nodeBeingEdited.edgeType === "always") {
|
|
||||||
updateEdgeDropdownOptions(["always"]);
|
|
||||||
} else {
|
|
||||||
updateEdgeDropdownOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($scope.nodeBeingEdited.edgeType) {
|
switch ($scope.nodeBeingEdited.edgeType) {
|
||||||
case "always":
|
case "always":
|
||||||
$scope.edgeType = {label: i18n._("Always"), value: "always"};
|
$scope.edgeType = {
|
||||||
if (
|
label: $scope.strings.get('workflow_maker.ALWAYS'),
|
||||||
_.includes(siblingConnectionTypes, "always") &&
|
value: "always"
|
||||||
!_.includes(siblingConnectionTypes, "success") &&
|
};
|
||||||
!_.includes(siblingConnectionTypes, "failure")
|
if ($scope.nodeBeingEdited.isRoot) {
|
||||||
) {
|
updateEdgeDropdownOptions('always');
|
||||||
updateEdgeDropdownOptions(["always"]);
|
|
||||||
} else {
|
} else {
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "success":
|
case "success":
|
||||||
$scope.edgeType = {label: i18n._("On Success"), value: "success"};
|
$scope.edgeType = {
|
||||||
if (
|
label: $scope.strings.get('workflow_maker.ON_SUCCESS'),
|
||||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
value: "success"
|
||||||
!_.includes(siblingConnectionTypes, "always")
|
};
|
||||||
) {
|
|
||||||
updateEdgeDropdownOptions(["success", "failure"]);
|
|
||||||
} else {
|
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "failure":
|
case "failure":
|
||||||
$scope.edgeType = {label: i18n._("On Failure"), value: "failure"};
|
$scope.edgeType = {
|
||||||
if (
|
label: $scope.strings.get('workflow_maker.ON_FAILURE'),
|
||||||
(_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) &&
|
value: "failure"
|
||||||
!_.includes(siblingConnectionTypes, "always")
|
};
|
||||||
) {
|
|
||||||
updateEdgeDropdownOptions(["success", "failure"]);
|
|
||||||
} else {
|
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1168,15 +1085,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function resetEdgeConflict(){
|
|
||||||
$scope.edgeFlags.conflict = false;
|
|
||||||
|
|
||||||
WorkflowService.checkForEdgeConflicts({
|
|
||||||
treeData: $scope.treeData.data,
|
|
||||||
edgeFlags: $scope.edgeFlags
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.toggleManualControls = function () {
|
$scope.toggleManualControls = function () {
|
||||||
$scope.showManualControls = !$scope.showManualControls;
|
$scope.showManualControls = !$scope.showManualControls;
|
||||||
};
|
};
|
||||||
@@ -1261,6 +1169,5 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
getNodes();
|
getNodes();
|
||||||
|
|
||||||
updateEdgeDropdownOptions();
|
updateEdgeDropdownOptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="WorkflowMaker-buttonHolder">
|
<div class="WorkflowMaker-buttonHolder">
|
||||||
<button type="button" class="btn btn-sm WorkflowMaker-cancelButton" ng-click="closeWorkflowMaker()"> {{:: strings.get('CLOSE') }}</button>
|
<button type="button" class="btn btn-sm WorkflowMaker-cancelButton" ng-click="closeWorkflowMaker()"> {{:: strings.get('CLOSE') }}</button>
|
||||||
<button type="button" class="btn btn-sm WorkflowMaker-saveButton" ng-click="saveWorkflowMaker()" ng-show="workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate" ng-disabled="edgeFlags.conflict || workflowMakerFormConfig.nodeMode === 'add'"> {{:: strings.get('SAVE') }}</button>
|
<button type="button" class="btn btn-sm WorkflowMaker-saveButton" ng-click="saveWorkflowMaker()" ng-show="workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate" ng-disabled="workflowMakerFormConfig.nodeMode === 'add'"> {{:: strings.get('SAVE') }}</button>
|
||||||
</div>
|
</div>
|
||||||
<prompt prompt-data="promptData" action-text="{{:: strings.get('prompt.CONFIRM')}}" prevent-creds-with-passwords="preventCredsWithPasswords" read-only-prompts="!(workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)"></prompt>
|
<prompt prompt-data="promptData" action-text="{{:: strings.get('prompt.CONFIRM')}}" prevent-creds-with-passwords="preventCredsWithPasswords" read-only-prompts="!(workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)"></prompt>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -290,39 +290,5 @@ export default ['$q', function($q){
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
checkForEdgeConflicts: function(params) {
|
|
||||||
//params.treeData
|
|
||||||
//params.edgeFlags
|
|
||||||
|
|
||||||
let hasAlways = false;
|
|
||||||
let hasSuccessFailure = false;
|
|
||||||
let _this = this;
|
|
||||||
|
|
||||||
_.forEach(params.treeData.children, function(child) {
|
|
||||||
// Flip the flag to false for now - we'll set it to true later on
|
|
||||||
// if we detect a conflict
|
|
||||||
child.edgeConflict = false;
|
|
||||||
if(child.edgeType === 'always') {
|
|
||||||
hasAlways = true;
|
|
||||||
}
|
|
||||||
else if(child.edgeType === 'success' || child.edgeType === 'failure') {
|
|
||||||
hasSuccessFailure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.checkForEdgeConflicts({
|
|
||||||
treeData: child,
|
|
||||||
edgeFlags: params.edgeFlags
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if(hasAlways && hasSuccessFailure) {
|
|
||||||
// We have a conflict
|
|
||||||
_.forEach(params.treeData.children, function(child) {
|
|
||||||
child.edgeConflict = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
params.edgeFlags.conflict = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user