From 31333bf63b322e51e01f00a6910d483e705d9f95 Mon Sep 17 00:00:00 2001
From: Marliana Lara
" +
i18n.sprintf(i18n._("Setting the type to %s will not execute the playbook."), "check") + " " +
i18n.sprintf(i18n._("Instead, %s will check playbook " +
- " syntax, test environment setup and report problems."), "ansible") + "
" + - i18n.sprintf(i18n._("Setting the type to %s will execute the playbook and store any " + - " scanned facts for use with Tower's System Tracking feature."), "scan") + "
", + " syntax, test environment setup and report problems."), "ansible") + " ",
dataTitle: i18n._('Job Type'),
dataPlacement: 'right',
dataContainer: "body",
subCheckbox: {
variable: 'ask_job_type_on_launch',
- ngShow: "!job_type.value || job_type.value !== 'scan'",
+ ngShow: true,
text: i18n._('Prompt on launch'),
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
},
@@ -90,7 +88,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
subCheckbox: {
variable: 'ask_inventory_on_launch',
ngChange: 'job_template_form.inventory_name.$validate()',
- ngShow: "!job_type.value || job_type.value !== 'scan'",
+ ngShow: true,
text: i18n._('Prompt on launch')
},
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
@@ -100,7 +98,6 @@ function(NotificationsList, CompletedJobsList, i18n) {
labelAction: {
label: i18n._('RESET'),
ngClick: 'resetProjectToDefault()',
- 'class': "{{!(job_type.value === 'scan' && project_name !== 'Default') ? 'hidden' : ''}}",
},
type: 'lookup',
list: 'ProjectList',
@@ -122,7 +119,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
label: i18n._('Playbook'),
type:'select',
ngOptions: 'book for book in playbook_options track by book',
- ngDisabled: "(job_type.value === 'scan' && project_name === 'Default') || !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || disablePlaybookBecausePermissionDenied",
+ ngDisabled: "!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate) || disablePlaybookBecausePermissionDenied",
id: 'playbook-select',
awRequiredWhen: {
reqExpression: "playbookrequired",
@@ -477,13 +474,13 @@ function(NotificationsList, CompletedJobsList, i18n) {
view_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
- ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && survey_exists && !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
+ ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && !(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
label: i18n._('View Survey'),
class: 'Form-primaryButton'
},
add_survey: {
ngClick: 'addSurvey()',
- ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && !survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
+ ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && !survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
awFeature: 'surveys',
awToolTip: '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.',
dataPlacement: 'top',
@@ -493,7 +490,7 @@ function(NotificationsList, CompletedJobsList, i18n) {
edit_survey: {
ngClick: 'editSurvey()',
awFeature: 'surveys',
- ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && job_type.value !== "scan" && survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
+ ngShow: '($state.is(\'templates.addJobTemplate\') || $state.is(\'templates.editJobTemplate\')) && survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)',
label: i18n._('Edit Survey'),
class: 'Form-primaryButton'
}
diff --git a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
index 735dc4d421..037e4e320c 100644
--- a/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
+++ b/awx/ui/client/src/templates/job_templates/add-job-template/job-template-add.controller.js
@@ -80,24 +80,6 @@
}
$scope.job_type = $scope.job_type_options[form.fields.job_type.default];
- // if you're getting to the form from the scan job section on inventories,
- // set the job type select to be scan
- if ($stateParams.inventory_id) {
- // This means that the job template form was accessed via inventory prop's
- // This also means the job is a scan job.
- $scope.job_type.value = 'scan';
- $scope.jobTypeChange();
- $scope.inventory = $stateParams.inventory_id;
- Rest.setUrl(GetBasePath('inventory') + $stateParams.inventory_id + '/');
- Rest.get()
- .success(function (data) {
- $scope.inventory_name = data.name;
- })
- .error(function (data, status) {
- ProcessErrors($scope, data, status, form, { hdr: 'Error!',
- msg: 'Failed to lookup inventory: ' + data.id + '. GET returned status: ' + status });
- });
- }
CreateSelect2({
element:'#job_template_job_type',
multiple: false
@@ -162,13 +144,7 @@
// Update playbook select whenever project value changes
selectPlaybook = function (oldValue, newValue) {
var url;
- if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
- $scope.playbook_options = ['Default'];
- $scope.playbook = 'Default';
- sync_playbook_select2();
- Wait('stop');
- }
- else if (oldValue !== newValue) {
+ if (oldValue !== newValue) {
if ($scope.project) {
Wait('start');
url = GetBasePath('projects') + $scope.project + '/playbooks/';
@@ -191,29 +167,12 @@
}
};
- let last_non_scan_project_name = null;
- let last_non_scan_playbook = "";
- let last_non_scan_playbook_options = [];
$scope.jobTypeChange = function() {
- if ($scope.job_type) {
- if ($scope.job_type.value === 'scan') {
- if ($scope.project_name !== "Default") {
- last_non_scan_project_name = $scope.project_name;
- last_non_scan_playbook = $scope.playbook;
- last_non_scan_playbook_options = $scope.playbook_options;
- }
- // If the job_type is 'scan' then we don't want the user to be
- // able to prompt for job type or inventory
- $scope.ask_job_type_on_launch = false;
- $scope.ask_inventory_on_launch = false;
- $scope.resetProjectToDefault();
- }
- else if ($scope.project_name === "Default") {
- $scope.project_name = last_non_scan_project_name;
- $scope.playbook_options = last_non_scan_playbook_options;
- $scope.playbook = last_non_scan_playbook;
- $scope.job_template_form.playbook.$setPristine();
- }
+ if ($scope.job_type && $scope.project_name === "Default") {
+ $scope.project_name = null;
+ $scope.playbook_options = [];
+ $scope.playbook = "";
+ $scope.job_template_form.playbook.$setPristine();
}
sync_playbook_select2();
};
@@ -402,14 +361,9 @@
var fld, data = {};
$scope.invalid_survey = false;
- // users can't save a survey with a scan job
- if($scope.job_type.value === "scan" &&
- $scope.survey_enabled === true){
- $scope.survey_enabled = false;
- }
// Can't have a survey enabled without a survey
if($scope.survey_enabled === true &&
- $scope.survey_exists!==true){
+ $scope.survey_exists !== true){
$scope.survey_enabled = false;
}
@@ -447,11 +401,7 @@
data.extra_vars = ToJSON($scope.parseType,
$scope.variables, true);
- if(data.job_type === 'scan' &&
- $scope.default_scan === true){
- data.project = "";
- data.playbook = "";
- }
+
// We only want to set the survey_enabled flag to
// true for this job template if a survey exists
// and it's been enabled. By default,
diff --git a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js
index eff695a1f1..e6d39a057e 100644
--- a/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js
+++ b/awx/ui/client/src/templates/job_templates/edit-job-template/job-template-edit.controller.js
@@ -86,13 +86,7 @@ export default
$scope.playbook_options = [$scope.playbook];
}
- if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){
- $scope.playbook_options = ['Default'];
- $scope.playbook = 'Default';
- sync_playbook_select2();
- Wait('stop');
- }
- else if (!Empty(project)) {
+ if (!Empty(project)) {
url = GetBasePath('projects') + project + '/playbooks/';
Wait('start');
Rest.setUrl(url);
@@ -132,29 +126,12 @@ export default
}
};
- let last_non_scan_project_name = null;
- let last_non_scan_playbook = "";
- let last_non_scan_playbook_options = [];
$scope.jobTypeChange = function() {
- if ($scope.job_type) {
- if ($scope.job_type.value === 'scan') {
- if ($scope.project_name !== "Default") {
- last_non_scan_project_name = $scope.project_name;
- last_non_scan_playbook = $scope.playbook;
- last_non_scan_playbook_options = $scope.playbook_options;
- }
- // If the job_type is 'scan' then we don't want the user to be
- // able to prompt for job type or inventory
- $scope.ask_job_type_on_launch = false;
- $scope.ask_inventory_on_launch = false;
- $scope.resetProjectToDefault();
- }
- else if ($scope.project_name === "Default") {
- $scope.project_name = last_non_scan_project_name;
- $scope.playbook_options = last_non_scan_playbook_options;
- $scope.playbook = last_non_scan_playbook;
- $scope.job_template_form.playbook.$setPristine();
- }
+ if ($scope.job_type && $scope.project_name === "Default") {
+ $scope.project_name = null;
+ $scope.playbook_options = [];
+ $scope.playbook = "";
+ $scope.job_template_form.playbook.$setPristine();
}
sync_playbook_select2();
};
@@ -529,12 +506,7 @@ export default
$scope.formSave = function () {
var fld, data = {};
$scope.invalid_survey = false;
-
- // users can't save a survey with a scan job
- if($scope.job_type.value === "scan" &&
- $scope.survey_enabled === true){
- $scope.survey_enabled = false;
- }
+
// Can't have a survey enabled without a survey
if($scope.survey_enabled === true &&
$scope.survey_exists!==true){
@@ -575,11 +547,7 @@ export default
data.extra_vars = ToJSON($scope.parseType,
$scope.variables, true);
- if(data.job_type === 'scan' &&
- $scope.default_scan === true){
- data.project = "";
- data.playbook = "";
- }
+
// We only want to set the survey_enabled flag to
// true for this job template if a survey exists
// and it's been enabled. By default,
From cd46aeb4ece96ba6efcd39df9f30ea9270e405d8 Mon Sep 17 00:00:00 2001
From: Marliana Lara
- To set up scan jobs, create a job template of type 'scan' that targets the "{{inventory.name}}" inventory.
+ To set up scan jobs, create a job template that targets the "{{inventory.name}}" inventory and check "Store Ansible Facts."
- We were not able to find any facts collected for this inventory or module. To setup or run scan jobs, edit the "{{inventory.name}}" inventory and select "Scan Job Templates." + We were not able to find any facts collected for this inventory or module. To setup or run scan jobs, edit the "{{inventory.name}}" inventory and check "Store Ansible Facts."
" +
i18n.sprintf(i18n._("Setting the type to %s will not execute the playbook."), "check") + " " +
i18n.sprintf(i18n._("Instead, %s will check playbook " +
- " syntax, test environment setup and report problems."), "ansible") + "
",
+ " syntax, test environment setup and report problems."), "ansible") + "