Skip to content

Commit f85c3e5

Browse files
authored
Dont use schema in community (#1269)
1 parent d760dcf commit f85c3e5

File tree

8 files changed

+31
-38
lines changed

8 files changed

+31
-38
lines changed

src/app/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ require('./setup-hadron-caches');
2020
/**
2121
* The main entrypoint for the application!
2222
*/
23-
const pkg = require('../../package.json');
24-
const COMMUNITY = 'mongodb-compass-community';
25-
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
26-
2723
var electron = require('electron');
2824
var APP_VERSION = electron.remote.app.getVersion();
2925

@@ -227,7 +223,7 @@ var Application = View.extend({
227223
* If we're in Compass community and the license has not been agreed, we need
228224
* to show it first and force the user to agree or disagree.
229225
*/
230-
if (DISTRIBUTION.name === COMMUNITY && !app.preferences.agreedToLicense) {
226+
if (process.env.HADRON_PRODUCT === 'mongodb-compass-community' && !app.preferences.agreedToLicense) {
231227
const licenseComponent = app.appRegistry.getRole('Application.License')[0].component;
232228
const licenseStore = app.appRegistry.getStore('License.Store');
233229
const licenseActions = app.appRegistry.getAction('License.Actions');
@@ -324,7 +320,7 @@ var Application = View.extend({
324320
prefs.lastKnownVersion = currentVersion;
325321
save = true;
326322
}
327-
if (DISTRIBUTION.name === COMMUNITY) {
323+
if (process.env.HADRON_PRODUCT === 'mongodb-compass-community') {
328324
prefs.enableMaps = false;
329325
prefs.enableFeedbackPanel = false;
330326
save = true;

src/app/network-optin/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ var debug = require('debug')('mongodb-compass:network-optin:index');
77

88
var indexTemplate = require('./index.jade');
99

10-
const pkg = require('../../../package.json');
11-
const COMMUNITY = 'mongodb-compass-community';
12-
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
13-
1410
var NetworkOptInView = View.extend({
1511
template: indexTemplate,
1612
props: {
@@ -30,7 +26,7 @@ var NetworkOptInView = View.extend({
3026
isCommunity: {
3127
type: 'boolean',
3228
required: true,
33-
default: DISTRIBUTION.name === COMMUNITY
29+
default: process.env.HADRON_PRODUCT === 'mongodb-compass-community'
3430
}
3531
},
3632
events: {

src/app/tour/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ var TAB_KEY = 9;
1717
var ENTER_KEY = 13;
1818
var SPACE_KEY = 32;
1919

20-
const pkg = require('../../../package.json');
21-
const COMMUNITY = 'mongodb-compass-community';
22-
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
23-
2420
/**
2521
* The feature tour highlights some signature features of MongoDB Compass.
2622
* When Compass is started for the first time, it shows all the features in
@@ -122,7 +118,7 @@ var TourView = View.extend({
122118
var previous = model.previousVersion || '0.0.0';
123119

124120
model.features = _.filter(FEATURES, function(feature) {
125-
if (DISTRIBUTION.name === COMMUNITY && !feature.community) {
121+
if (process.env.HADRON_PRODUCT === 'mongodb-compass-community' && !feature.community) {
126122
return false;
127123
}
128124
if (model.force && feature.initial) {

src/app/tour/index.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
left: 0;
1010
right: 0;
1111
bottom: 0;
12-
z-index: 20;
12+
z-index: 200;
1313
}
1414
#tour-bg {
1515
position: absolute;
@@ -26,6 +26,7 @@
2626
left: 50%;
2727
width: 90%;
2828
max-width: 1100px;
29+
z-index: 1000;
2930
position: absolute;
3031
background-color: @pw;
3132
-webkit-transform: translate(-50%, -50%);

src/internal-plugins/metrics/lib/setup.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ const ICON_PATH = path.join(__dirname, '..', 'images', 'compass-dialog-icon.png'
1414

1515
const debug = require('debug')('mongodb-compass:metrics:setup');
1616

17-
const COMMUNITY = 'mongodb-compass-community';
18-
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
19-
2017
const INTERCOM_KEY = 'p57suhg7';
2118
const BUGSNAG_KEY = '0d11ab5f4d97452cc83d3365c21b491c';
2219

@@ -38,7 +35,7 @@ module.exports = function() {
3835
}
3936
});
4037

41-
if (DISTRIBUTION.name !== COMMUNITY) {
38+
if (process.env.HADRON_PRODUCT !== 'mongodb-compass-community') {
4239
metrics.configure({
4340
intercom: {
4441
appId: INTERCOM_KEY,
@@ -143,7 +140,7 @@ module.exports = function() {
143140
* such that when a link is clicked, the event is properly
144141
* passed off to `app.router` and a web page actually opens.
145142
*/
146-
if (DISTRIBUTION.name !== COMMUNITY) {
143+
if (process.env.HADRON_PRODUCT !== 'mongodb-compass-community') {
147144
intercom.configure();
148145
}
149146

src/internal-plugins/schema/index.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const app = require('hadron-app');
21
const SchemaComponent = require('./lib/component');
32
const SchemaStatusSubview = require('./lib/component/status-subview');
43
const SchemaAction = require('./lib/action');
@@ -17,23 +16,30 @@ const COLLECTION_TAB_ROLE = {
1716
/**
1817
* Activate all the components in the Schema package.
1918
*
20-
* @param {Object} appRegistry the app registry
19+
* @param {Object} appRegistry - the app registry
2120
*/
2221
function activate(appRegistry) {
23-
appRegistry.registerRole('Collection.Tab', COLLECTION_TAB_ROLE);
24-
appRegistry.registerAction('Schema.Actions', SchemaAction);
25-
appRegistry.registerStore('Schema.Store', SchemaStore);
26-
appRegistry.registerComponent('Schema.StatusSubview', SchemaStatusSubview);
22+
// @todo: Temporary hack to remove the internal plugin from the community edition.
23+
if (process.env.HADRON_PRODUCT !== 'mongodb-compass-community') {
24+
appRegistry.registerRole('Collection.Tab', COLLECTION_TAB_ROLE);
25+
appRegistry.registerAction('Schema.Actions', SchemaAction);
26+
appRegistry.registerStore('Schema.Store', SchemaStore);
27+
appRegistry.registerComponent('Schema.StatusSubview', SchemaStatusSubview);
28+
}
2729
}
2830

2931
/**
3032
* Deactivate all the components in the Schema package.
33+
*
34+
* @param {Object} appRegistry - the app registry
3135
*/
32-
function deactivate() {
33-
app.appRegistry.deregisterRole('Collection.Tab', COLLECTION_TAB_ROLE);
34-
app.appRegistry.deregisterAction('Schema.Actions');
35-
app.appRegistry.deregisterStore('Schema.Store');
36-
app.appRegistry.deregisterComponent('Schema.StatusSubview');
36+
function deactivate(appRegistry) {
37+
if (process.env.HADRON_PRODUCT !== 'mongodb-compass-community') {
38+
appRegistry.deregisterRole('Collection.Tab', COLLECTION_TAB_ROLE);
39+
appRegistry.deregisterAction('Schema.Actions');
40+
appRegistry.deregisterStore('Schema.Store');
41+
appRegistry.deregisterComponent('Schema.StatusSubview');
42+
}
3743
}
3844

3945
module.exports.activate = activate;

src/main/menu.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ var ipc = require('hadron-ipc');
66
var BrowserWindow = electron.BrowserWindow;
77
var Menu = electron.Menu;
88
var app = electron.app;
9-
var pkg = require('../../package.json');
109

1110
var State = require('ampersand-state');
1211
var _ = require('lodash');
1312
var debug = require('debug')('mongodb-compass:menu');
1413

1514
const COMPASS_HELP = 'https://docs.mongodb.com/compass/';
16-
const COMMUNITY = 'mongodb-compass-community';
17-
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
1815

1916
// submenu related
2017
function separator() {
@@ -189,7 +186,7 @@ function helpSubMenu() {
189186
subMenu.push(securityItem());
190187

191188

192-
if (!DISTRIBUTION || (DISTRIBUTION.name !== COMMUNITY)) {
189+
if (process.env.HADRON_PRODUCT !== 'mongodb-compass-community') {
193190
subMenu.push(separator());
194191
subMenu.push(intercomItem());
195192
}

src/setup-hadron-distribution.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ const pkg = require('../package.json');
55
* npm start compass-community
66
*/
77
if (!process.env.HADRON_DISTRIBUTION) {
8-
process.env.HADRON_DISTRIBUTION = pkg.distribution || pkg.config.hadron.distributions.default;
8+
const distribution = pkg.distribution || pkg.config.hadron.distributions.default;
9+
process.env.HADRON_DISTRIBUTION = distribution;
910
}
1011

12+
const name = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION].name;
13+
process.env.HADRON_PRODUCT = name || 'mongodb-compass';
14+
1115
if (pkg.distribution) {
1216
process.env.NODE_ENV = 'production';
1317
}

0 commit comments

Comments
 (0)