From 8fa675f8ec5ddb80c0fc3f7473a6913d5649fc1b Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Fri, 13 Nov 2015 08:51:51 +1100 Subject: [PATCH 1/4] renaming SSL field labels in connect dialog. --- src/connect/connect-form-view.js | 2 +- src/connect/index.less | 2 +- src/connect/ssl.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/connect/connect-form-view.js b/src/connect/connect-form-view.js index 8c224bdc47e..a0ad0b6d7b9 100644 --- a/src/connect/connect-form-view.js +++ b/src/connect/connect-form-view.js @@ -187,7 +187,7 @@ var ConnectFormView = FormView.extend({ template: require('./input-default.jade'), el: this.parent.queryByHook('saveas-subview'), name: 'name', - label: 'Name', + label: 'Favorite Name', placeholder: 'e.g. Shared Dev, QA Box, PRODUCTION', required: false }) diff --git a/src/connect/index.less b/src/connect/index.less index 4c3e311f74b..bc09bed0e67 100644 --- a/src/connect/index.less +++ b/src/connect/index.less @@ -131,7 +131,7 @@ .form-item { margin: 15px auto 15px; - width: 425px; + width: 450px; overflow: auto; > * { diff --git a/src/connect/ssl.js b/src/connect/ssl.js index b90de9ea9e8..d1213177093 100644 --- a/src/connect/ssl.js +++ b/src/connect/ssl.js @@ -61,18 +61,18 @@ var ALL = { }), new FileReaderView({ name: 'ssl_private_key', - label: 'Certificate Key', + label: 'Client Certificate Key', required: true }), new FileReaderView({ name: 'ssl_certificate', - label: 'Certificate', + label: 'Client Certificate', required: true }), new InputView({ template: inputTemplate, name: 'ssl_private_key_password', - label: 'Private Key Password', + label: 'Client Key Password', required: false }) ] From 6ae03f640c24636c00dbbf3f254642377921cc96 Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Fri, 13 Nov 2015 10:58:37 +1100 Subject: [PATCH 2/4] INT-812 make None the default authentication method --- src/connect/behavior.js | 2 +- src/connect/connect-form-view.js | 3 +-- src/connect/index.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/connect/behavior.js b/src/connect/behavior.js index caa7148bec3..04060b96c51 100644 --- a/src/connect/behavior.js +++ b/src/connect/behavior.js @@ -108,7 +108,7 @@ module.exports = State.extend({ switch (action) { case 'new connection clicked': newState = 'NEW_EMPTY'; - view.authMethod = 'MONGODB'; + view.authMethod = 'NONE'; view.sslMethod = 'NONE'; view.form.reset(); view.message = ''; diff --git a/src/connect/connect-form-view.js b/src/connect/connect-form-view.js index d1e1a3d1999..0f37d9a9c37 100644 --- a/src/connect/connect-form-view.js +++ b/src/connect/connect-form-view.js @@ -148,8 +148,7 @@ var ConnectFormView = FormView.extend({ // you can pass in a collection here too options: enabledAuthOptions, // and pick an item from the collection as the selected one - // @todo thomasr: pick the "model.selected" one (via .find() ?) - value: enabledAuthOptions.get('MONGODB'), + value: enabledAuthOptions.get('NONE'), // here you specify which attribute on the objects in the collection // to use for the value returned. idAttribute: '_id', diff --git a/src/connect/index.js b/src/connect/index.js index f2a81c8dca5..463bbdc4c18 100644 --- a/src/connect/index.js +++ b/src/connect/index.js @@ -47,7 +47,7 @@ var ConnectView = View.extend({ }, authMethod: { type: 'string', - default: 'MONGODB' + default: 'NONE' }, previousAuthMethod: { type: 'string', From e91c605a48943feca237fa1a91dc38fd5e4ce6d2 Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Fri, 13 Nov 2015 11:23:52 +1100 Subject: [PATCH 3/4] renamed file picker label `Choose certificate(s)` to `Chose file(s)`. --- src/connect/filereader-view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connect/filereader-view.js b/src/connect/filereader-view.js index 31066f4c266..971449ec29b 100644 --- a/src/connect/filereader-view.js +++ b/src/connect/filereader-view.js @@ -31,7 +31,7 @@ module.exports = InputView.extend({ deps: ['inputValue'], fn: function() { if (this.inputValue.length === 0) { - return 'Choose certificate(s)'; + return 'Choose file(s)'; } else if (this.inputValue.length === 1) { return path.basename(this.inputValue[0]); } From 7e051469482e0cedb7d37b0c5dce45fd8b66b301 Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Fri, 13 Nov 2015 11:32:32 +1100 Subject: [PATCH 4/4] allow multiple CAs but only single client key/cert see: http://mongodb.github.io/node-mongodb-native/2.0/tutorials/enterprise_features/ --- src/connect/filereader-view.js | 18 ++++++++++++++++-- src/connect/ssl.js | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/connect/filereader-view.js b/src/connect/filereader-view.js index 971449ec29b..7af4be0ef23 100644 --- a/src/connect/filereader-view.js +++ b/src/connect/filereader-view.js @@ -7,12 +7,18 @@ var BrowserWindow = remote.require('browser-window'); var format = require('util').format; var bindings = require('ampersand-dom-bindings'); var fileReaderTemplate = require('./filereader-default.jade'); +var assert = require('assert'); // var debug = require('debug')('scout:connect:filereader-view'); module.exports = InputView.extend({ template: fileReaderTemplate, props: { + multi: { + type: 'boolean', + required: true, + default: false + }, inputValue: { type: 'array', required: true, @@ -31,10 +37,11 @@ module.exports = InputView.extend({ deps: ['inputValue'], fn: function() { if (this.inputValue.length === 0) { - return 'Choose file(s)'; + return this.multi ? 'Choose file(s)' : 'Choose file'; } else if (this.inputValue.length === 1) { return path.basename(this.inputValue[0]); } + assert.equal(this.multi, true); return format('%d files selected', this.inputValue.length); } }, @@ -78,6 +85,9 @@ module.exports = InputView.extend({ */ initialize: function(spec) { spec = spec || {}; + if (spec.multi) { + this.multi = spec.multi; + } _.defaults(spec, {value: []}); this.invalidClass = 'has-error'; this.validityClassSelector = '.form-item-file'; @@ -173,8 +183,12 @@ module.exports = InputView.extend({ this.runTests(); }, loadFileButtonClicked: function() { + var properties = ['openFile']; + if (this.multi) { + properties.push('multiSelections'); + } dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), { - properties: ['openFile', 'multiSelections'] + properties: properties }, function(filenames) { this.inputValue = filenames || []; this.handleChange(); diff --git a/src/connect/ssl.js b/src/connect/ssl.js index d1213177093..c1f2faaf0d4 100644 --- a/src/connect/ssl.js +++ b/src/connect/ssl.js @@ -39,6 +39,7 @@ var SERVER = { fields: [ new FileReaderView({ name: 'ssl_ca', + multi: true, label: 'Certificate Authority', required: true }) @@ -56,6 +57,7 @@ var ALL = { fields: [ new FileReaderView({ name: 'ssl_ca', + multi: true, label: 'Certificate Authority', required: true }),