mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
fixing statusTip and socketStatus
This commit is contained in:
@@ -30,13 +30,15 @@ export default
|
|||||||
$log.debug('Websocket Error Logged: ' + error); //log errors
|
$log.debug('Websocket Error Logged: ' + error); //log errors
|
||||||
};
|
};
|
||||||
|
|
||||||
self.socket.onclose = function (error) {
|
self.socket.onclose = function () {
|
||||||
$log.debug('Websocket Disconnected: '+error);
|
$log.debug('Websocket Disconnected');
|
||||||
self.checkStatus();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.socket.onmessage = this.onMessage;
|
self.socket.onmessage = this.onMessage;
|
||||||
|
setTimeout(function() {
|
||||||
|
self.checkStatus();
|
||||||
|
$log.debug('Socket Status: ' + $rootScope.socketStatus);
|
||||||
|
}, 2000);
|
||||||
return self.socket;
|
return self.socket;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -44,11 +46,6 @@ export default
|
|||||||
$rootScope.sessionTimer.expireSession('idle');
|
$rootScope.sessionTimer.expireSession('idle');
|
||||||
$location.url('/login');
|
$location.url('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
self.checkStatus();
|
|
||||||
$log.debug('socket status: ' + $rootScope.socketStatus);
|
|
||||||
}, 2000);
|
|
||||||
},
|
},
|
||||||
onMessage: function(e){
|
onMessage: function(e){
|
||||||
$log.debug('Received From Server: ' + e.data);
|
$log.debug('Received From Server: ' + e.data);
|
||||||
@@ -114,35 +111,22 @@ export default
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkStatus: function() {
|
checkStatus: function() {
|
||||||
function getSocketTip(status) {
|
|
||||||
var result = '';
|
|
||||||
switch(status) {
|
|
||||||
case 'error':
|
|
||||||
result = "Live events: error connecting to the Tower server.";
|
|
||||||
break;
|
|
||||||
case 'connecting':
|
|
||||||
result = "Live events: attempting to connect to the Tower server.";
|
|
||||||
break;
|
|
||||||
case "ok":
|
|
||||||
result = "Live events: connected. Pages containing job status information will automatically update in real-time.";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// Check connection status
|
|
||||||
var self = this;
|
var self = this;
|
||||||
if(self){
|
if(self){
|
||||||
if(self.socket){
|
if(self.socket){
|
||||||
if (self.socket.readyState === 0 ) {
|
if (self.socket.readyState === 0 ) {
|
||||||
$rootScope.socketStatus = 'connecting';
|
$rootScope.socketStatus = 'connecting';
|
||||||
|
$rootScope.socketTip = "Live events: attempting to connect to the Tower server.";
|
||||||
}
|
}
|
||||||
else if (self.socket.readyState === 1){
|
else if (self.socket.readyState === 1){
|
||||||
$rootScope.socketStatus = 'ok';
|
$rootScope.socketStatus = 'ok';
|
||||||
|
$rootScope.socketTip = "Live events: connected. Pages containing job status information will automatically update in real-time.";
|
||||||
}
|
}
|
||||||
else if (self.socket.readyState === 2 || self.socket.readyState === 3 ){
|
else if (self.socket.readyState === 2 || self.socket.readyState === 3 ){
|
||||||
$rootScope.socketStatus = 'error';
|
$rootScope.socketStatus = 'error';
|
||||||
|
$rootScope.socketTip = "Live events: error connecting to the Tower server.";
|
||||||
}
|
}
|
||||||
self.socketTip = getSocketTip(self.socketStatus);
|
return;
|
||||||
return $rootScope.socketStatus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user