-
Notifications
You must be signed in to change notification settings - Fork 231
feat(compass-collection): Document Count Screen - Mock Data Generator CLOUDP-333856 #7381
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
base: main
Are you sure you want to change the base?
Conversation
73d67ae
to
a9b7f37
Compare
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.
Pull Request Overview
This PR adds a "Document Count Screen" to the mock data generator modal in the compass-collection package, allowing users to specify the number of documents to generate with estimated disk size calculation based on average document size from schema analysis.
- Implements document count input with validation (1-100,000 range) and error handling
- Integrates average document size from collection model into schema analysis state
- Adds estimated disk size calculation and display using the numeral library
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
stores/collection-tab.ts |
Adds collection model to Redux thunk extra arguments |
schema-analysis-types.ts |
Extends schema metadata type to include average document size |
modules/collection-tab.ts |
Updates schema analysis to capture and store average document size from collection model |
mock-data-generator-modal.tsx |
Integrates DocumentCountScreen component and adds validation logic for next button |
mock-data-generator-modal.spec.tsx |
Adds comprehensive test coverage for document count screen functionality |
document-count-screen.tsx |
Implements new document count input screen with disk size estimation |
constants.ts |
Defines default and maximum document count constants |
package.json |
Adds numeral dependency for byte formatting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/compass-collection/src/components/mock-data-generator-modal/document-count-screen.tsx
Outdated
Show resolved
Hide resolved
packages/compass-collection/src/components/mock-data-generator-modal/document-count-screen.tsx
Outdated
Show resolved
Hide resolved
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.
Nice work Nataly!
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.
Nothing blocking, a few suggestions that I think should make this a bit tighter, otherwise looks good
<Body className={descriptionStyles}> | ||
Indicate the amount of documents you want to generate below. | ||
<br /> | ||
Note: We have defaulted to {DEFAULT_DOCUMENT_COUNT}. |
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.
Super small nit: I know it's in the designs, but this "Note" here feels redundant, we already prefill the input with the default count, so doesn't seem to be a reason to spell it
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.
I agree fully, was going to flag this actually
import { connect } from 'react-redux'; | ||
import type { CollectionState } from '../../modules/collection-tab'; | ||
import type { SchemaAnalysisState } from '../../schema-analysis-types'; | ||
import numeral from 'numeral'; |
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.
Nit: instead of adding a dependency I would suggest to move the formatting helpers in https://github.com/mongodb-js/compass/blob/main/packages/databases-collections-list/src/format.ts to compass-components package, and use them here, this way we will have consistent formatting across the code
|
||
return schemaAnalysisState.status === 'complete' ? ( |
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.
Super duper nit: for readability it might be easier to short circuit here first, then return the form instead of using a ternary for the whole return statement
return schemaAnalysisState.status === 'complete' ? ( | |
if (schemaAnalysisState.status !== 'complete') { | |
return <div>We are analyzing your collection.</div> | |
} | |
// ... rest of the form |
/> | ||
<div> | ||
<Body className={boldStyles}>Estimated Disk Size</Body> | ||
<Body className={estimatedDiskSizeStyles}>{estimatedDiskSize}</Body> |
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.
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.
Thank you for the keen eye. We're basing off the designs for now and can bring this up with them
Description
This PR adds the "Document Count" step (Figma) to the mock data generator modal in the
compass-collection
package, allowing users to specify the number of documents to generate and view an estimated disk size based on theavg_document_size
obtained from the collection model during schema analysis. It introduces validation, error handling, and updates the Redux state to support average document size (avgDocumentSize
).Mock Data Generator Modal Enhancements:
DocumentCountScreen
component that lets users specify the number of documents to generate, shows estimated disk size (using the newavgDocumentSize
from schema analysis), and validates input with error messaging for out-of-range values. [1] [2] [3]Schema Analysis & State Updates:
avgDocumentSize
, sourced from the collection model, enabling accurate disk size estimation in the modal. [1] [2] [3] [4] [5] [6]Dependency Updates:
numeral
library for formatting byte sizes in the UI.Checklist
Motivation and Context
Types of changes