Commit 1b796767 authored by Evren Kutar's avatar Evren Kutar

rfix #5215

parent 1e86199b
......@@ -22,7 +22,7 @@ angular.module('ulakbus')
}
if (prtcl === 'ws') {
rejection.status = rejection.status || rejection.code;
rejection.data = {error: rejection.error};
rejection.data = {error: rejection.error, title: rejection.title};
errorInModal = true;
}
......@@ -62,13 +62,16 @@ angular.module('ulakbus')
'</div>' +
'</div>' +
'</div>').modal();
try {
$('pre:not(.hljs)').each(function (i, block) {
hljs.highlightBlock(block);
});
}
catch (e) {
$log.debug('Exception: ', e.message);
// use no_highlight to display pure html
if (!rejection.no_highlight) {
try {
$('pre:not(.hljs)').each(function (i, block) {
hljs.highlightBlock(block);
});
}
catch (e) {
$log.debug('Exception: ', e.message);
}
}
};
......
......@@ -33,27 +33,42 @@ angular.module('ulakbus')
var websocket;
var refresh_count = 0;
var refresh_websocket = refresh_count < 5 ? 1000 : 5000;
var isSupported = function() {
// return "WebSocket" in window;
return false;
};
var generate_ws = function () {
$log.info('Openning web socket...');
websocket = new WS(WSUri.url);
websocket.onopen = function (evt) {
wsOps.onOpen(evt);
refresh_count = 0;
};
websocket.onclose = function (evt) {
wsOps.onClose(evt);
if (wsOps.loggedOut === true) {return;}
$timeout(function () {
generate_ws();
refresh_count += 1;
}, refresh_websocket);
};
websocket.onmessage = function (evt) {
wsOps.onMessage(evt)
};
websocket.onerror = function (evt) {
wsOps.onError(evt)
};
if (isSupported()) {
$log.info('Openning web socket...');
websocket = new WS(WSUri.url);
websocket.onopen = function (evt) {
wsOps.onOpen(evt);
refresh_count = 0;
};
websocket.onclose = function (evt) {
wsOps.onClose(evt);
if (wsOps.loggedOut === true) {return;}
$timeout(function () {
generate_ws();
refresh_count += 1;
}, refresh_websocket);
};
websocket.onmessage = function (evt) {
wsOps.onMessage(evt)
};
websocket.onerror = function (evt) {
wsOps.onError(evt)
};
} else {
var error = {
error: "Tarayıcınız websocket desteklememektedir. Lütfen güncel bir tarayıcı kullanınız.",
code: 500,
title: "Uyumsuz Tarayıcı",
no_highlight: true
};
ErrorService.handle(error, "ws");
}
};
var wsOps = {};
......
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