Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/connect/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
5 changes: 2 additions & 3 deletions src/connect/connect-form-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -186,7 +185,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
})
Expand Down
18 changes: 16 additions & 2 deletions src/connect/filereader-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,10 +37,11 @@ module.exports = InputView.extend({
deps: ['inputValue'],
fn: function() {
if (this.inputValue.length === 0) {
return 'Choose certificate(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);
}
},
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/connect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var ConnectView = View.extend({
},
authMethod: {
type: 'string',
default: 'MONGODB'
default: 'NONE'
},
previousAuthMethod: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/connect/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

.form-item {
margin: 15px auto 15px;
width: 425px;
width: 450px;
overflow: auto;

> * {
Expand Down
8 changes: 5 additions & 3 deletions src/connect/ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var SERVER = {
fields: [
new FileReaderView({
name: 'ssl_ca',
multi: true,
label: 'Certificate Authority',
required: true
})
Expand All @@ -56,23 +57,24 @@ var ALL = {
fields: [
new FileReaderView({
name: 'ssl_ca',
multi: true,
label: 'Certificate Authority',
required: true
}),
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
})
]
Expand Down