-
Notifications
You must be signed in to change notification settings - Fork 231
feat(compass-collection): add Schema Editor UI - Mock Data Generator CLOUDP-333854 #7295
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 all commits
bd24caa
64ac4b0
24b1b1b
f8d3723
0269dbc
b73eeb2
fc8713f
37fda7f
cbe46b8
505627b
1258704
c9f3a29
a43ebf2
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { | ||
Banner, | ||
BannerVariant, | ||
Body, | ||
css, | ||
Option, | ||
palette, | ||
Select, | ||
spacing, | ||
} from '@mongodb-js/compass-components'; | ||
import React from 'react'; | ||
import { UNRECOGNIZED_FAKER_METHOD } from '../../modules/collection-tab'; | ||
|
||
const fieldMappingSelectorsStyles = css({ | ||
width: '50%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: spacing[200], | ||
}); | ||
|
||
const labelStyles = css({ | ||
color: palette.gray.dark1, | ||
fontWeight: 600, | ||
}); | ||
|
||
interface Props { | ||
activeJsonType: string; | ||
activeFakerFunction: string; | ||
onJsonTypeSelect: (jsonType: string) => void; | ||
onFakerFunctionSelect: (fakerFunction: string) => void; | ||
} | ||
|
||
const FakerMappingSelector = ({ | ||
activeJsonType, | ||
activeFakerFunction, | ||
onJsonTypeSelect, | ||
onFakerFunctionSelect, | ||
}: Props) => { | ||
return ( | ||
<div className={fieldMappingSelectorsStyles}> | ||
<Body className={labelStyles}>Mapping</Body> | ||
<Select | ||
label="JSON Type" | ||
allowDeselect={false} | ||
value={activeJsonType} | ||
onChange={onJsonTypeSelect} | ||
> | ||
{/* TODO(CLOUDP-344400) : Make the select input editable and render other options depending on the JSON type selected */} | ||
{[activeJsonType].map((type) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit hard to understand the scope of work from the ticket. Is that correct that there's actually no choice here? Is this work planned for later? If there's a follow-up work planned, we usually use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a |
||
<Option key={type} value={type}> | ||
{type} | ||
</Option> | ||
))} | ||
</Select> | ||
<Select | ||
label="Faker Function" | ||
allowDeselect={false} | ||
value={activeFakerFunction} | ||
onChange={onFakerFunctionSelect} | ||
> | ||
{/* TODO(CLOUDP-344400): Make the select input editable and render other JSON types */} | ||
{[activeFakerFunction].map((field) => ( | ||
<Option key={field} value={field}> | ||
{field} | ||
</Option> | ||
))} | ||
</Select> | ||
{activeFakerFunction === UNRECOGNIZED_FAKER_METHOD && ( | ||
<Banner variant={BannerVariant.Warning}> | ||
Please select a function or we will default fill this field with the | ||
string "Unrecognized" | ||
</Banner> | ||
)} | ||
{/* TODO(CLOUDP-344400): Render faker function parameters once we have a way to validate them. */} | ||
</div> | ||
); | ||
}; | ||
|
||
export default FakerMappingSelector; |
Uh oh!
There was an error while loading. Please reload this page.
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.
These select boxes allow to deselect the value, and as soon as I deselect it, the whole input control disappears and I can't select anything anymore, that's probably not an expected behavior?
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.
Addressed.