Skip to content

Commit 5c93f61

Browse files
committed
🐛 fixing serialization
1 parent 156d3f2 commit 5c93f61

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/connect/auth-fields.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ var kerberos_password = new InputView({
7878
* Define fields for each auth method here
7979
*/
8080
module.exports = {
81+
NONE: [],
8182
MONGODB: [
8283
mongodb_username,
8384
mongodb_password,
@@ -89,5 +90,5 @@ module.exports = {
8990
kerberos_password
9091
],
9192
X509: [],
92-
PLAIN: []
93+
LDAP: []
9394
};

src/connect/index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ var ConnectView = View.extend({
3131
form: 'object',
3232
authMethod: {
3333
type: 'string',
34-
default: null
34+
default: 'NONE',
35+
values: [
36+
'NONE',
37+
'MONGODB',
38+
'KERBEROS',
39+
'X509',
40+
'LDAP'
41+
]
3542
},
3643
previousAuthMethod: {
3744
type: 'string',
@@ -156,7 +163,7 @@ var ConnectView = View.extend({
156163
if (this.authOpen) {
157164
this.authMethod = this.previousAuthMethod || 'MONGODB';
158165
} else {
159-
this.authMethod = null;
166+
this.authMethod = 'NONE';
160167
}
161168
},
162169
/**
@@ -198,14 +205,14 @@ var ConnectView = View.extend({
198205
this.reset();
199206
this.form.connection_id = '';
200207
this.form.reset();
201-
this.authMethod = null;
208+
this.authMethod = 'NONE';
202209
this.authOpen = false;
203210
},
204211
onConnectionDestroyed: function() {
205212
this.reset();
206213
this.form.connection_id = '';
207214
this.form.reset();
208-
this.authMethod = null;
215+
this.authMethod = 'NONE';
209216
this.authOpen = false;
210217
},
211218

@@ -362,6 +369,7 @@ var ConnectView = View.extend({
362369
onConnectionSelected: function(model) {
363370
// If the new model has auth, expand the auth settings container
364371
// and select the correct tab.
372+
model.authentication = model.authentication || 'NONE';
365373
this.authMethod = model.authentication;
366374

367375
if (model.authentication !== 'NONE') {

src/models/connection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ module.exports = Connection.extend({
2626
test: function(done) {
2727
var model = this;
2828
debug('Testing connection to `%j`...', this);
29-
client.test(app.endpoint, this, function(err) {
29+
client.test(app.endpoint, model.serialize({all: true}), function(err) {
3030
if (err) {
3131
bugsnag.notify(err, 'connection test failed');
3232
return done(err);
3333
}
3434

3535
debug('test worked!');
3636
debug('making sure we can get collection list...');
37-
client(app.endpoint, this).instance(function(err, res) {
37+
client(app.endpoint, model.serialize({all: true})).instance(function(err, res) {
3838
if (!err) {
3939
debug('woot. all gravy! able to see %s collections', res.collections.length);
4040
done(null, model);

0 commit comments

Comments
 (0)