Skip to content

Commit ca6b931

Browse files
Satyapzrq
authored andcommitted
COMPASS-98 react convert collection (#593)
* 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.
1 parent ed868af commit ca6b931

35 files changed

+658
-454
lines changed

src/app/home/collection-list-item.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/app/home/collection.jade

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/app/home/collection.js

Lines changed: 0 additions & 233 deletions
This file was deleted.

src/app/home/index.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.page
22
.content.with-sidebar
3-
div(data-hook='collection-subview')
3+
div(data-hook='collection-view')
44
div.report-zero-state(data-hook='report-zero-state')
55
div.state-arrow
66
img(src='images/zero-state-arrow-collections.png', width="110")

src/app/home/index.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var View = require('ampersand-view');
22
// var format = require('util').format;
33
// var IdentifyView = require('../identify');
4-
var CollectionView = require('./collection');
54
var { NamespaceStore } = require('hadron-reflux-store');
65
var TourView = require('../tour');
76
var NetworkOptInView = require('../network-optin');
@@ -16,6 +15,32 @@ var ReactDOM = require('react-dom');
1615

1716
var indexTemplate = require('./index.jade');
1817

18+
/**
19+
* Ampersand view wrapper around a React component tab view
20+
*/
21+
var WrapperView = View.extend({
22+
template: '<div></div>',
23+
props: {
24+
componentKey: 'string',
25+
visible: {
26+
type: 'boolean',
27+
required: true,
28+
default: false
29+
}
30+
},
31+
bindings: {
32+
visible: {
33+
type: 'booleanClass',
34+
no: 'hidden'
35+
}
36+
},
37+
render: function() {
38+
this.renderWithTemplate();
39+
var component = app.appRegistry.getComponent(this.componentKey);
40+
ReactDOM.render(React.createElement(component), this.query());
41+
}
42+
});
43+
1944
var HomeView = View.extend({
2045
screenName: 'Schema',
2146
props: {
@@ -184,40 +209,21 @@ var HomeView = View.extend({
184209

185210
return database.collections.get(ns.ns);
186211
},
187-
// onNamespaceChange: function(ns) {
188-
// const model = this._getCollection();
189-
//
190-
// // if (!model) {
191-
// // app.navigate('/');
192-
// // return;
193-
// // }
194-
//
195-
// const collection = app.instance.collections;
196-
// if (!collection.select(model)) {
197-
// return debug('already selected %s', model);
198-
// }
199-
//
200-
// this.updateTitle(model);
201-
// this.showNoCollectionsZeroState = false;
202-
// this.showDefaultZeroState = false;
203-
//
204-
// // app.navigate(format('schema/%s', model.getId()), {
205-
// // silent: true
206-
// // });
207-
// },
208212
onClickShowConnectWindow: function() {
209213
// code to close current connection window and open connect dialog
210214
ipc.call('app:show-connect-window');
211215
window.close();
212216
},
213217
template: indexTemplate,
214218
subviews: {
215-
_collection: {
216-
hook: 'collection-subview',
219+
collectionView: {
220+
hook: 'collection-view',
217221
prepareView: function(el) {
218-
return new CollectionView({
222+
return new WrapperView({
219223
el: el,
220-
parent: this
224+
parent: this,
225+
visible: true,
226+
componentKey: 'Collection.Collection'
221227
});
222228
}
223229
}

0 commit comments

Comments
 (0)