-
Notifications
You must be signed in to change notification settings - Fork 235
Compass 98 react convert collection #593
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
97103ce
to
71d4658
Compare
the document and explain plan is still running twice when both query and namespace changes are taking place. Still working on this. |
71d4658
to
d6442a6
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.
This change also breaks the functional tests again (was expected). Let's try to fix them. It's probably just some new css selectors for the tabs that need to be changed to the new elements.
src/app/home/collection.js
Outdated
@@ -1,5 +1,5 @@ | |||
var View = require('ampersand-view'); | |||
var Action = require('hadron-action'); | |||
// var Action = require('hadron-action'); |
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.
is ./src/app/home/collection.js
still used? If not, you can delete the entire file.
src/app/home/index.jade
Outdated
.page | ||
.content.with-sidebar | ||
div(data-hook='collection-subview') | ||
div(data-hook='collection-new-view') |
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.
can you rename it back to collection-view
or collection-subview
and remove the comment? (and also change it accordingly in ./src/app/home/index.js
? We don't want the word new
in there because after we merge, old
is the new new
:-)
|
||
NamespaceStore.listen((ns) => { | ||
if (ns && toNS(ns).collection) { | ||
this.setState({name: toNS(ns).collection, showView: true, activeTab: this.CollectionStore.getActiveTab()}); |
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.
We should not directly call functions on a store. The store passes all the required information down to the component as props. If something you need is missing, you should add it to the store state, and retrieve it as this.props.activeTab
.
} | ||
|
||
onTabClicked(idx) { | ||
this.setState({activeTab: idx}); |
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.
Two issues here:
- again, never call store functions directly. Everything needs to go via an action. There should be a
setActiveTab(idx)
action that the store listens to, and then passes down it's state. - subtlety with setState and props: calling setState() will trigger a render(). But the action (see above) will cause a store change and also trigger a render(), so you render twice. The right way to do this is to use the
componentWillReceiveProps()
hook and change the state internally there. Let's discuss this one in person.
* Fetch the state when the component mounts. | ||
*/ | ||
componentDidMount() { | ||
debug('is doc list being mounted'); |
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.
remove debug.
if (filter === null) { | ||
return; | ||
} | ||
debug('reset is called....'); |
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.
remove debug.
const options = { limit: 20, sort: [[ '_id', 1 ]], readPreference: READ }; | ||
app.dataService.find(NamespaceStore.ns, filter, options, (error, documents) => { | ||
if (!error) { | ||
debug('reset is called.... 2'); |
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.
and this one :)
<div className="compass-explain header-margin"> | ||
<div className="flexbox-fix"></div> | ||
<this.queryBar /> | ||
{this.CollectionStore.isReadonly() ? this.renderReadonly() : this.renderComponent()} |
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.
Hm. I realize now that Durran also calls store functions directly. This goes against the flux pattern. So I guess you were just following his example. I'd like to use the flux pattern as closely as possible, and will also talk to Durran about it so we are on the same page.
const IndexModel = require('mongodb-index-model'); | ||
const NamespaceStore = require('hadron-reflux-store').NamespaceStore; | ||
const Action = require('../action/index-actions'); | ||
// const Action = require('../action/index-actions'); |
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.
remove all lines that are commented out and no longer needed.
init: function() { | ||
this.CollectionStore = app.appRegistry.getStore('App.CollectionStore'); | ||
this.listenTo(Action.loadIndexes, this.loadIndexes); | ||
// this.listenTo(Action.loadIndexes, this.loadIndexes); |
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.
this one too.
This push fixes most of the above, working on realigning functional tests now |
ba1fcb1
to
a7af8c9
Compare
For some bizarre reason I can't select the query bar reset button in the functional tests. Otherwise the tests seem mostly fine. This should now be reviewed by a few. |
b4a990a
to
8afb1f5
Compare
@pzrq good catch, not sure how that disappeared since we wouldn't have touched that |
Just a heads up - the create collection button is visible only if the server is writable. This means only a mongos, standalone, or replica set primary connection would have the button visible. Not sure if that was the case with @pzrq 's comment but something to note. |
It's more the light theme of the top navbar, it has top css property of 60 but the dark theme doesn't. |
oh, yes there should be no difference other than color between light and dark theme. |
* COMPASS-98 add options to QueryStore and add QueryChangedStore * fix typo * comments
…d x from schema action/store files
...when updating namespace and schema view was active.
...when updating namespace and schema view was active. cherry-picking deb2133
66318c9
to
969b76e
Compare
* COMPASS-98 added query bar to schema * COMPASS-98 added collection component * COMPASS-98 added query bar to CRUD and Explain * COMPASS-98 cleaned up collection package * COMPASS-98 fixing index * COMPASS-98 add options to QueryStore and add QueryChangedStore (#590) * COMPASS-98 add options to QueryStore and add QueryChangedStore * fix typo * comments * pass all other query options to QueryChangedStore. (#592) * COMPASS-98 listening to namespace for crud and indexes init * COMPASS-98 crud, schema and explain listens to query changes + removed x from schema action/store files * COMPASS-98 added fix to Explain plan not resetting on collection change * COMPASS-98 tests working and schema sample bug fixed * COMPASS-98 CRUD and explain working * COMPASS-98 switching between collection and db view * COMPASS-98 set name of collection * COMPASS-98 document & indexes loading on mount * COMPASS-98 made no difference on styling :( * COMPASS-98 removed hanging console.log * COMPASS-98 a slightly safer way of preventing double resets for crud * Header repositioning fix * COMPASS-98 fix bug where minicharts don’t rerender... ...when updating namespace and schema view was active. * COMPASS-98 fix bug where minicharts don’t rerender... ...when updating namespace and schema view was active. cherry-picking deb2133 * fix linter issue. * fix linter issue. * COMPASS-98 minor changes to remove comments * COMPASS-98 removed unused files * COMPASS-98 removed useless flexbox-fixed class * using collection 'store' method instead * removed debugs * full namespace as title instead of just collection name * COMPASS-98 adding id to tabs * 5 passing functional tests! * splitting functional test of query refine and apply * supporting more test cases! * COMPASS-98 most functional tests working * added extra margin top to show the create button * skip reset test instead of commenting out.
Needs testing and reviewing.
Have noticed a bug where building a query on one collection, applying and switching to another collection leads to the schema store to constantly run.