Merge pull request #4369 from AlanCoding/workflow_limit

Implementation of WFJT limit & SCM_branch prompting

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-09-16 20:17:59 +00:00
committed by GitHub
22 changed files with 414 additions and 102 deletions

View File

@@ -58,8 +58,9 @@ function canLaunchWithoutPrompt () {
launchData.can_start_without_user_input &&
!launchData.ask_inventory_on_launch &&
!launchData.ask_variables_on_launch &&
!launchData.survey_enabled &&
!launchData.ask_limit_on_launch &&
!launchData.ask_scm_branch_on_launch &&
!launchData.survey_enabled &&
launchData.variables_needed_to_start.length === 0
);
}

View File

@@ -89,6 +89,34 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) {
},
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit) || !canEditInventory',
},
limit: {
label: i18n._('Limit'),
type: 'text',
column: 1,
awPopOver: "<p>" + i18n._("Provide a host pattern to further constrain the list of hosts that will be managed or affected by the workflow. This limit is applied to all job template nodes that prompt for a limit. Refer to Ansible documentation for more information and examples on patterns.") + "</p>",
dataTitle: i18n._('Limit'),
dataPlacement: 'right',
dataContainer: "body",
subCheckbox: {
variable: 'ask_limit_on_launch',
text: i18n._('Prompt on launch')
},
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit) || !canEditInventory',
},
scm_branch: {
label: i18n._('SCM Branch'),
type: 'text',
column: 1,
awPopOver: "<p>" + i18n._("Select a branch for the workflow. This branch is applied to all job template nodes that prompt for a branch.") + "</p>",
dataTitle: i18n._('SCM Branch'),
dataPlacement: 'right',
dataContainer: "body",
subCheckbox: {
variable: 'ask_scm_branch_on_launch',
text: i18n._('Prompt on launch')
},
ngDisabled: '!(workflow_job_template_obj.summary_fields.user_capabilities.edit || canAddOrEdit)',
},
labels: {
label: i18n._('Labels'),
type: 'select',

View File

@@ -70,9 +70,11 @@ export default [
data[fld] = $scope[fld];
}
}
data.ask_inventory_on_launch = Boolean($scope.ask_inventory_on_launch);
data.ask_variables_on_launch = Boolean($scope.ask_variables_on_launch);
data.ask_limit_on_launch = Boolean($scope.ask_limit_on_launch);
data.ask_scm_branch_on_launch = Boolean($scope.ask_scm_branch_on_launch);
data.extra_vars = ToJSON($scope.parseType,
$scope.variables, true);

View File

@@ -54,6 +54,8 @@ export default [
$scope.parseType = 'yaml';
$scope.includeWorkflowMaker = false;
$scope.ask_inventory_on_launch = workflowJobTemplateData.ask_inventory_on_launch;
$scope.ask_limit_on_launch = workflowJobTemplateData.ask_limit_on_launch;
$scope.ask_scm_branch_on_launch = workflowJobTemplateData.ask_scm_branch_on_launch;
$scope.ask_variables_on_launch = (workflowJobTemplateData.ask_variables_on_launch) ? true : false;
if (Inventory){
@@ -91,6 +93,8 @@ export default [
}
data.ask_inventory_on_launch = Boolean($scope.ask_inventory_on_launch);
data.ask_limit_on_launch = Boolean($scope.ask_limit_on_launch);
data.ask_scm_branch_on_launch = Boolean($scope.ask_scm_branch_on_launch);
data.ask_variables_on_launch = Boolean($scope.ask_variables_on_launch);
data.extra_vars = ToJSON($scope.parseType,

View File

@@ -69,7 +69,9 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
SLICE_TEMPLATE: i18n._('Slice Job Template'),
JOB_EXPLANATION: i18n._('Explanation'),
SOURCE_WORKFLOW_JOB: i18n._('Source Workflow'),
INVENTORY: i18n._('Inventory')
INVENTORY: i18n._('Inventory'),
LIMIT: i18n._('Inventory Limit'),
SCM_BRANCH: i18n._('SCM Branch')
},
details: {
HEADER: i18n._('DETAILS'),

View File

@@ -140,6 +140,26 @@
</div>
</div>
<!-- LIMIT -->
<div class="WorkflowResults-resultRow" ng-show="workflow.limit">
<label class="WorkflowResults-resultRowLabel">
{{ strings.labels.LIMIT }}
</label>
<div class="WorkflowResults-resultRowText">
{{ workflow.limit }}
</div>
</div>
<!-- BRANCH -->
<div class="WorkflowResults-resultRow" ng-show="workflow.scm_branch">
<label class="WorkflowResults-resultRowLabel">
{{ strings.labels.SCM_BRANCH }}
</label>
<div class="WorkflowResults-resultRowText">
{{ workflow.scm_branch }}
</div>
</div>
<!-- TEMPLATE DETAIL -->
<div class="WorkflowResults-resultRow"
ng-show="workflow.summary_fields.workflow_job_template.name">

View File

@@ -144,11 +144,15 @@ describe('Controller: WorkflowAdd', () => {
description: "This is a test description",
organization: undefined,
inventory: undefined,
limit: undefined,
scm_branch: undefined,
labels: undefined,
variables: undefined,
allow_simultaneous: undefined,
ask_inventory_on_launch: false,
ask_variables_on_launch: false,
ask_limit_on_launch: false,
ask_scm_branch_on_launch: false,
extra_vars: undefined
});
});