Skip to content

Commit 6ba53d0

Browse files
committed
INT-1686: Use new app registry (#448)
* INT-1686: Use new app registry * INT-1686: Register stores from CRUD
1 parent 41bba84 commit 6ba53d0

File tree

8 files changed

+18
-11
lines changed

8 files changed

+18
-11
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,16 @@
100100
"electron-squirrel-startup": "^0.1.4",
101101
"font-awesome": "https://github.com/FortAwesome/Font-Awesome/archive/v4.4.0.tar.gz",
102102
"get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394",
103-
"hadron-action": "^0.0.4",
103+
"hadron-action": "^0.1.0",
104104
"hadron-auto-update-manager": "^0.0.12",
105105
"hadron-compile-cache": "^0.3.0",
106-
"hadron-component-registry": "^0.4.0",
106+
"hadron-app-registry": "^1.2.0",
107107
"hadron-document": "^0.17.0",
108108
"hadron-ipc": "^0.0.7",
109109
"hadron-module-cache": "^0.0.3",
110110
"hadron-package-manager": "0.1.0",
111111
"hadron-reflux-store": "^0.0.2",
112+
"hadron-type-checker": "^0.4.0",
112113
"highlight.js": "^8.9.1",
113114
"jquery": "^2.1.4",
114115
"kerberos": "mongodb-js/kerberos#bc619b1b9213eb4cdae786cf3fb916fc7be66758",

src/app/documents/document-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var DocumentListView = View.extend({
1818
}
1919
},
2020
initialize: function() {
21-
this.documentList = app.componentRegistry.findByRole('Collection:DocumentList')[0];
21+
this.documentList = app.appRegistry.getComponent('Component::CRUD::DocumentList');
2222
this.listenTo(app.queryOptions, 'change:query', this.onQueryChanged.bind(this));
2323
},
2424
onQueryChanged: function() {

src/app/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var ModuleCache = require('hadron-module-cache');
1111
ModuleCache.register(resourcePath);
1212
ModuleCache.add(resourcePath);
1313

14-
var ComponentRegistry = require('hadron-component-registry');
14+
var AppRegistry = require('hadron-app-registry');
1515
var PackageManager = require('hadron-package-manager').PackageManager;
1616

1717
var pkg = require('../../package.json');
@@ -73,7 +73,7 @@ var debug = require('debug')('mongodb-compass:app');
7373
// order to ensure that the compile cache has already been loaded and
7474
// hooked into require.extensions. Otherwise, packages will not have
7575
// use of the compile cache.
76-
app.componentRegistry = new ComponentRegistry();
76+
app.appRegistry = new AppRegistry();
7777
app.packageManager = new PackageManager(path.join(__dirname, '..', 'internal-packages'));
7878
app.packageManager.activate();
7979

src/internal-packages/crud/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22

33
const app = require('ampersand-app');
44
const DocumentList = require('./lib/component/document-list');
5+
const Actions = require('./lib/actions');
6+
const InsertDocumentStore = require('./lib/store/insert-document-store');
57

68
/**
79
* Activate all the components in the CRUD package.
810
*/
911
function activate() {
10-
app.componentRegistry.register(DocumentList, { role: 'Collection:DocumentList' });
12+
app.appRegistry.registerComponent('Component::CRUD::DocumentList', DocumentList);
13+
app.appRegistry.registerAction('Action::CRUD::DocumentRemoved', Actions.documentRemoved);
14+
app.appRegistry.registerStore('Store::CRUD::InsertDocumentStore', InsertDocumentStore);
1115
}
1216

1317
/**
1418
* Deactivate all the components in the CRUD package.
1519
*/
1620
function deactivate() {
17-
app.componentRegistry.deregister(DocumentList);
21+
app.appRegistry.deregisterComponent('Component::CRUD::DocumentList');
22+
app.appRegistry.deregisterAction('Action::CRUD::DocumentRemoved');
23+
app.appRegistry.deregisterStore('Store::CRUD::InsertDocumentStore');
1824
}
1925

2026
module.exports.activate = activate;

src/internal-packages/crud/lib/component/binary-value.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const React = require('react');
4-
const truncate = require('hadron-component-registry').truncate;
4+
const truncate = require('hadron-app-registry').truncate;
55

66
/**
77
* Base 64 constant.

src/internal-packages/crud/lib/component/code-value.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const React = require('react');
4-
const truncate = require('hadron-component-registry').truncate;
4+
const truncate = require('hadron-app-registry').truncate;
55

66
/**
77
* The document value class.

src/internal-packages/crud/lib/component/document.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const app = require('ampersand-app');
44
const React = require('react');
55
const Reflux = require('reflux');
6-
const ElementFactory = require('hadron-component-registry').ElementFactory;
6+
const ElementFactory = require('hadron-app-registry').ElementFactory;
77
const NamespaceStore = require('hadron-reflux-store').NamespaceStore;
88
const HadronDocument = require('hadron-document');
99
const Element = require('hadron-document').Element;

src/internal-packages/crud/lib/component/editable-value.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const _ = require('lodash');
44
const React = require('react');
55
const inputSize = require('./utils').inputSize;
6-
const ElementFactory = require('hadron-component-registry').ElementFactory;
6+
const ElementFactory = require('hadron-app-registry').ElementFactory;
77
const TypeChecker = require('hadron-type-checker');
88

99
/**

0 commit comments

Comments
 (0)