loleaflet/src/core/Socket.js | 17 ++++++++++++++--- loleaflet/src/layer/tile/TileLayer.js | 1 - 2 files changed, 14 insertions(+), 4 deletions(-)
New commits: commit 8fac7d59b49e223f41daaa23431852fd50a6dcc6 Author: Henry Castro <hcas...@collabora.com> Date: Fri Apr 15 00:10:43 2016 -0400 loleaflet: friendly messages when socket is closed diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index ed15923..22561ab 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -11,7 +11,7 @@ L.Socket = L.Class.extend({ try { this.socket = new WebSocket(map.options.server + '/' + map.options.doc); } catch (e) { - this.fire('error', {msg: _('Socket connection error: ' + e), cmd: 'socket', kind: 'failed', id: 3}); + this.fire('error', {msg: _('Oops, there is a problem connecting to LibreOffice Online : ' + e), cmd: 'socket', kind: 'failed', id: 3}); return null; } this._msgQueue = []; @@ -146,6 +146,9 @@ L.Socket = L.Class.extend({ } else if (textMsg.startsWith('statusindicator:')) { this._map.showBusy('Connecting...', false); + if (textMsg.match('statusindicator: fail')) { + this._map.fail = true; + } } else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:')) { // log the tile msg separately as we need the tile coordinates @@ -238,11 +241,19 @@ L.Socket = L.Class.extend({ }, _onSocketError: function () { - this.fire('error', {msg: _('Socket connection error'), cmd: 'socket', kind: 'failed', id: 3}); + this.hideBusy(); + this.fire('error', {msg: _('Oops, there is a problem connecting to LibreOffice Online. Please contact your webmaster.'), cmd: 'socket', kind: 'failed', id: 3}); }, _onSocketClose: function () { - this.fire('error', {msg: _('Socket connection closed'), cmd: 'socket', kind: 'closed', id: 4}); + this.hideBusy(); + if (this.fail) { + this.fire('error', {msg: _('Well, this is embarrassing, we cannot connect to your document. Please try again.'), cmd: 'socket', kind: 'closed', id: 4}); + } + else { + this.fire('error', {msg: _('We are sorry, this is an unexpected connection error. Please try again.'), cmd: 'socket', kind: 'closed', id: 4}); + } + this._map.fail = false; }, parseServerCmd: function (msg) { diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index c7a1172..9a8dbe9 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -773,7 +773,6 @@ L.TileLayer = L.GridLayer.extend({ if (e.msg) { this._map.setPermission('view'); } - this._map.hideBusy(); }, _onTileRemove: function (e) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits