Skip to content
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

Compass 528 reactify home #675

Merged
merged 17 commits into from Dec 16, 2016
Merged

Compass 528 reactify home #675

merged 17 commits into from Dec 16, 2016

Conversation

satyasinha
Copy link

No description provided.

@satyasinha
Copy link
Author

I am currently unsure at what level the instance fetching is meant to take place once app/home/index.js goes away. Is it more upstream towards src/index.js or downstream within the react home components?

https://github.com/10gen/compass/pull/675/files#diff-1bfc26616a1850249d97ae8f9c32568eR14

@satyasinha satyasinha force-pushed the COMPASS-528-Reactify-Home branch 2 times, most recently from f03bb6f to c124487 Compare December 14, 2016 04:53
@satyasinha
Copy link
Author

This is a fairly big change it would be good if it was reviewed by more than 1 person.

#### Definitions

| Key | Description |
|-----------------------------------|-----------------------------------------------|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a go at populating the rest of this README?

# Compass Home Package

Home layout for Compass view that switches between Server Stats, Collections
Table and Collection views.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps?

switches between different views based on the current namespace:

* instance-level (Databases / Performance, empty string namespace)
* database-level (navigate and manage collections within a database)
* collection-level (Documents, Indexes, Schema, Explain Plan, Validation)

@@ -0,0 +1,78 @@
const app = require('ampersand-app');
const Reflux = require('reflux');
// const toNS = require('mongodb-ns');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove as it's on line 7 too?


class ConnectedHome extends React.Component {
/**
* Connect <Validation /> component to store and render.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation? Fix jsdoc :)

@@ -29,6 +29,8 @@ const SidebarStore = Reflux.createStore({
*/
init() {
NamespaceStore.listen(this.onNamespaceChanged.bind(this));
this.listenToExternalStore('App.InstanceStore',
this.onInstanceRefreshed.bind(this));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't broken over multiple lines anywhere else in Compass?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:
onInstanceRefreshed looks confusingly close to
onInstanceFetched, is there any obviously more distinct name for either of these, or is there more refactoring that could be done to make it clearer if they are the same thing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, I found that if we're listening to the instance store we no longer need a separate setInstance method.

const StoreConnector = app.appRegistry.getComponent('App.StoreConnector');

const Home = require('./home');
const Store = require('../store');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rename to HomeStore?

Copy link
Member

@rueckstiess rueckstiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. Some tiny comments but otherwise LGTM.

}

Home.propTypes = {
hasContent: React.PropTypes.bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the hasContent prop used at all?

const Home = require('./home');
const HomeStore = require('../store');

// const debug = require('debug')('mongodb-compass:validation:index');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's commented out, can you make that mongodb-compass:home:index?

@@ -227,6 +227,28 @@ var Application = View.extend({
var StatusAction = app.appRegistry.getAction('Status.Actions');
StatusAction.setMessage(err);
},
onInstanceFetched: function() {
// TODO: Remove this line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when should this happen? are we blocked on it currently?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not blocked on it for this PR.
It should happen when connect dialog is reactified. At the moment there is an instance-store that handles most of the instance related events, except for this one. Ideally this initial fetch should all happen on the store but since stores are pulled in before connections and routes have been set it won't work at the moment (At least that's been my experience).

We can fix this at a later date, when connect and app/index.js are reactified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rueckstiess It works and is not a blocker to this going through. It's more that it remains and appears to be a quick hack rather than a proper fix and we couldn't resolve it easily when we tried for around half an hour on Wednesday. I have created https://jira.mongodb.org/browse/COMPASS-563 to track it.

@satyasinha satyasinha force-pushed the COMPASS-528-Reactify-Home branch 3 times, most recently from 81f1163 to 325eed8 Compare December 15, 2016 13:34
@pzrq
Copy link
Contributor

pzrq commented Dec 16, 2016

Overall LGTM. 👍

Remaining TODO that was present before this ticket was attempted is tracked as COMPASS-563.

Let's get this out onto master as we're pretty sure it's working correctly and it's always a good thing to say goodbye to more of this Jade/Ampersand stuff.

@pzrq pzrq merged commit 62b9881 into master Dec 16, 2016
@pzrq pzrq deleted the COMPASS-528-Reactify-Home branch December 16, 2016 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants