diff --git a/awx/ui/static/js/forms.js b/awx/ui/static/js/forms.js index 031b77e5a4..7f619d8d39 100644 --- a/awx/ui/static/js/forms.js +++ b/awx/ui/static/js/forms.js @@ -28,7 +28,6 @@ import Permissions from "tower/forms/Permissions"; import ProjectStatus from "tower/forms/ProjectStatus"; import Projects from "tower/forms/Projects"; import Source from "tower/forms/Source"; -import SurveyMaker from "tower/forms/SurveyMaker"; import SurveyQuestion from "tower/forms/SurveyQuestion"; import Teams from "tower/forms/Teams"; import Users from "tower/forms/Users"; @@ -59,7 +58,6 @@ export ProjectStatus, Projects, Source, - SurveyMaker, SurveyQuestion, Teams, Users diff --git a/awx/ui/static/js/forms/SurveyMaker.js b/awx/ui/static/js/forms/SurveyMaker.js deleted file mode 100644 index 3565d045c4..0000000000 --- a/awx/ui/static/js/forms/SurveyMaker.js +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:SurveyMaker - * @description This form is for adding/editing a survey -*/ - -export default - angular.module('SurveyMakerFormDefinition', []) - .value('SurveyMakerForm', { - - addTitle: 'Add Survey', //Title in add mode - editTitle: 'Edit Survey', //Title in edit mode - name: 'survey_maker', //entity or model name in singular form - // // well: true, - breadCrumbs: false, - - - fields: { - survey_name: { - type: 'custom', - control: '
'+ - // '
- //
'+ - // ' - //
'+ - // ''+ - // '
Please enter a survey name.
'+ - // '
'+ - // '
'+ - // '
'+ - // '
'+ - // ''+ - // '
'+ - // '
'+ - '
'+ - ''+ - '
'+ - '
'+ - ''+ - '
'+ - '
'+ - '
'//' - // label: 'Survey Name', - // type: 'text', - // addRequired: true, - // editRequired: true, - // capitalize: false, - // // column: 1 - }, - - }, - - // buttons: { //for now always generates '+ + ''+ + ''+ + ''+ '
The answer is shorter than the minimium length. Please make the answer longer.
' + '
The answer is longer than the maximum length. Please make the answer shorter.
' + '
'+ @@ -305,7 +295,7 @@ export default }, submit_question: { ngClick: 'submitQuestion($event)', - ngDisabled: true, //'survey_question.$valid', //"!question_name || !variable || !type || ((type.type==='multiplechoice' || type.type === 'multiselect' ) && !choices)", //|| type.type===multiselect ',//'!question_name || !variable || !type' , + ngDisabled: true, 'class': 'btn btn-sm btn-primary', label: 'Add Question' } diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 30cf5cacf7..c45573cb9e 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name helpers.function:JobSubmission @@ -517,6 +517,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm, checked, min, max, survey_url = GetBasePath('job_templates') + id + '/survey_spec/' ; + //for toggling the input on password inputs + scope.toggleInput = function(id) { + var buttonId = id + "_show_input_button", + inputId = id, + buttonInnerHTML = $(buttonId).html(); + if (buttonInnerHTML.indexOf("ABC") > -1) { + $(buttonId).html(""); + $(inputId).attr("type", "text"); + } else { + $(buttonId).html("ABC"); + $(inputId).attr("type", "password"); + } + }; + function buildHtml(question, index){ question.index = index; question.question_name = $filter('sanitize')(question.question_name); @@ -526,8 +540,10 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm, requiredAsterisk = (question.required===true) ? "prepend-asterisk" : ""; requiredClasses = (question.required===true) ? "ng-pristine ng-invalid-required ng-invalid" : ""; - html+='
'; - html += '\n'; + html+='
'; + html += ''; + + // html += '\n'; if(!Empty(question.question_description)){ html += '
'+question.question_description+'
\n'; @@ -571,28 +587,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm, if(question.type === 'password' ){ minlength = (!Empty(question.min)) ? Number(question.min) : ""; maxlength =(!Empty(question.max)) ? Number(question.max) : "" ; - html+=''+ - '
Please enter an answer.
'+ - '
Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.
'+ - '
'; - html+=''+ - '
Please enter an answer.
'+ - '
Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.
'+ - '
'; - html+= ''; - + html+= '
'+ + ''+ + ''+ + ''+ + ''+ + '
'+ + '
Please enter an answer.
'+ + '
Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.
'+ + '
'; } if(question.type === 'multiplechoice'){ choices = question.choices.split(/\n/); diff --git a/awx/ui/static/js/helpers/Survey.js b/awx/ui/static/js/helpers/Survey.js index 5e740ea7c4..cbd67d0904 100644 --- a/awx/ui/static/js/helpers/Survey.js +++ b/awx/ui/static/js/helpers/Survey.js @@ -3,7 +3,7 @@ * * All Rights Reserved *************************************************/ - + /** * @ngdoc function * @name helpers.function:Survey @@ -285,7 +285,10 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', } required = (question.required===true) ? "prepend-asterisk" : ""; - html = '
'+question.question_name+'
\n'; + html = '
'; + html += ''; + html += '
'; + if(!Empty(question.question_description)){ html += '
'+question.question_description+'
\n'; } @@ -326,12 +329,16 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', if(question.type === 'password'){ defaultValue = (question.default) ? question.default : ""; - defaultValue = $filter('defaultValue')(choices[i]); + defaultValue = $filter('sanitize')(defaultValue); defaultValue = scope.serialize(defaultValue); html+='
'+ - '
'+ - ''+ - '
'; + '
'+ + ''+ + ''+ + ''+ + ''+ + '
'+ + '
'; } if(question.type === 'integer'){ @@ -925,7 +932,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', } //set the data.default depending on which type - if (scope.type.type === 'text') { + if (scope.type.type === 'text' || scope.type.type === 'multiplechoice') { data.default = scope.default; } else if (scope.type.type === 'textarea') { data.default = scope.default_textarea; @@ -985,7 +992,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', scope.resetForm = function(){ html = '
'+ '
'+ - ''+ + ''+ '
'+ '
'+ ''+ @@ -1027,5 +1034,19 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', } }; + //for toggling the input on password inputs + scope.toggleInput = function(id) { + var buttonId = id + "_show_input_button", + inputId = id, + buttonInnerHTML = $(buttonId).html(); + if (buttonInnerHTML.indexOf("ABC") > -1) { + $(buttonId).html(""); + $(inputId).attr("type", "text"); + } else { + $(buttonId).html("ABC"); + $(inputId).attr("type", "password"); + } + }; + }; }]); diff --git a/awx/ui/static/less/survey-maker.less b/awx/ui/static/less/survey-maker.less index 5a95056463..cc8b5971fa 100644 --- a/awx/ui/static/less/survey-maker.less +++ b/awx/ui/static/less/survey-maker.less @@ -37,10 +37,13 @@ border-top: 1px dashed; border-color: rgb(204,204,204); border-radius: 4px; - padding: 5px; position: relative; + .survey-maker-password{ + margin-left: 30px; + } + .final{ margin-left: 15px; margin-top: 5px; @@ -87,13 +90,3 @@ .survey_taker_description{ margin-bottom:10px } - - - - - - - - - -