Change user events tutorial Redis error to be an inline box
Fixes #1653
This commit is contained in:
parent
d240ad9a2c
commit
cb9a99fc7b
3 changed files with 19 additions and 3 deletions
|
@ -99,6 +99,8 @@ def user_test():
|
||||||
@require_session_login
|
@require_session_login
|
||||||
def user_subscribe():
|
def user_subscribe():
|
||||||
def wrapper(listener):
|
def wrapper(listener):
|
||||||
|
yield 'data: %s\n\n' % json.dumps({})
|
||||||
|
|
||||||
for event_id, data in listener.event_stream():
|
for event_id, data in listener.event_stream():
|
||||||
message = {'event': event_id, 'data': data}
|
message = {'event': event_id, 'data': data}
|
||||||
json_string = json.dumps(message)
|
json_string = json.dumps(message)
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
Your browser does not support features required for this tour. Please upgrade and try again.
|
Your browser does not support features required for this tour. Please upgrade and try again.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="co-alert co-alert-warning" ng-show="step.signal.$hasError">
|
||||||
|
There was an error registering to listen for server side events. Steps of the tutorial may not be
|
||||||
|
possible. If this problem persists, please contact support.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tour-contents" ng-show="supported">
|
<div class="tour-contents" ng-show="supported">
|
||||||
<div class="step-title" ng-shpw="step.title">{{ step.title }}</div>
|
<div class="step-title" ng-shpw="step.title">{{ step.title }}</div>
|
||||||
<div class="slide-animate-container">
|
<div class="slide-animate-container">
|
||||||
|
|
|
@ -284,11 +284,20 @@ angular.module("angular-tour", [])
|
||||||
var fullUrl = tourScope._replaceData(url);
|
var fullUrl = tourScope._replaceData(url);
|
||||||
checker.$source = new EventSource(fullUrl);
|
checker.$source = new EventSource(fullUrl);
|
||||||
checker.$source.onmessage = function(e) {
|
checker.$source.onmessage = function(e) {
|
||||||
checker.$message = JSON.parse(e.data);
|
var parsed = JSON.parse(e.data);
|
||||||
|
if (!parsed['data']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checker.$message = parsed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
checker.$source.onopen = function(e) {
|
||||||
|
checker.$hasError = false;
|
||||||
|
};
|
||||||
|
|
||||||
checker.$source.onerror = function(e) {
|
checker.$source.onerror = function(e) {
|
||||||
bootbox.alert('Could not read user events from server due to a Redis issue. ' +
|
checker.$hasError = true;
|
||||||
' Please contact support.')
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue