Use select for any/all convergence choice

This commit is contained in:
Jake McDermott 2020-01-21 13:31:05 -05:00 committed by Rebeccah
parent bbb4701fa9
commit 4fe9e5da14
3 changed files with 35 additions and 21 deletions

View File

@ -154,7 +154,9 @@ function TemplatesStrings (BaseString) {
TIMEOUT: t.s('Timeout'),
APPROVED: t.s('APPROVED'),
DENIED: t.s('DENIED'),
ALL_PARENTS_MUST_CONVERGE: t.s('All parents must converge before running'),
CONVERGENCE: t.s('Convergence'),
ALL: t.s('All'),
ANY: t.s('Any'),
};
}

View File

@ -106,6 +106,10 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
element: '#workflow_node_edge',
multiple: false
});
CreateSelect2({
element: '#workflow_node_convergence',
multiple: false
});
};
const formatPopOverDetails = (model) => {
@ -500,10 +504,22 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
type: 'workflow_job_template,job_template'
};
$scope.all_parents_must_converge = _.get(
const all_parents_must_converge = _.get(
$scope, ['nodeConfig', 'node', 'all_parents_must_converge'],
_.get($scope, ['nodeConfig', 'node', 'originalNodeObject', 'all_parents_must_converge'], false)
);
$scope.convergenceOptions = [
{
label: $scope.strings.get('workflow_maker.ALL'),
value: true,
},
{
label: $scope.strings.get('workflow_maker.ANY'),
value: false,
},
];
$scope.convergenceChoice = $scope.convergenceOptions.find(({ value }) => value === all_parents_must_converge);
$scope.wf_maker_templates = [];
$scope.wf_maker_template_dataset = {};
@ -622,7 +638,7 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
$scope.confirmNodeForm = () => {
const nodeFormData = {
edgeType: $scope.edgeType,
all_parents_must_converge: $scope.all_parents_must_converge,
all_parents_must_converge: $scope.convergenceChoice.value,
};
if ($scope.activeTab === "approval") {

View File

@ -183,26 +183,22 @@
</select>
</div>
</div>
<div id="workflow_node_checkbox_group" class="form-group Form-formGroup Form-formGroup--singleColumn" ng-show="!(nodeConfig.editNodeIsRoot || nodeConfig.newNodeIsRoot)">
<label class="Form-inputLabelContainer" for="checkbox_group">
<span translate class="Form-inputLabel">Options</span>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-show="!(nodeConfig.editNodeIsRoot || nodeConfig.newNodeIsRoot)">
<label for="edgeType" class="Form-inputLabelContainer">
<span class="Form-requiredAsterisk">*</span>
<span class="Form-inputLabel">{{:: strings.get('workflow_maker.CONVERGENCE') }}</span>
</label>
<div>
<div id="workflow_node_checkbox_group_chbox_group" class="checkbox-group">
<div class="form-check">
<label for="all_parents_must_converge" class="form-check-label">
<input
ng-disabled="readOnly"
id="workflow_node_all_parents_must_converge_checkbox"
class="form-check-input"
type="checkbox"
name="all_parents_must_converge"
ng-model="all_parents_must_converge"
/>
<span class="Form-inputLabel">{{:: strings.get('workflow_maker.ALL_PARENTS_MUST_CONVERGE') }}</span>
</label>
</div>
</div>
<select
id="workflow_node_convergence"
ng-options="v as v.label for v in convergenceOptions track by v.value"
ng-model="convergenceChoice"
class="form-control Form-dropDown"
name="convergenceChoice"
tabindex="-1"
ng-disabled="readOnly"
aria-hidden="true">
</select>
</div>
</div>
<div ng-show="readOnly">