From 5de086b736218d43bd51c3b83ca26118806488a2 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 14 Aug 2014 17:40:27 +0100 Subject: More helpful display when the event stream fails, wiping it when the connection is regained. --- webclient/room/room-controller.js | 10 ++++++---- webclient/room/room.html | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index 8003105654..fb6e2025fc 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -25,7 +25,8 @@ angular.module('RoomController', []) user_id: matrixService.config().user_id, events_from: "END", // when to start the event stream from. earliest_token: "END", // stores how far back we've paginated. - can_paginate: true + can_paginate: true, // this is toggled off when we run out of items + stream_failure: undefined // the response when the stream fails }; $scope.messages = []; $scope.members = {}; @@ -76,7 +77,7 @@ angular.module('RoomController', []) } }, function(error) { - console.log("paginateBackMessages Ruh roh: " + JSON.stringify(error)); + console.log("Failed to paginateBackMessages: " + JSON.stringify(error)); } ) }; @@ -89,6 +90,7 @@ angular.module('RoomController', []) "timeout": 5000 }}) .then(function(response) { + $scope.state.stream_failure = undefined; console.log("Got response from "+$scope.state.events_from+" to "+response.data.end); $scope.state.events_from = response.data.end; $scope.feedback = ""; @@ -102,7 +104,7 @@ angular.module('RoomController', []) $timeout(shortPoll, 0); } }, function(response) { - $scope.feedback = "Can't stream: " + response.data; + $scope.state.stream_failure = response; if (response.status == 403) { $scope.stopPoll = true; @@ -215,7 +217,7 @@ angular.module('RoomController', []) // Join the room matrixService.join($scope.room_id).then( function() { - console.log("Joined room"); + console.log("Joined room "+$scope.room_id); // Now start reading from the stream $timeout(shortPoll, 0); diff --git a/webclient/room/room.html b/webclient/room/room.html index 0f86a158ec..3b9ba713de 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -86,7 +86,10 @@ - + +
+ {{ state.stream_failure.data.error || "Connection failure" }} +
-- cgit 1.4.1