From c485d3f3d10a8773d8e91048f7debc1ce3c185a5 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 1 Jun 2015 14:11:36 -0400 Subject: [PATCH] No surveys for scan job templates hiding the survey checkboxes, and setting 'survey_enabled' to false for scan job template saves --- awx/ui/static/js/controllers/JobTemplates.js | 15 ++++++++++----- awx/ui/static/js/forms/JobTemplates.js | 15 +++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 7904a6fbda..d4316a6c56 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name controllers.function:JobTemplate @@ -417,8 +417,6 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $ $scope.jobTypeChange = function(){ if($scope.job_type){ if($scope.job_type.value === 'scan'){ - // $scope.project_name = 'Default'; - // $scope.project = null; $scope.toggleScanInfo(); } else if($scope.project_name === "Default"){ @@ -614,6 +612,10 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $ }); }); + // users can't save a survey with a scan job + if($scope.job_type.value === "scan" && $scope.survey_enabled === true){ + $scope.survey_enabled = false; + } if($scope.survey_enabled === true && $scope.survey_exists!==true){ // $scope.$emit("PromptForSurvey"); @@ -732,8 +734,6 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $scope.jobTypeChange = function(){ if($scope.job_type){ if($scope.job_type.value === 'scan'){ - // $scope.project_name = 'Default'; - // $scope.project = null; $scope.toggleScanInfo(); } else if($scope.project_name === "Default"){ @@ -742,6 +742,7 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, // $scope.playbook = 'null'; $scope.job_templates_form.playbook.$setPristine(); } + } }; @@ -1109,6 +1110,10 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, }); }); + // users can't save a survey with a scan job + if($scope.job_type.value === "scan" && $scope.survey_enabled === true){ + $scope.survey_enabled = false; + } if($scope.survey_enabled === true && $scope.survey_exists!==true){ // $scope.$emit("PromptForSurvey"); diff --git a/awx/ui/static/js/forms/JobTemplates.js b/awx/ui/static/js/forms/JobTemplates.js index 0d89949602..9416a69881 100644 --- a/awx/ui/static/js/forms/JobTemplates.js +++ b/awx/ui/static/js/forms/JobTemplates.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name forms.function:JobTemplate @@ -114,17 +114,6 @@ export default dataPlacement: 'right', dataContainer: "body", }, - // default_scan: { - // label: "Use default scan job project and playbook", - // type: 'checkbox', - // ngChange: 'toggleScanInfo()', - // ngShow: 'job_type.value === "scan" && project_name !== "Default"', - // column: 1, - // awPopOver: "

Scan jobs templates use a default project and default playbook. Uncheck this box to override these defaults.

", - // dataTitle: 'Scan jobs', - // dataPlacement: 'right', - // dataContainer: "body" - // }, default_scan: { type: 'custom', column: 1, @@ -263,6 +252,7 @@ export default editRequird: false, awFeature: 'surveys', ngChange: "surveyEnabled()", + ngHide: "job_type.value === 'scan'", column: 2, awPopOver: "

If checked, user will be prompted at job launch with a series of questions related to the job.

", dataPlacement: 'right', @@ -272,6 +262,7 @@ export default create_survey: { type: 'custom', column: 2, + ngHide: "job_type.value === 'scan'" , control: ''+ ''+ ''+