[IMP] web: cleaner indicator when connection get lost

This commit is contained in:
Hitesh Trivedi
2015-02-20 16:45:48 +01:00
committed by Richard Mathot
parent 069e2be87d
commit 4cdc19198e
3 changed files with 42 additions and 0 deletions
+13
View File
@@ -35,6 +35,19 @@
border: 0;
}
.oe_indicator{
z-index: 99999;
position: absolute;
top: 10px;
display: inline-block;
color: white;
background: #a24689;
padding: 6px 16px;
border-radius: 4px;
box-shadow: 0 0 1px black;
left: 40%;
}
.oe_notification {
z-index: 1600;
}
+13
View File
@@ -144,6 +144,19 @@ $sheet-padding: 16px
border: 0
// Notifications {{{
.oe_indicator
z-index: 99999
position: absolute
top: 10px
display: inline-block
color: white
background: #a24689
padding: 6px 16px
border-radius: 4px
box-shadow: 0 0 1px black
left: 40%
.oe_notification
z-index: 1600
+16
View File
@@ -252,6 +252,22 @@ instance.web.CrashManager = instance.web.Class.extend({
if (!this.active) {
return;
}
if (error.code == -32098) {
$.blockUI({ message: '' , overlayCSS: {'z-index': 9999, backgroundColor: '#FFFFFF', opacity: 0.0, cursor: 'wait'}});
var $indicator = $('<div class="oe_indicator">' + _t("Trying to reconnect... ") + '<i class="fa fa-refresh fa-spin"></i></div>');
$indicator.prependTo("body");
var timeinterval = setInterval(function(){
openerp.jsonRpc('/web/webclient/version_info').then(function() {
clearInterval(timeinterval);
$indicator.html(_t("You are back online"));
$indicator.delay(2000).fadeOut('slow',function(){
$indicator.remove();
});
$.unblockUI();
});
}, 2000);
return;
}
var handler = instance.web.crash_manager_registry.get_object(error.data.name, true);
if (handler) {
new (handler)(this, error).display();