Commit e973f1a3 authored by Bas Lijnse's avatar Bas Lijnse

Added showing of lost connections to the client framework

parent 1b14c2d4
......@@ -38,6 +38,9 @@ div.#{$prefix}loader-spinner {
from { transform: rotate(0deg); }
to { transform: rotate(359deg); }
}
div.#{$prefix}exception {
text-align: center;
}
.#{$prefix}vcontainer, .#{$prefix}hcontainer {
display: flex;
......
......@@ -133,6 +133,9 @@ div.itasks-loader-spinner {
transform: rotate(0deg); }
to {
transform: rotate(359deg); } }
div.itasks-exception {
text-align: center; }
.itasks-vcontainer, .itasks-hcontainer {
display: flex;
align-items: flex-start; }
......
......@@ -211,6 +211,10 @@ itasks.Component = {
el = me.containerEl,
horizontal = (me.attributes.direction && (me.attributes.direction === 'horizontal')) || false,
paddingTop, paddingBottom;
if(me.container === false) {
return;
}
el.classList.add(me.cssPrefix + (horizontal ? 'hcontainer' : 'vcontainer'));
......@@ -445,8 +449,9 @@ itasks.Loader = {
};
itasks.ExceptionView = {
cssCls: 'exception',
container: false,
initDOMEl: function() {
this.domEl.innerHTML = this.attributes.value || '';
this.domEl.innerHTML = '<h1>Exception</h1><span>' + (this.attributes.value || '') + '</span>';
}
};
itasks.Viewport = {
......@@ -595,6 +600,7 @@ itasks.Connection = {
};
me.wsock.onmessage = me.onMessage_.bind(me);
me.wsock.onerror = me.onError_.bind(me);
me.wsock.onclose = me.onClose_.bind(me);
},
_ping: function() {
var me = this, reqId = me.reqId++;
......@@ -658,13 +664,16 @@ itasks.Connection = {
me.wsock.close();
me.wsock = null;
}
},
onError_: function(e) {
Object.values(me.taskInstanceCallbacks).forEach(function(callbacks) { callbacks.onException(e);});
Object.values(this.taskInstanceCallbacks).forEach(function(callbacks) { callbacks.onException(e);});
},
onReset_: function(e) {
Object.values(me.taskInstanceCallbacks).forEach(function(callbacks) { callbacks.onException(e);});
Object.values(this.taskInstanceCallbacks).forEach(function(callbacks) { callbacks.onException(e);});
},
onClose_: function(e) {
//If there are still attached task instances, we consider it an exeption for those viewports
Object.values(this.taskInstanceCallbacks).forEach(function(callbacks) { callbacks.onException("The connection to the server closed unexpectedly");});
},
onMessage_: function(e) {
var me = this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment