diff --git a/awx/ui/client/src/system-tracking/system-tracking.partial.html b/awx/ui/client/src/system-tracking/system-tracking.partial.html index 6667ba87dd..f920a0fdee 100644 --- a/awx/ui/client/src/system-tracking/system-tracking.partial.html +++ b/awx/ui/client/src/system-tracking/system-tracking.partial.html @@ -1,7 +1,7 @@

- 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."

@@ -57,7 +57,7 @@ The two fact scans were identical for this module.

- 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."

run") + "

" + 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'", text: i18n._('Prompt on launch'), ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)' }, @@ -90,7 +87,6 @@ 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'", text: i18n._('Prompt on launch') }, ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)' @@ -100,7 +96,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 +117,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 +472,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 +488,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 14041b1a85..2deac3e27c 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 @@ -144,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/'; @@ -173,30 +167,7 @@ } }; - 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(); - } - } sync_playbook_select2(); }; @@ -395,14 +366,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; } @@ -440,11 +406,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 56117cfb24..a3d78189a6 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,30 +126,7 @@ 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(); - } - } sync_playbook_select2(); }; @@ -529,12 +500,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 +541,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, diff --git a/awx/ui/client/src/templates/job_templates/factories/callback-help-init.factory.js b/awx/ui/client/src/templates/job_templates/factories/callback-help-init.factory.js index e9018dd182..5f7f6318d6 100644 --- a/awx/ui/client/src/templates/job_templates/factories/callback-help-init.factory.js +++ b/awx/ui/client/src/templates/job_templates/factories/callback-help-init.factory.js @@ -133,10 +133,6 @@ export default scope.can_edit = data.summary_fields.user_capabilities.edit; - if (scope.job_type.value === "scan" && (!scope.project || scope.project === "") && (!scope.playbook || scope.playbook === "")) { - scope.resetProjectToDefault(); - } - scope.$emit('jobTemplateLoaded', data.related.cloud_credential, master); }) .error(function (data, status) {