Skip to content

Commit a4c6786

Browse files
committed
Merge branch 'dev' into minichart-fixes
2 parents b346db3 + 92e1516 commit a4c6786

File tree

11 files changed

+104
-36
lines changed

11 files changed

+104
-36
lines changed

scout-data/contacts-boolean.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"_id": "{{ObjectID()}}",
3+
"contacts": ["{{_$config}}", {}, {
4+
"name": "{{chance.name()}}",
5+
"email": "{{chance.email()}}",
6+
"invitation_accepted": "{{Boolean(chance.bool())}}"
7+
}]
8+
}

scout-data/contacts-number.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"_id": "{{ObjectID()}}",
3+
"contacts": ["{{_$config}}", {}, {
4+
"name": "{{chance.name()}}",
5+
"email": "{{chance.email()}}",
6+
"invitation_accepted": "{{Number(chance.bool())}}"
7+
}]
8+
}

scout-data/contacts-string.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"_id": "{{ObjectID()}}",
3+
"contacts": ["{{_$config}}", {}, {
4+
"name": "{{chance.name()}}",
5+
"email": "{{chance.email()}}",
6+
"invitation_accepted": "{{chance.bool()}}"
7+
}]
8+
}

scout-data/index.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,51 @@ var createUsers = function(opts) {
1414
})).pipe(dest);
1515
};
1616

17-
var createPaymentMethods = function(opts) {
17+
var createContactsNumber = function(opts) {
1818
var dest = new MongoWritableStream({
1919
url: opts.url,
20-
collection: 'payment_methods'
20+
collection: 'contacts'
2121
});
22-
var src = fs.createReadStream(__dirname + '/payment-methods.json');
22+
var src = fs.createReadStream(__dirname + '/contacts-number.json');
23+
return src.pipe(datasets.createGeneratorStream({
24+
size: 1000
25+
})).pipe(dest);
26+
};
27+
var createContactsString = function(opts) {
28+
var dest = new MongoWritableStream({
29+
url: opts.url,
30+
collection: 'contacts'
31+
});
32+
var src = fs.createReadStream(__dirname + '/contacts-string.json');
33+
return src.pipe(datasets.createGeneratorStream({
34+
size: 1000
35+
})).pipe(dest);
36+
};
37+
var createContactsBoolean = function(opts) {
38+
var dest = new MongoWritableStream({
39+
url: opts.url,
40+
collection: 'contacts'
41+
});
42+
var src = fs.createReadStream(__dirname + '/contacts-boolean.json');
2343
return src.pipe(datasets.createGeneratorStream({
2444
size: 1000
2545
})).pipe(dest);
2646
};
27-
2847
module.exports = function(opts, done) {
2948
opts = opts || {};
3049
opts.url = opts.url || 'mongodb://localhost:27017/datasets';
3150
async.parallel({
3251
users: function(cb) {
3352
createUsers(opts).on('end', cb);
3453
},
35-
payment_methods: function(cb) {
36-
createPaymentMethods(opts).on('end', cb);
54+
contacts_string: function(cb) {
55+
createContactsString(opts).on('end', cb);
56+
},
57+
contacts_number: function(cb) {
58+
createContactsNumber(opts).on('end', cb);
59+
},
60+
contacts_boolean: function(cb) {
61+
createContactsBoolean(opts).on('end', cb);
3762
}
3863
}, done);
3964
};

scout-data/payment-methods.json

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

scout-electron/lib/window-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ module.exports.create = function() {
2222
};
2323

2424
app.on('ready', function() {
25-
var height = 600;
25+
var height = 700;
2626
if (process.platform === 'win32') {
2727
height += 60;
2828
} else if (process.platform === 'linux') {
2929
height += 30;
3030
}
3131
debug('loading main window', DEFAULT_URL);
3232
main = module.exports.main = new BrowserWindow({
33-
width: 800,
33+
width: 1024,
3434
height: height,
3535
'web-preferences': {
3636
'subpixel-font-scaling': true,

scout-server/lib/io.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ function prepare(socket, req, done) {
3535

3636
var tasks = {};
3737
tasks.token = function(next) {
38-
brain.loadToken(socket.decoded_token, req, next);
38+
brain.loadToken(socket.decoded_token, req, function() {
39+
debug('load token returned', arguments);
40+
next();
41+
});
3942
};
4043

4144
if (req.params.ns) {

scout-ui/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@
5151
"ampersand-view": "^7.0.1",
5252
"ampersand-view-switcher": "^2.0.0",
5353
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.2.tar.gz",
54+
"d3": "^3.5.5",
55+
"d3-tip": "^0.6.7",
5456
"debug": "^2.0.0",
5557
"domready": "^1.0.7",
5658
"event-stream": "^3.3.0",
5759
"flatnest": "^0.2.2",
5860
"font-awesome": "https://github.com/FortAwesome/Font-Awesome/archive/v4.3.0.tar.gz",
5961
"jade": "^1.9.2",
6062
"jquery": "^2.1.1",
63+
"lodash": "^3.8.0",
6164
"moment": "^2.8.2",
65+
"mongodb-schema": "git://github.com/mongodb-js/mongodb-schema.git#ampersand",
6266
"numeral": "^1.5.3",
6367
"octicons": "https://github.com/github/octicons/archive/v2.2.0.tar.gz",
6468
"phantomjs-polyfill": "0.0.1",
6569
"qs": "^2.2.4",
66-
"underscore": "^1.6.0",
67-
"mongodb-schema": "git://github.com/mongodb-js/mongodb-schema.git#ampersand",
68-
"d3": "^3.5.5",
69-
"d3-tip": "^0.6.7",
70-
"lodash": "^3.8.0"
70+
"underscore": "^1.6.0"
7171
},
7272
"devDependencies": {
7373
"browserify": "^9.0.3",

scout-ui/src/field-list/index.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ var MinichartView = require('../minicharts');
44
var FieldCollection = require('mongodb-schema').FieldCollection;
55
var ViewSwitcher = require('ampersand-view-switcher');
66
var _ = require('lodash');
7-
var debug = require('debug')('scout-ui:field-list');
87

98
var BasicFieldView = View.extend({
109
bindings: {
11-
'model._id': {
12-
hook: 'name'
13-
}
10+
'model._id': [
11+
{
12+
hook: 'name'
13+
},
14+
{
15+
hook: 'name',
16+
type: function(el) {
17+
if (this.model._id === '__basic__') {
18+
el.classList.add('hidden');
19+
}
20+
}
21+
}
22+
]
1423
},
1524
template: require('./basic-field.jade'),
1625
subviews: {
@@ -28,10 +37,10 @@ var BasicFieldView = View.extend({
2837
initialize: function() {
2938
var that = this;
3039
// the debounce cuts down computation time by a factor of 5-10 here
31-
this.model.on('change', _.debounce(function(model) {
40+
this.model.types.on('sync', _.debounce(function() {
3241
// for now pick first type, @todo: make the type bars clickable and toggle chart
33-
that.switchView(model.types.at(0));
34-
}, 100));
42+
that.switchView(that.model.types.at(0));
43+
}, 300));
3544
},
3645
render: function() {
3746
this.renderWithTemplate(this);

scout-ui/src/field-list/type-list-item.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var AmpersandView = require('ampersand-view');
22
var $ = require('jquery');
33
var format = require('util').format;
4+
var _ = require('underscore');
5+
var numeral = require('numeral');
46

57
require('bootstrap/js/tooltip');
68

@@ -21,18 +23,27 @@ module.exports = AmpersandView.extend({
2123
{
2224
hook: 'bar',
2325
type: function(el) {
24-
var percent = Math.min(this.model.probability * 100, 100);
2526
$(el).css({
26-
width: percent + '%'
27+
width: Math.floor(this.model.probability * 100) + '%'
2728
});
28-
if (percent) {
29-
$(el).tooltip({
30-
title: format('%s (%d%)', this.model.getId(), percent)
31-
});
32-
}
3329
}
3430
}
3531
]
3632
},
33+
derived: {
34+
percent: {
35+
deps: ['model.probability'],
36+
fn: function() {
37+
return this.model.probability;
38+
}
39+
}
40+
},
41+
initialize: function() {
42+
this.listenTo(this.model, 'change:probability', _.debounce(function() {
43+
$(this.el).tooltip({
44+
title: format('%s (%s)', this.model.getId(), numeral(this.model.probability).format('%'))
45+
});
46+
}.bind(this), 300));
47+
},
3748
template: require('./type-list-item.jade')
3849
});

0 commit comments

Comments
 (0)