Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6d5b16a
INT-459: use newrelic agent
imlucas Aug 2, 2015
9a66524
INT-175: Initial intercom setup
imlucas Jul 8, 2015
e69fab8
feature(models): First crack at User
imlucas Jul 8, 2015
a9c5204
feature(app): wire in user model
imlucas Jul 8, 2015
1fa9220
add mongodb-leaf images used for setup
imlucas Aug 1, 2015
08014a7
Make github's ipc available to app
imlucas Aug 1, 2015
b129f14
Cleanup some autoupdate messages
imlucas Aug 1, 2015
e4ef48e
Crash reporter cleanup
imlucas Aug 1, 2015
31bf979
github oauth bindings, windowing cleanup + setup persistence
imlucas Aug 1, 2015
0edd4d0
fixup intercom + new user props github provides
imlucas Aug 1, 2015
b5926e1
deps for github that were stomped
imlucas Aug 1, 2015
e109e50
whip end-to-end setup wizard
imlucas Aug 1, 2015
a3c0ad1
remove CSP until we fully understand it
imlucas Aug 2, 2015
dc6b9a0
simplify and remove dupe code
imlucas Aug 2, 2015
8e3f4f5
missed a url replace on first-run -> setup rename
imlucas Aug 2, 2015
3348844
"Right-click -> inspect element"
imlucas Aug 2, 2015
2578599
more progress on sign up form validation
imlucas Aug 4, 2015
3b66c13
more form validation
imlucas Aug 5, 2015
78499b1
Finish user-form and validation.
imlucas Aug 5, 2015
9693f9b
Fix from bad merge
imlucas Aug 5, 2015
47d8634
enable github oauth on setup
imlucas Aug 5, 2015
6a87496
unify all the configs and disable setup via feature flag so we can me…
imlucas Aug 11, 2015
cbb2e2a
lint+fmt cleanup
imlucas Aug 12, 2015
e29c6a1
Dont require newrelic if notenabled or their config class pukes
imlucas Aug 12, 2015
93055eb
Set NEW_RELIC_NO_CONFIG_FILE env var so it doesn't barf that it cant …
imlucas Aug 12, 2015
90cdfb7
progress on styling onboarding
marcgurney Aug 18, 2015
a905d2a
line-height tweak
marcgurney Aug 18, 2015
154292d
small alignment tweaks
marcgurney Aug 19, 2015
82d1c81
update style of primary github login button
marcgurney Aug 27, 2015
d2e2248
Wire up connect mongodb to actually open the app.
imlucas Aug 31, 2015
08cfeb7
Merge branch 'master' into first-run, and JSDoc comments for npm run …
rueckstiess Aug 31, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.DS_Store
.idea/
*.iml
config.json
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ To compile electron + the app and the installer for your current platform:
npm run release
```

## Configuration

### Newrelic

By default, newrelic is disabled because we don't want to check-in the license key.

Login to newrelic and copy the [license_key](https://rpm.newrelic.com/accounts/933509).

It can be set at build time by adding the following to `./config.json`:

```json
{
"newrelic": {
"license_key": "<paste-here>"
}
}
```

Alternatively to just try it out or to debug a problem use environment variables:

```bash
newrelic__license_key='<paste-here>' npm start;
```

[setup-osx]: https://github.com/mongodb-js/mongodb-js/blob/master/docs/setup.md#osx-setup
[setup-windows]: https://github.com/mongodb-js/mongodb-js/blob/master/docs/setup.md#windows-setup
[setup-linux]: https://github.com/mongodb-js/mongodb-js/blob/master/docs/setup.md#linux-setup
13 changes: 10 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var shell = require('gulp-shell');
var path = require('path');
var del = require('del');
var spawn = require('child_process').spawn;
var config = require('./src/electron/config');

var notify = require('./tasks/notify');
var pkg = require('./package.json');
Expand Down Expand Up @@ -127,7 +128,8 @@ gulp.task('pages', function() {
return gulp.src('src/index.jade')
.pipe(jade({
locals: {
NODE_ENV: process.env.NODE_ENV
NODE_ENV: process.env.NODE_ENV,
CONFIG: JSON.stringify(config.toJSON())
}
}))
.on('error', notify('jade'))
Expand All @@ -147,8 +149,13 @@ gulp.task('copy:images', function() {

gulp.task('copy:electron', function() {
return merge(
gulp.src(['main.js', 'package.json', 'settings.json', 'README.md'])
.pipe(gulp.dest('build/')),
gulp.src([
'main.js',
'package.json',
'config.json',
'node_modules/animate.css/animate.css',
'README.md'
]).pipe(gulp.dest('build/')),
gulp.src(['src/electron/*'])
.pipe(gulp.dest('build/src/electron'))
);
Expand Down
Binary file added images/logo-scout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mongodb-leaf-development.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mongodb-leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mongodb-leaf_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"font-awesome",
"octicons",
"app",
"ipc",
"auto-updater",
"crash-reporter",
"browser-window",
"menu",
"jade",
"ampersand-state"
"ampersand-state",
"animate.css"
]
},
"fonts": [
Expand Down Expand Up @@ -72,6 +74,8 @@
"ampersand-sync-localforage": "^0.1.1",
"ampersand-view": "^8.0.0",
"ampersand-view-switcher": "^2.0.0",
"animate.css": "^3.2.5",
"animationend": "0.0.1",
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
"bugsnag-js": "^2.4.8",
"d3": "^3.5.5",
Expand All @@ -88,16 +92,22 @@
"mongodb-language-model": "^0.2.1",
"mongodb-schema": "^3.3.0",
"mousetrap": "^1.5.3",
"nconf": "^0.7.1",
"newrelic": "^1.21.1",
"numeral": "^1.5.3",
"octicons": "https://github.com/github/octicons/archive/v2.2.0.tar.gz",
"octonode": "^0.7.1",
"phantomjs-polyfill": "0.0.1",
"pluralize": "^1.1.2",
"qs": "^3.1.0",
"raf": "^3.0.0",
"request": "^2.60.0",
"scout-brain": "http://bin.mongodb.org/js/scout-brain/v0.0.2/scout-brain-0.0.2.tar.gz",
"scout-client": "http://bin.mongodb.org/js/scout-client/v0.0.5/scout-client-0.0.5.tar.gz",
"scout-server": "http://bin.mongodb.org/js/scout-server/v0.0.4/scout-server-0.0.4.tar.gz",
"tiny-lr": "^0.1.6",
"untildify": "^2.1.0",
"uuid": "^2.0.1",
"watch": "^0.16.0"
},
"devDependencies": {
Expand Down
109 changes: 91 additions & 18 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
// Injected into index.html by the gulp build task.
var CONFIG = window.CONFIG;

// Do most basic setup of app here so we can get bugsnag listening
// for errors as high in the stack as possible.
var _ = require('lodash');
var pkg = require('../package.json');
var app = require('ampersand-app');
/*eslint no-bitwise:0*/
app.extend({
// @todo (imlucas): use http://npm.im/osx-release and include platform details
// in event tracking.
meta: {
'App Version': pkg.version
},
config: CONFIG,
/**
* feature switch, returns boolean if feature `name` is enabled.
* @param {String} name name of the feature, e.g. 'querybuilder'
* @return {Boolean} whether feature is enabled or not
*/
isFeatureEnabled: function(name) {
return Boolean(~~_.get(CONFIG, name + '.enabled'));
}
});
require('./bugsnag').listen(app);

var _ = require('lodash');
require('./bugsnag');

var domReady = require('domready');
var qs = require('qs');
var getOrCreateClient = require('scout-client');
var ViewSwitcher = require('ampersand-view-switcher');
var View = require('ampersand-view');
var localLinks = require('local-links');
var intercom = require('./intercom');
var debug = require('debug')('scout:app');

/**
* The top-level application singleton that brings everything together!
Expand Down Expand Up @@ -67,11 +87,7 @@ var Application = View.extend({
/**
* @see http://learn.humanjavascript.com/react-ampersand/creating-a-router-and-pages
*/
router: 'object',
/**
* Enable/Disable features with one global switch
*/
features: 'object'
router: 'object'
},
events: {
'click a': 'onLinkClick'
Expand All @@ -85,6 +101,16 @@ var Application = View.extend({

this.listenTo(this.router, 'page', this.onPageChange);

this.router.on('page', intercom.update);

/*eslint no-console:0*/
app.getOrCreateUser(function(err, user) {
if (err) return console.error(err);

this.user.set(user.serialize());
intercom.inject(user);
}.bind(this));

this.router.history.start({
pushState: false,
root: '/'
Expand Down Expand Up @@ -130,6 +156,7 @@ var Application = View.extend({
event.preventDefault();
this.router.history.navigate(pathname);
}
intercom.update();
}
});

Expand All @@ -142,27 +169,45 @@ var state = new Application({
var QueryOptions = require('./models/query-options');
var Connection = require('./models/connection');
var MongoDBInstance = require('./models/mongodb-instance');
var User = require('./models/user');
var Router = require('./router');
var Statusbar = require('./statusbar');

require('./context-menu-manager');

app.extend({
client: null,
openSetupDialog: function() {
app.ipc.send('open-setup-dialog');
},
openConnectDialog: function() {
app.ipc.send('open-connect-dialog');
},
init: function() {
state.statusbar = new Statusbar();
this.connection = new Connection();
this.connection.use(uri);
this.queryOptions = new QueryOptions();
this.volatileQueryOptions = new QueryOptions();
this.instance = new MongoDBInstance();

// feature flags
this.features = {
querybuilder: true
};
state.queryOptions = new QueryOptions();
state.instance = new MongoDBInstance();

state.user = new User();
state.router = new Router();

this.on('change:ipc', function() {
debug('ipc now available!');
});
},
navigate: state.navigate.bind(state)
use: function(fn) {
fn.call(null, this);
},
intercom: intercom,
navigate: state.navigate.bind(state),
back: function() {
this.router.history.history.back();
},
getOrCreateUser: User.getOrCreate
});

Object.defineProperty(app, 'statusbar', {
Expand All @@ -171,22 +216,50 @@ Object.defineProperty(app, 'statusbar', {
}
});

Object.defineProperty(app, 'user', {
get: function() {
return state.user;
}
});

Object.defineProperty(app, 'instance', {
get: function() {
return state.instance;
}
});

Object.defineProperty(app, 'queryOptions', {
get: function() {
return state.queryOptions;
}
});

Object.defineProperty(app, 'connection', {
get: function() {
return state.connection;
}
});

Object.defineProperty(app, 'router', {
get: function() {
return state.router;
}
});

Object.defineProperty(app, 'client', {
get: function() {
return getOrCreateClient({
seed: app.connection.uri
seed: state.connection.uri
});
}
});
app.init();

// expose app globally for debugging purposes
window.app = app;

function render_app() {
state._onDOMReady();
}

domReady(render_app);

// expose app globally for debugging purposes
window.app = app;
33 changes: 22 additions & 11 deletions src/bugsnag.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
*/
var bugsnag = require('bugsnag-js');
var redact = require('./redact');
var app = require('ampersand-app');
var _ = require('lodash');
var app = require('ampersand-app');
var debug = require('debug')('scout:bugsnag');

var TOKEN = '0d11ab5f4d97452cc83d3365c21b491c';

// @todo (imlucas): use mongodb-redact
function beforeNotify(d) {
d.stacktrace = redact(d.stacktrace);
Expand All @@ -36,20 +34,33 @@ function beforeNotify(d) {
* @todo (imlucas): When first-run branch merged, include user id:
* https://github.com/bugsnag/bugsnag-js#user
*/
module.exports.listen = function listen() {
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = 'development';
}

// <<<<<<< HEAD
var enabled = _.get(app.get, 'bugsnag.enabled');
if (!enabled) {
// =======
// module.exports.listen = function listen() {
// if (!process.env.NODE_ENV) {
// process.env.NODE_ENV = 'development';
// }
//
// >>>>>>> master
_.assign(bugsnag, {
apiKey: TOKEN,
apiKey: _.get(app.config, 'bugsnag.token'),
autoNotify: true,
releaseStage: process.env.NODE_ENV,
notifyReleaseStages: ['production', 'development'],
appVersion: app.meta['App Version'],
metaData: app.meta,
beforeNotify: beforeNotify
});

app.bugsnag = bugsnag;
};

module.exports.trackError = function(err) {
return bugsnag.notifyException(err);
};
} else {
/*eslint no-console:0*/
module.exports.trackError = function(err) {
console.log('Error', err);
};
}
Loading