diff --git a/awx/ui_next/src/components/LaunchPrompt/LaunchPrompt.jsx b/awx/ui_next/src/components/LaunchPrompt/LaunchPrompt.jsx index 6727262cb8..8e89cf87b9 100644 --- a/awx/ui_next/src/components/LaunchPrompt/LaunchPrompt.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/LaunchPrompt.jsx @@ -16,7 +16,6 @@ function LaunchPrompt({ config, resource, onLaunch, onCancel, i18n }) { validate, visitStep, visitAllSteps, - // formErrors, contentError, } = useSteps(config, resource, i18n); diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/OtherPromptsStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/OtherPromptsStep.jsx index 1196e5998e..0989368652 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/OtherPromptsStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/OtherPromptsStep.jsx @@ -32,7 +32,6 @@ function OtherPromptsStep({ config, i18n }) { of hosts that will be managed or affected by the playbook. Multiple patterns are allowed. Refer to Ansible documentation for more information and examples on patterns.`)} - isRequired /> )} {config.ask_verbosity_on_launch && } diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx index d9120d95d1..ba33b8ec11 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/SurveyStep.jsx @@ -1,6 +1,6 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import { withI18n } from '@lingui/react'; -import { Formik, useField } from 'formik'; +import { useField } from 'formik'; import { Form, FormGroup, @@ -21,35 +21,6 @@ import { import { Survey } from '@types'; function SurveyStep({ survey, i18n }) { - const initialValues = {}; - survey.spec.forEach(question => { - if (question.type === 'multiselect') { - initialValues[question.variable] = question.default.split('\n'); - } else { - initialValues[question.variable] = question.default; - } - }); - - return ( - - ); -} -SurveyStep.propTypes = { - survey: Survey.isRequired, -}; - -// This is a nested Formik form to perform validation on individual -// survey questions. When changes to the inner form occur (onBlur), the -// values for all questions are added to the outer form's `survey` field -// as a single object. -function SurveySubForm({ survey, initialValues, i18n }) { - const [, , surveyFieldHelpers] = useField('survey'); - useEffect(() => { - // set survey initial values to parent form - surveyFieldHelpers.setValue(initialValues); - /* eslint-disable-next-line react-hooks/exhaustive-deps */ - }, []); - const fieldTypes = { text: TextField, textarea: TextField, @@ -60,21 +31,19 @@ function SurveySubForm({ survey, initialValues, i18n }) { float: NumberField, }; return ( - - {({ values }) => ( -
surveyFieldHelpers.setValue(values)}> - {' '} - {survey.spec.map(question => { - const Field = fieldTypes[question.type]; - return ( - - ); - })} - - )} -
+
+ {survey.spec.map(question => { + const Field = fieldTypes[question.type]; + return ( + + ); + })} + ); } +SurveyStep.propTypes = { + survey: Survey.isRequired, +}; function TextField({ question, i18n }) { const validators = [ @@ -85,7 +54,7 @@ function TextField({ question, i18n }) { return ( { const errMessage = validateField( question, - values[question.variable], + values[`survey_${question.variable}`], i18n ); if (errMessage) {