Files
awx/awx/ui_next/src/components/LaunchPrompt/steps/usePreviewStep.jsx
Alex Corey 20231041e6 Adds Node Modal Promptability
Adds steps for NodeType, RunType, Inventory, Credentials, updates Reducers, adds API calls, adds Add functionality to Visualizer;

Adds other prompt step

Adds SurveyStep

refactors add node functionality
2020-12-16 09:45:59 -05:00

41 lines
876 B
JavaScript

import React from 'react';
import { t } from '@lingui/macro';
import PreviewStep from './PreviewStep';
const STEP_ID = 'preview';
export default function usePreviewStep(
config,
i18n,
resource,
survey,
hasErrors,
needsPreviewStep
) {
const showStep = needsPreviewStep && resource && Object.keys(config).length > 0;
return {
step: showStep
? {
id: STEP_ID,
key: 7,
name: i18n._(t`Preview`),
component: (
<PreviewStep
config={config}
resource={resource}
survey={survey}
formErrors={hasErrors}
/>
),
enableNext: !hasErrors,
nextButtonText: i18n._(t`Launch`),
}
: null,
initialValues: {},
validate: () => ({}),
isReady: true,
error: null,
setTouched: () => {},
};
}