-
Notifications
You must be signed in to change notification settings - Fork 239
feat(compass-collection): Fill in the script screen of the Generate Mock Data modal flow CLOUDP-333859 #7296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
bd9abea
1e1e298
355976e
7d1369b
e577271
ebe5d91
5f2ae75
d1e8460
51920e7
16405b2
9ef8bbd
615c566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -23,6 +23,15 @@ import { | |||
| } from '../../modules/collection-tab'; | ||||
| import { default as SchemaConfirmationScreen } from './raw-schema-confirmation'; | ||||
| import FakerSchemaEditor from './faker-schema-editor'; | ||||
| import ScriptScreen from './script-screen'; | ||||
|
|
||||
| const STEP_TO_STEP_CONTENT: Record<MockDataGeneratorStep, React.JSX.Element> = { | ||||
| [MockDataGeneratorStep.SCHEMA_CONFIRMATION]: <SchemaConfirmationScreen />, | ||||
| [MockDataGeneratorStep.SCHEMA_EDITOR]: <FakerSchemaEditor />, | ||||
| [MockDataGeneratorStep.DOCUMENT_COUNT]: <></>, // TODO: Implement as part of CLOUDP-333856 | ||||
| [MockDataGeneratorStep.PREVIEW_DATA]: <></>, // TODO: Implement as part of CLOUDP-333857 | ||||
| [MockDataGeneratorStep.GENERATE_DATA]: <ScriptScreen />, | ||||
| }; | ||||
|
|
||||
| const footerStyles = css` | ||||
| flex-direction: row; | ||||
|
|
@@ -62,18 +71,9 @@ const MockDataGeneratorModal = ({ | |||
| } | ||||
| }; | ||||
|
|
||||
| let stepContent: React.ReactNode; | ||||
|
|
||||
| if (currentStep === MockDataGeneratorStep.SCHEMA_CONFIRMATION) { | ||||
| stepContent = <SchemaConfirmationScreen />; | ||||
| } | ||||
|
|
||||
| if (currentStep === MockDataGeneratorStep.SCHEMA_EDITOR) { | ||||
| stepContent = <FakerSchemaEditor />; | ||||
| } | ||||
|
|
||||
| return ( | ||||
| <Modal | ||||
| size="large" | ||||
| open={isOpen} | ||||
| setOpen={(open) => { | ||||
| if (!open) { | ||||
|
|
@@ -84,8 +84,9 @@ const MockDataGeneratorModal = ({ | |||
| > | ||||
| <ModalHeader title="Generate Mock Data" /> | ||||
| <ModalBody> | ||||
| {stepContent} | ||||
| <div data-testid={`generate-mock-data-step-${currentStep}`} /> | ||||
| <div data-testid={`generate-mock-data-step-${currentStep}`}> | ||||
| {STEP_TO_STEP_CONTENT[currentStep]} | ||||
|
||||
| const formContent = useMemo(() => { |
If we want to keep the Record approach, using functions would also work:
const STEP_TO_STEP_CONTENT: Record<MockDataGeneratorStep, React.JSX.Element> = {
[MockDataGeneratorStep.SCHEMA_CONFIRMATION]: () => <SchemaConfirmationScreen />,
[MockDataGeneratorStep.SCHEMA_EDITOR]: () => <FakerSchemaEditor />,
[MockDataGeneratorStep.DOCUMENT_COUNT]: () => <></>, // TODO: Implement as part of CLOUDP-333856
[MockDataGeneratorStep.PREVIEW_DATA]: () => <></>, // TODO: Implement as part of CLOUDP-333857
[MockDataGeneratorStep.GENERATE_DATA]: () => <ScriptScreen />,
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Went with the useMemo approach used in the linked code.
Uh oh!
There was an error while loading. Please reload this page.