Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit aff1986

Browse files
committed
when connecting to a new connection setting the state of any existing connection to not-connected
1 parent 44db54d commit aff1986

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

css/obBase.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4214,6 +4214,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
42144214
42154215
#ov1 .server-connect-modal .modal-child {
42164216
height: 625px;
4217+
overflow: hidden;
42174218
}
42184219
42194220
#ov1 .server-connect-modal .message-bar {

js/router.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ module.exports = Backbone.Router.extend({
145145
},
146146

147147
launchPageConnectModal: function(config) {
148+
var defaults = {
149+
connectText: 'Connecting...',
150+
failedText: 'Unable to Connect.'
151+
};
152+
148153
if (!(
149154
config &&
150155
config.promise &&
@@ -153,11 +158,7 @@ module.exports = Backbone.Router.extend({
153158
throw new Error('At a minimum, the config must contain a config.promise.');
154159
}
155160

156-
var defaults = {
157-
connectText: 'Connecting...',
158-
failedText: 'Unable to Connect.'
159-
};
160-
161+
$('#loadingModal').addClass('hide');
161162
config = __.extend({}, defaults, config);
162163

163164
this.pageConnectModal && this.pageConnectModal.remove();

js/views/baseModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = baseVw.extend({
3434
},
3535

3636
__modalClick: function(e) {
37-
if (e.target === this.el) {
37+
if (this.__options.dismissOnOverlayClick && e.target === this.el) {
3838
this.close();
3939
}
4040
},

js/views/pageConnectModal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module.exports = baseModal.extend({
2323
this.options = options || {};
2424
this._state = {};
2525
this.setState(__.extend({}, defaultState, this.options.initialState || {}));
26-
$('#loadingModal').addClass('hide'); //hide modal if it is still visible
2726
},
2827

2928
setState: function(state) {

js/views/serverConnectModal.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var __ = require('underscore'),
1212
ServerConfigsVw = require('./serverConfigsVw');
1313

1414
module.exports = BaseModal.extend({
15-
className: 'server-connect-modal',
15+
className: 'server-connect-modal top0',
1616

1717
events: {
1818
'click .js-close': 'closeConfigForm',
@@ -126,6 +126,8 @@ module.exports = BaseModal.extend({
126126

127127
if (this.connectAttempt && this.connectAttempt.state() === 'pending') return this;
128128

129+
this.connectedServer = configMd;
130+
129131
this.serverConfigsVw.setConnectionState({
130132
id: configMd.id,
131133
status: 'connected'
@@ -146,6 +148,7 @@ module.exports = BaseModal.extend({
146148
var msg;
147149

148150
if (this.connectAttempt && this.connectAttempt.state() === 'pending') return this;
151+
if (this.connectedServer && this.connectedServer.id === configMd.id) this.connectedServer = null;
149152

150153
this.serverConfigsVw.setConnectionState({
151154
id: configMd.id,
@@ -178,6 +181,15 @@ module.exports = BaseModal.extend({
178181
this.connectAttempt && this.connectAttempt.cancel();
179182
this.hideMessageBar();
180183

184+
if (this.connectedServer) {
185+
this.serverConfigsVw.setConnectionState({
186+
id: this.connectedServer.id,
187+
status: 'not-connected'
188+
});
189+
190+
this.connectedServer = null;
191+
}
192+
181193
this.serverConfigsVw.setConnectionState({
182194
id: configMd.id,
183195
status: 'connecting'
@@ -194,6 +206,8 @@ module.exports = BaseModal.extend({
194206
this.connectAttempt = null;
195207
});
196208

209+
this.connectAttempt.serverId = configMd.id;
210+
197211
return this;
198212
},
199213

0 commit comments

Comments
 (0)