diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx index e8171debe2..154f31a44d 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx @@ -8,10 +8,16 @@ import getSurveyValues from '../getSurveyValues'; function PreviewStep({ resource, config, survey, formErrors }) { const { values } = useFormikContext(); const surveyValues = getSurveyValues(values); - const passwordFields = survey.spec - .filter(q => q.type === 'password') - .map(q => q.variable); - const masked = maskPasswords(surveyValues, passwordFields); + let extraVars; + if (survey && survey.spec) { + const passwordFields = survey.spec + .filter(q => q.type === 'password') + .map(q => q.variable); + const masked = maskPasswords(surveyValues, passwordFields); + extraVars = yaml.safeDump(mergeExtraVars(values.extra_vars, masked)); + } else { + extraVars = values.extra_vars; + } return ( <> {formErrors && ( diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/useInventoryStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/useInventoryStep.jsx index e0d0ea009b..cd1deb76f7 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/useInventoryStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/useInventoryStep.jsx @@ -9,6 +9,9 @@ export default function useInventoryStep(config, resource, visitedSteps, i18n) { const [stepErrors, setStepErrors] = useState({}); const validate = values => { + if (!config.ask_inventory_on_launch) { + return {}; + } const errors = {}; if (!values.inventory) { errors.inventory = i18n._(t`An inventory must be selected`); diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx index 7cee7f7f6d..5ee623dd14 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/useSurveyStep.jsx @@ -56,7 +56,7 @@ export default function useSurveyStep(config, resource, visitedSteps, i18n) { isReady: !isLoading && !!survey, error, setTouched: setFieldsTouched => { - if (!survey) { + if (!survey || !survey.spec) { return; } const fields = {};