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

rfix #5215

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