-
Notifications
You must be signed in to change notification settings - Fork 235
feat(databases-collections): Create a time-series collection from create database COMPASS-4860 #2222
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
Conversation
appRegistry.registerRole('Global.Modal', DROP_DATABASE_ROLE); | ||
appRegistry.registerStore('DatabasesPlugin.DatabasesStore', DatabasesStore); | ||
appRegistry.registerStore('DatabasesPlugin.CreateDatabaseStore', CreateDatabaseStore); | ||
appRegistry.registerStore('DatabasesPlugin.DropDatabaseStore', DropDatabaseStore); |
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.
Here's where we combined where the two plugins register to Compass.
} | ||
} | ||
|
||
export default class CollectionFields extends PureComponent { |
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.
Here's the CollectionFields
component where we render the options for creating collections (shared w/ create database).
The more general components above are things we probably want to have in a generalized place in Compass where we can also pull the theme.
/> | ||
{this.renderCollectionNameRequiredNotice()} | ||
{this.renderError()} | ||
</ConfirmationModal> |
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.
Here's the updated create-database-modal
. Here's what it used to be: https://github.com/mongodb-js/compass/blob/master/packages/compass-databases-ddl/src/components/create-database-modal/create-database-modal.jsx
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.
Overall looks really neat! A few things caught my eye so I left some comments here and there
packages/databases-collections/src/components/collection-fields/collection-fields.jsx
Outdated
Show resolved
Hide resolved
}; | ||
} | ||
|
||
renderDatabaseNameField() { |
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.
Feel free to ignore this as a nit, but I would suggest to avoid using render*
methods on class components and instead break this into multiple components where those internal state values are props and callbacks: it give you smaller testing units, more composition opportunities, and from personal experience (so of the least importance 😄) I find this way of writing components leading to better props
contracts (which means more understandable components) because you clearly see all component dependencies at a glance when writing them like that. They don't even need to be pure or memoized, just plain function components
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.
Good thinking. I haven't done much straight function usage with react in the past, I like the sound of it. Updated the PR to use some. Updated to use controlled components too. Also broke out the two generic components, collapsible-field-set
and field-set
, which will make the next step of putting them in a more central place for Compass (let's chat about this next few days maybe - my current thinking is having a compass-components
that's typescript which has generic components and light leafygreen wrappers. it would be plugged into a store or some global configurable for styles).
...ges/databases-collections/src/components/create-collection-modal/create-collection-modal.jsx
Outdated
Show resolved
Hide resolved
packages/databases-collections/src/components/create-database-modal/create-database-modal.jsx
Outdated
Show resolved
Hide resolved
packages/databases-collections/src/components/create-database-modal/create-database-modal.jsx
Show resolved
Hide resolved
packages/databases-collections/src/components/collection-fields/collection-fields.jsx
Outdated
Show resolved
Hide resolved
packages/databases-collections/src/components/collection-fields/collection-fields.jsx
Outdated
Show resolved
Hide resolved
…his duplicate code at some point)
@gribnoysup pushed some updates if you'd like to take a look.
Before merging we can make sure we're pulling in any recent changes to dependency versions of package dependencies for these two repos we are merging from the main branch. |
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.
Absolutely awesome work 🔥 Thanks for addressing those comments!
If you want any help with merging/releasing this thing, I'm happy to pair on it (we can test the whole thing locally before publishing to remote)
COMPASS-4860 also gets COMPASS-3921
There's a large diff since we're moving some things around, so I'll leave some comments in places where things have changed.
Here are some of the changes:
compass-collection-ddl
andcompass-database-ddl
into one package, currently it's nameddatabases-collections
, if y'all think of another name please let me know!create database
andcreate collection
modals to use leafygreen components. They do look a bit different now, still syncing with Claudia to finalize.collection-fields
components. This involves removing a number of things from the store and moving them into this new component's state.Some notes/thoughts for possible future things:
[hadron-react-components](https://github.com/mongodb-js/compass/tree/master/packages/hadron-react-components/src)
in the past). Probably something we want to discuss as a team on how we want to structure those, and style them (css in js with emotion and typescript? keep them how they are?compass-components
?).collections-table
anddatabases-table
have a similar toolbar, however it's styles are duplicated. It would be nice to have this shared. Probably aToolbar
component could do us good.collation
component is used by compass-indexes. We aren't touching that part in this work, but it would be nice to reduce that code duplication (maybe when we make all of these modals look similar).Vids
Create db with collection with collation and time series
createDBWithTS.mp4
Create collection with time series
createCollectionEx.mp4
Screenshot of create db when connected to < 5

Still working on a few tests fordonecollection-fields.jsx
and finalizing styles w/ Claudia, I figured this could be open while that's going on since I won't get to it till later in the day EU.Since this is a new package, and we are removing old packages, we'll need to release on npm and update Compass' plugins when we're comfortable with these changes/ready to merge.