Skip to content

Commit 85786bd

Browse files
committed
Merge pull request #208 from 10gen/INT-747-handle-missing-api-key
INT-747 handle missing api key
2 parents 4b5e985 + fa53d71 commit 85786bd

File tree

11 files changed

+368
-121
lines changed

11 files changed

+368
-121
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"dependencies": {
7272
"debug": "^2.2.0",
7373
"electron-squirrel-startup": "^0.1.4",
74-
"google-maps": "^3.1.0",
7574
"keytar": "^3.0.0",
7675
"localforage": "^1.3.0",
7776
"mongodb-collection-model": "^0.1.1",
@@ -154,6 +153,7 @@
154153
"uuid": "^2.0.1",
155154
"vinyl-buffer": "^1.0.0",
156155
"vinyl-source-stream": "^1.1.0",
157-
"watchify": "^3.6.0"
156+
"watchify": "^3.6.0",
157+
"xor-it": "^1.0.1"
158158
}
159159
}

src/app.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ var Application = View.extend({
113113
* @see http://learn.humanjavascript.com/react-ampersand/creating-a-router-and-pages
114114
*/
115115
router: 'object',
116-
/**
117-
* Enable/Disable features with one global switch
118-
*/
119-
features: 'object',
120116
clientStartedAt: 'date',
121117
clientStalledTimeout: 'number'
122118
},
@@ -237,7 +233,7 @@ var state = new Application({
237233
var FEATURES = {
238234
querybuilder: true,
239235
keychain: true,
240-
'Geo Minicharts': true,
236+
'Google Map Minicharts': true,
241237
'Connect with SSL': false,
242238
'Connect with Kerberos': false,
243239
'Connect with LDAP': false,

src/connect/filereader-view.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var _ = require('lodash');
33
var path = require('path');
44
var remote = window.require('remote');
55
var dialog = remote.require('dialog');
6+
var BrowserWindow = remote.require('browser-window');
67
var format = require('util').format;
78
var bindings = require('ampersand-dom-bindings');
89
var fileReaderTemplate = require('./filereader-default.jade');
@@ -172,7 +173,7 @@ module.exports = InputView.extend({
172173
this.runTests();
173174
},
174175
loadFileButtonClicked: function() {
175-
dialog.showOpenDialog({
176+
dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), {
176177
properties: ['openFile', 'multiSelections']
177178
}, function(filenames) {
178179
this.inputValue = filenames || [];

src/home/collection.jade

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
.collection-view.clearfix
2-
div.modal.fade(tabindex='-1', role='dialog', arialabelledby='Share Schema Confirmation', data-hook='share-schema-confirmation')
3-
div.modal-dialog.modal-sm
4-
.modal-content
5-
.modal-header
6-
button.close(type='button', data-dismiss='modal', aria-label='Close')
7-
span(aria-hidden='true') ×
8-
h4.modal-title Share Schema
9-
.modal-body
10-
p The schema definition in JSON format has been copied to the clipboard.
11-
.modal-footer
12-
button.btn.btn-default(type='button', data-dismiss='modal') Close
132
header
143
.row
154
.col-md-6

src/home/collection.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ var RefineBarView = require('../refine-view');
66
var MongoDBCollection = require('../models/mongodb-collection');
77
var SampledSchema = require('../models/sampled-schema');
88
var app = require('ampersand-app');
9-
var $ = require('jquery');
109
var _ = require('lodash');
10+
var remote = window.require('remote');
11+
var dialog = remote.require('dialog');
12+
var BrowserWindow = remote.require('browser-window');
13+
var format = require('util').format;
1114
var debug = require('debug')('scout:home:collection');
1215

13-
require('bootstrap/js/modal');
14-
1516
var MongoDBCollectionView = View.extend({
1617
// modelType: 'Collection',
1718
template: require('./collection.jade'),
@@ -83,7 +84,16 @@ var MongoDBCollectionView = View.extend({
8384
onShareSchema: function() {
8485
var clipboard = window.require('clipboard');
8586
clipboard.writeText(JSON.stringify(this.schema.serialize(), null, ' '));
86-
$(this.queryByHook('share-schema-confirmation')).modal('show');
87+
88+
var detail = format('The schema definition of %s has been copied to your '
89+
+ 'clipboard in JSON format.', this.model._id);
90+
91+
dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
92+
type: 'info',
93+
message: 'Share Schema',
94+
detail: detail,
95+
buttons: ['OK']
96+
});
8797
},
8898
onCollectionChanged: function() {
8999
var ns = this.parent.ns;
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
var d3 = require('d3');
2+
var _ = require('lodash');
3+
var shared = require('./shared');
4+
var tooltipHtml = require('./tooltip.jade');
5+
6+
require('../d3-tip')(d3);
7+
8+
// var debug = require('debug')('scout:minicharts:coordinates');
9+
10+
var minicharts_d3fns_coordinates = function() {
11+
// --- beginning chart setup ---
12+
var width = 400;
13+
var height = 100;
14+
var options = {
15+
view: null
16+
};
17+
var margin = shared.margin;
18+
margin.bottom = 20;
19+
20+
var xScale = d3.scale.linear();
21+
var yScale = d3.scale.linear();
22+
23+
var xAxis = d3.svg.axis()
24+
.ticks(10)
25+
.scale(xScale)
26+
.orient('bottom');
27+
28+
var yAxis = d3.svg.axis()
29+
.ticks(6)
30+
.scale(yScale)
31+
.orient('left');
32+
33+
var coordFormat = d3.format('.1f');
34+
35+
// set up tooltips
36+
var tip = d3.tip()
37+
.attr('class', 'd3-tip')
38+
.direction('n')
39+
.offset([-9, 0]);
40+
41+
// --- end chart setup ---
42+
43+
function chart(selection) {
44+
selection.each(function(data) {
45+
var el = d3.select(this);
46+
var innerWidth = width - margin.left - margin.right;
47+
var innerHeight = height - margin.top - margin.bottom;
48+
49+
// setup tool tips
50+
tip.html(function(d) {
51+
return tooltipHtml({
52+
label: 'lng: ' + coordFormat(d[0]) + ', lat: ' + coordFormat(d[1])
53+
});
54+
});
55+
el.call(tip);
56+
57+
xScale
58+
.domain([
59+
d3.min(data, function(d) { return d[0]; }) - 3,
60+
d3.max(data, function(d) { return d[0]; }) + 3
61+
])
62+
.range([0, innerWidth]);
63+
64+
yScale
65+
.domain([
66+
d3.min(data, function(d) { return d[1]; }) - 3,
67+
d3.max(data, function(d) { return d[1]; }) + 3
68+
])
69+
.range([innerHeight, 0]);
70+
71+
var g = el.selectAll('g').data([null]);
72+
73+
// append g element if it doesn't exist yet
74+
g.enter()
75+
.append('g')
76+
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
77+
.attr('width', innerWidth)
78+
.attr('height', innerHeight);
79+
80+
var x = g.selectAll('.x.axis').data([null]);
81+
x.enter().append('g')
82+
.attr('class', 'x axis')
83+
.attr('transform', 'translate(0, ' + innerHeight + ')')
84+
.append('text')
85+
// .attr('class', 'label')
86+
.attr('x', innerWidth)
87+
.attr('y', -6)
88+
.style('text-anchor', 'end')
89+
.text('lng');
90+
x.call(xAxis);
91+
92+
var y = g.selectAll('.y.axis').data([null]);
93+
y.enter().append('g')
94+
.attr('class', 'y axis')
95+
.append('text')
96+
// .attr('class', 'label')
97+
.attr('transform', 'rotate(-90)')
98+
.attr('y', 6)
99+
.attr('dy', '.71em')
100+
.style('text-anchor', 'end')
101+
.text('lat');
102+
y.call(yAxis);
103+
104+
// select all g.bar elements
105+
var circle = g.selectAll('circle.circle')
106+
.data(data);
107+
108+
circle
109+
.transition() // only apply transition to already existing elements
110+
.attr('cx', function(d) {
111+
return xScale(d[0]);
112+
})
113+
.attr('cy', function(d) {
114+
return yScale(d[1]);
115+
});
116+
117+
circle.enter().append('circle')
118+
.attr('class', 'circle')
119+
.attr('cx', function(d) {
120+
return xScale(d[0]);
121+
})
122+
.attr('cy', function(d) {
123+
return yScale(d[1]);
124+
})
125+
.attr('r', 4.5)
126+
.on('mouseover', tip.show)
127+
.on('mouseout', tip.hide);
128+
129+
circle.exit().remove();
130+
});
131+
}
132+
133+
chart.width = function(value) {
134+
if (!arguments.length) {
135+
return width;
136+
}
137+
width = value;
138+
return chart;
139+
};
140+
141+
chart.height = function(value) {
142+
if (!arguments.length) {
143+
return height;
144+
}
145+
height = value;
146+
return chart;
147+
};
148+
149+
chart.options = function(value) {
150+
if (!arguments.length) {
151+
return options;
152+
}
153+
_.assign(options, value);
154+
return chart;
155+
};
156+
157+
return chart;
158+
};
159+
160+
module.exports = minicharts_d3fns_coordinates;

0 commit comments

Comments
 (0)