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

Commit 1263477

Browse files
committed
fixed issue where Server Connect modal was not popping when the heartbeat socket goes down
1 parent 15fc721 commit 1263477

File tree

5 files changed

+15
-245
lines changed

5 files changed

+15
-245
lines changed

js/Server.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

js/main.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var Polyglot = require('node-polyglot'),
5454
startUpConnectMaxTime = 6 * 1000,
5555
startTime = Date.now(),
5656
startUpRetry,
57+
removeStartupRetry,
5758
onActiveServerSync,
5859
extendPolyglot,
5960
newPageNavView,
@@ -391,7 +392,7 @@ launchOnboarding = function(guidCreating) {
391392
})()
392393

393394
pageConnectModal.on('cancel', () => {
394-
app.getHeartbeatSocket().off('close', startUpRetry);
395+
removeStartupRetry();
395396
app.getHeartbeatSocket().close();
396397
pageConnectModal.remove();
397398
app.serverConnectModal.open();
@@ -409,7 +410,7 @@ app.serverConnectModal.on('connected', (authenticated) => {
409410
});
410411

411412
app.getHeartbeatSocket().on('open', function(e) {
412-
app.getHeartbeatSocket().off('close', startUpRetry);
413+
removeStartupRetry();
413414
pageConnectModal.remove();
414415
$loadingModal.removeClass('hide');
415416
onboardingModal && onboardingModal.remove();
@@ -435,6 +436,14 @@ app.getHeartbeatSocket().on('close', (startUpRetry = function(e) {
435436
}
436437
}));
437438

439+
removeStartupRetry = function() {
440+
app.getHeartbeatSocket().off('close', startUpRetry);
441+
app.getHeartbeatSocket().on('close', () => {
442+
app.serverConnectModal.failConnection(null, app.serverConfigs.getActive())
443+
.open();
444+
});
445+
};
446+
438447
app.getHeartbeatSocket().on('message', function(e) {
439448
if (e.jsonData && e.jsonData.status) {
440449
switch (e.jsonData.status) {

js/templates/serverConnectModalOLD.html

Lines changed: 0 additions & 195 deletions
This file was deleted.

js/views/baseModal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ module.exports = baseVw.extend({
8181
}
8282

8383
// TODO: allow other options to be modifiable via this method.
84+
// TODO: any options passed in here will be merged with existing ones,
85+
// but what if you want to replace the options?? Perhaps this should
86+
// replace and then we need a getModalOptions function?
8487
},
8588

8689
remove: function() {

js/views/serverConnectModal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ module.exports = BaseModal.extend({
165165
}
166166

167167
reason !== 'canceled' && this.showMessageBar(msg);
168+
this.setModalOptions({ showCloseButton: false });
168169

169170
return this;
170171
},

0 commit comments

Comments
 (0)