Merge branch 'connect-failed'

This commit is contained in:
Henry Oswald 2015-10-07 11:30:48 +01:00
commit a73b2ceb37
2 changed files with 11 additions and 1 deletions

View file

@ -13,7 +13,9 @@ block content
h3 #{translate("loading")}... h3 #{translate("loading")}...
.progress .progress
.progress-bar(style="width: 20%", ng-style="{'width': state.load_progress + '%'}") .progress-bar(style="width: 20%", ng-style="{'width': state.load_progress + '%'}")
p.text-center.text-danger(ng-if="state.error").ng-cloak {{ state.error }} p.text-center.text-danger(ng-if="state.error").ng-cloak
span(ng-bind-html="state.error")
.global-alerts(ng-cloak) .global-alerts(ng-cloak)
.alert.alert-danger.small(ng-if="connection.forced_disconnect") .alert.alert-danger.small(ng-if="connection.forced_disconnect")

View file

@ -29,6 +29,7 @@ define [], () ->
@ide.socket = io.connect null, @ide.socket = io.connect null,
reconnect: false reconnect: false
'connect timeout': 30 * 1000
"force new connection": true "force new connection": true
@ide.socket.on "connect", () => @ide.socket.on "connect", () =>
@ -44,6 +45,13 @@ define [], () ->
@joinProject() @joinProject()
, 100) , 100)
@ide.socket.on "connect_failed", () =>
@connected = false
$scope.$apply () =>
@$scope.state.error = "Unable to connect, please view the <u><a href='http://sharelatex.tenderapp.com/help/kb/latex-editor/editor-connection-problems'>connection problems guide</a></u> to fix the issue."
@ide.socket.on 'disconnect', () => @ide.socket.on 'disconnect', () =>
@connected = false @connected = false
@ide.pushEvent("disconnected") @ide.pushEvent("disconnected")