mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 03:17:38 -02:30
Merge pull request #6795 from jaredevantabor/skip-tags-job-tags
Skip tags job tags
This commit is contained in:
@@ -50,12 +50,20 @@ export default
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scope.ask_tags_on_launch && scope.other_prompt_data && typeof scope.other_prompt_data.job_tags === 'string'){
|
if(scope.ask_tags_on_launch && scope.other_prompt_data && Array.isArray(scope.other_prompt_data.job_tags)){
|
||||||
job_launch_data.job_tags = scope.other_prompt_data.job_tags;
|
scope.job_tags = _.map(scope.job_tags, function(i){return i.value;});
|
||||||
|
$("#job_launch_job_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
scope.job_tags.push(option.title);
|
||||||
|
});
|
||||||
|
job_launch_data.job_tags = (Array.isArray(scope.job_tags)) ? _.uniq(scope.job_tags).join() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scope.ask_skip_tags_on_launch && scope.other_prompt_data && typeof scope.other_prompt_data.skip_tags === 'string'){
|
if(scope.ask_skip_tags_on_launch && scope.other_prompt_data && Array.isArray(scope.other_prompt_data.skip_tags)){
|
||||||
job_launch_data.skip_tags = scope.other_prompt_data.skip_tags;
|
scope.skip_tags = _.map(scope.skip_tags, function(i){return i.value;});
|
||||||
|
$("#job_launch_skip_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
scope.skip_tags.push(option.title);
|
||||||
|
});
|
||||||
|
job_launch_data.skip_tags = (Array.isArray(scope.skip_tags)) ? _.uniq(scope.skip_tags).join() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scope.ask_limit_on_launch && scope.other_prompt_data && scope.other_prompt_data.limit){
|
if(scope.ask_limit_on_launch && scope.other_prompt_data && scope.other_prompt_data.limit){
|
||||||
|
|||||||
@@ -219,11 +219,15 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($scope.ask_tags_on_launch) {
|
if($scope.ask_tags_on_launch) {
|
||||||
$scope.other_prompt_data.job_tags = (data.defaults && data.defaults.job_tags) ? data.defaults.job_tags : "";
|
$scope.other_prompt_data.job_tags_options = (data.defaults && data.defaults.job_tags) ? data.defaults.job_tags.split(',')
|
||||||
|
.map((i) => ({name: i, label: i, value: i})) : [];
|
||||||
|
$scope.other_prompt_data.job_tags = $scope.other_prompt_data.job_tags_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.ask_skip_tags_on_launch) {
|
if($scope.ask_skip_tags_on_launch) {
|
||||||
$scope.other_prompt_data.skip_tags = (data.defaults && data.defaults.skip_tags) ? data.defaults.skip_tags : "";
|
$scope.other_prompt_data.skip_tags_options = (data.defaults && data.defaults.skip_tags) ? data.defaults.skip_tags.split(',')
|
||||||
|
.map((i) => ({name: i, label: i, value: i})) : [];
|
||||||
|
$scope.other_prompt_data.skip_tags = $scope.other_prompt_data.skip_tags_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.ask_variables_on_launch) {
|
if($scope.ask_variables_on_launch) {
|
||||||
|
|||||||
@@ -61,6 +61,18 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseT
|
|||||||
placeholder: i18n._('Select a credential')
|
placeholder: i18n._('Select a credential')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#job_launch_job_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#job_launch_skip_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
|
|
||||||
if(scope.step === 'otherprompts' && scope.ask_variables_on_launch) {
|
if(scope.step === 'otherprompts' && scope.ask_variables_on_launch) {
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
|
|||||||
@@ -214,7 +214,16 @@
|
|||||||
<span class="Form-inputLabel" translate>Job Tags</span>
|
<span class="Form-inputLabel" translate>Job Tags</span>
|
||||||
</label>
|
</label>
|
||||||
<div>
|
<div>
|
||||||
<textarea rows="5" ng-model="other_prompt_data.job_tags" name="tags" class="form-control Form-textArea Form-textInput"></textarea>
|
<select
|
||||||
|
id="job_launch_job_tags"
|
||||||
|
ng-options="v.label for v in other_prompt_data.job_tags_options track by v.value"
|
||||||
|
ng-model="other_prompt_data.job_tags"
|
||||||
|
class="form-control Form-dropDown"
|
||||||
|
name="verbosity"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-hidden="true"
|
||||||
|
multiple>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ask_skip_tags_on_launch">
|
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ask_skip_tags_on_launch">
|
||||||
@@ -222,7 +231,17 @@
|
|||||||
<span class="Form-inputLabel" translate>Skip Tags</span>
|
<span class="Form-inputLabel" translate>Skip Tags</span>
|
||||||
</label>
|
</label>
|
||||||
<div>
|
<div>
|
||||||
<textarea rows="5" ng-model="other_prompt_data.skip_tags" name="skip_tags" class="form-control Form-textArea Form-textInput"></textarea>
|
<!-- <textarea rows="5" ng-model="other_prompt_data.skip_tags" name="skip_tags" class="form-control Form-textArea Form-textInput"></textarea> -->
|
||||||
|
<select
|
||||||
|
id="job_launch_skip_tags"
|
||||||
|
ng-options="v.label for v in other_prompt_data.skip_tags_options track by v.value"
|
||||||
|
ng-model="other_prompt_data.skip_tags"
|
||||||
|
class="form-control Form-dropDown"
|
||||||
|
name="verbosity"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-hidden="true"
|
||||||
|
multiple>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -89,6 +89,17 @@
|
|||||||
element:'#job_template_verbosity',
|
element:'#job_template_verbosity',
|
||||||
multiple: false
|
multiple: false
|
||||||
});
|
});
|
||||||
|
CreateSelect2({
|
||||||
|
element:'#job_template_job_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element:'#job_template_skip_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -260,6 +271,8 @@
|
|||||||
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
||||||
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
||||||
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
||||||
|
data.job_tags = (Array.isArray($scope.job_tags)) ? $scope.job_tags.join() : "";
|
||||||
|
data.skip_tags = (Array.isArray($scope.skip_tags)) ? $scope.skip_tags.join() : "";
|
||||||
if ($scope.selectedCredentials && $scope.selectedCredentials
|
if ($scope.selectedCredentials && $scope.selectedCredentials
|
||||||
.machine && $scope.selectedCredentials
|
.machine && $scope.selectedCredentials
|
||||||
.machine) {
|
.machine) {
|
||||||
@@ -296,6 +309,19 @@
|
|||||||
.filter("[data-label-is-present=true]")
|
.filter("[data-label-is-present=true]")
|
||||||
.map((i, val) => ({name: $(val).text()}));
|
.map((i, val) => ({name: $(val).text()}));
|
||||||
|
|
||||||
|
$scope.job_tags = _.map($scope.job_tags, function(i){return i.value;});
|
||||||
|
$("#job_template_job_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
$scope.job_tags.push(option.title);
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.skip_tags = _.map($scope.skip_tags, function(i){return i.value;});
|
||||||
|
$("#job_template_skip_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
$scope.skip_tags.push(option.title);
|
||||||
|
});
|
||||||
|
|
||||||
|
data.job_tags = (Array.isArray($scope.job_tags)) ? _.uniq($scope.job_tags).join() : "";
|
||||||
|
data.skip_tags = (Array.isArray($scope.skip_tags)) ? _.uniq($scope.skip_tags).join() : "";
|
||||||
|
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ export default
|
|||||||
$scope.instance_groups = InstanceGroupsData;
|
$scope.instance_groups = InstanceGroupsData;
|
||||||
$scope.credentialNotPresent = false;
|
$scope.credentialNotPresent = false;
|
||||||
$scope.surveyTooltip = i18n._('Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.');
|
$scope.surveyTooltip = i18n._('Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.');
|
||||||
|
$scope.job_tag_options = [];
|
||||||
|
$scope.skip_tag_options = [];
|
||||||
|
|
||||||
SurveyControllerInit({
|
SurveyControllerInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -175,6 +177,18 @@ export default
|
|||||||
element:'#playbook-select',
|
element:'#playbook-select',
|
||||||
multiple: false
|
multiple: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element:'#job_template_job_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
|
|
||||||
|
CreateSelect2({
|
||||||
|
element:'#job_template_skip_tags',
|
||||||
|
multiple: true,
|
||||||
|
addNew: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.jobTypeChange = function() {
|
$scope.jobTypeChange = function() {
|
||||||
@@ -469,6 +483,8 @@ export default
|
|||||||
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
||||||
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
||||||
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
||||||
|
data.job_tags = (Array.isArray($scope.job_tags)) ? $scope.job_tags.join() : "";
|
||||||
|
data.skip_tags = (Array.isArray($scope.skip_tags)) ? $scope.skip_tags.join() : "";
|
||||||
if ($scope.selectedCredentials && $scope.selectedCredentials
|
if ($scope.selectedCredentials && $scope.selectedCredentials
|
||||||
.machine && $scope.selectedCredentials
|
.machine && $scope.selectedCredentials
|
||||||
.machine) {
|
.machine) {
|
||||||
@@ -505,6 +521,20 @@ export default
|
|||||||
.filter("[data-label-is-present=true]")
|
.filter("[data-label-is-present=true]")
|
||||||
.map((i, val) => ({name: $(val).text()}));
|
.map((i, val) => ({name: $(val).text()}));
|
||||||
|
|
||||||
|
$scope.job_tags = _.map($scope.job_tags, function(i){return i.value;});
|
||||||
|
$("#job_template_job_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
$scope.job_tags.push(option.title);
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.skip_tags = _.map($scope.skip_tags, function(i){return i.value;});
|
||||||
|
$("#job_template_skip_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
|
||||||
|
$scope.skip_tags.push(option.title);
|
||||||
|
});
|
||||||
|
|
||||||
|
data.job_tags = (Array.isArray($scope.job_tags)) ? _.uniq($scope.job_tags).join() : "";
|
||||||
|
data.skip_tags = (Array.isArray($scope.skip_tags)) ? _.uniq($scope.skip_tags).join() : "";
|
||||||
|
|
||||||
|
|
||||||
Rest.setUrl(defaultUrl + $state.params.job_template_id);
|
Rest.setUrl(defaultUrl + $state.params.job_template_id);
|
||||||
Rest.put(data)
|
Rest.put(data)
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
|
|||||||
@@ -113,6 +113,16 @@ export default
|
|||||||
scope.ask_skip_tags_on_launch = (data.ask_skip_tags_on_launch) ? true : false;
|
scope.ask_skip_tags_on_launch = (data.ask_skip_tags_on_launch) ? true : false;
|
||||||
master.ask_skip_tags_on_launch = scope.ask_skip_tags_on_launch;
|
master.ask_skip_tags_on_launch = scope.ask_skip_tags_on_launch;
|
||||||
|
|
||||||
|
scope.job_tag_options = (data.job_tags) ? data.job_tags.split(',')
|
||||||
|
.map((i) => ({name: i, label: i, value: i})) : [];
|
||||||
|
scope.job_tags = scope.job_tag_options;
|
||||||
|
master.job_tags = scope.job_tags;
|
||||||
|
|
||||||
|
scope.skip_tag_options = (data.skip_tags) ? data.skip_tags.split(',')
|
||||||
|
.map((i) => ({name: i, label: i, value: i})) : [];
|
||||||
|
scope.skip_tags = scope.skip_tag_options;
|
||||||
|
master.skip_tags = scope.skip_tags;
|
||||||
|
|
||||||
scope.ask_job_type_on_launch = (data.ask_job_type_on_launch) ? true : false;
|
scope.ask_job_type_on_launch = (data.ask_job_type_on_launch) ? true : false;
|
||||||
master.ask_job_type_on_launch = scope.ask_job_type_on_launch;
|
master.ask_job_type_on_launch = scope.ask_job_type_on_launch;
|
||||||
|
|
||||||
|
|||||||
@@ -212,9 +212,10 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
},
|
},
|
||||||
job_tags: {
|
job_tags: {
|
||||||
label: i18n._('Job Tags'),
|
label: i18n._('Job Tags'),
|
||||||
type: 'textarea',
|
type: 'select',
|
||||||
rows: 5,
|
multiSelect: true,
|
||||||
'elementClass': 'Form-textInput',
|
'elementClass': 'Form-textInput',
|
||||||
|
ngOptions: 'tag.label for tag in job_tag_options track by tag.value',
|
||||||
column: 2,
|
column: 2,
|
||||||
awPopOver: "<p>" + i18n._("Provide a comma separated list of tags.") + "</p>\n" +
|
awPopOver: "<p>" + i18n._("Provide a comma separated list of tags.") + "</p>\n" +
|
||||||
"<p>" + i18n._("Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.") + "</p>" +
|
"<p>" + i18n._("Tags are useful when you have a large playbook, and you want to run a specific part of a play or task.") + "</p>" +
|
||||||
@@ -230,9 +231,10 @@ function(NotificationsList, CompletedJobsList, i18n) {
|
|||||||
},
|
},
|
||||||
skip_tags: {
|
skip_tags: {
|
||||||
label: i18n._('Skip Tags'),
|
label: i18n._('Skip Tags'),
|
||||||
type: 'textarea',
|
type: 'select',
|
||||||
rows: 5,
|
multiSelect: true,
|
||||||
'elementClass': 'Form-textInput',
|
'elementClass': 'Form-textInput',
|
||||||
|
ngOptions: 'tag.label for tag in skip_tag_options track by tag.value',
|
||||||
column: 2,
|
column: 2,
|
||||||
awPopOver: "<p>" + i18n._("Provide a comma separated list of tags.") + "</p>\n" +
|
awPopOver: "<p>" + i18n._("Provide a comma separated list of tags.") + "</p>\n" +
|
||||||
"<p>" + i18n._("Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task.") + "</p>" +
|
"<p>" + i18n._("Skip tags are useful when you have a large playbook, and you want to skip specific parts of a play or task.") + "</p>" +
|
||||||
|
|||||||
Reference in New Issue
Block a user