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'), TIMEOUT: t.s('Timeout'),
APPROVED: t.s('APPROVED'), APPROVED: t.s('APPROVED'),
DENIED: t.s('DENIED'), 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', element: '#workflow_node_edge',
multiple: false multiple: false
}); });
CreateSelect2({
element: '#workflow_node_convergence',
multiple: false
});
}; };
const formatPopOverDetails = (model) => { const formatPopOverDetails = (model) => {
@@ -500,10 +504,22 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
type: 'workflow_job_template,job_template' 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'], $scope, ['nodeConfig', 'node', 'all_parents_must_converge'],
_.get($scope, ['nodeConfig', 'node', 'originalNodeObject', 'all_parents_must_converge'], false) _.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_templates = [];
$scope.wf_maker_template_dataset = {}; $scope.wf_maker_template_dataset = {};
@@ -622,7 +638,7 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService
$scope.confirmNodeForm = () => { $scope.confirmNodeForm = () => {
const nodeFormData = { const nodeFormData = {
edgeType: $scope.edgeType, edgeType: $scope.edgeType,
all_parents_must_converge: $scope.all_parents_must_converge, all_parents_must_converge: $scope.convergenceChoice.value,
}; };
if ($scope.activeTab === "approval") { if ($scope.activeTab === "approval") {

View File

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