Show nice error page if socket.io could not be loaded

This commit is contained in:
James Allen 2015-03-09 13:57:13 +00:00
parent d376acdaa9
commit bb61dfe34a
3 changed files with 11 additions and 1 deletions

View file

@ -13,6 +13,7 @@ block content
h3 #{translate("loading")}...
.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 }}
.global-alerts(ng-cloak)
.alert.alert-danger.small(ng-if="connection.forced_disconnect")
@ -74,7 +75,7 @@ block content
.modal-footer
button.btn.btn-info(ng-click="done()") #{translate("ok")}
script(src='#{settings.websocketsUrl}/socket.io/socket.io.js')
script(src='/socket.io/socket.io.js')
//- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
//- and doesn't prematurely end the script tag.

View file

@ -51,6 +51,7 @@ define [
$scope.state = {
loading: true
load_progress: 40
error: null
}
$scope.ui = {
leftMenuShown: false

View file

@ -1,6 +1,14 @@
define [], () ->
class ConnectionManager
constructor: (@ide, @$scope) ->
if !io?
console.error "Socket.io javascript not loaded. Please check that the real-time service is running and accessible."
@ide.socket =
on: () ->
$scope.$apply () =>
@$scope.state.error = "Could not connect to websocket server :("
return
@connected = false
@$scope.connection =