mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
Socket.js
adding check in socket service functions to ensure that socket exists before checking the status of hte socket connection
This commit is contained in:
@@ -162,6 +162,9 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
checkStatus: function() {
|
checkStatus: function() {
|
||||||
// Check connection status
|
// Check connection status
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if(self){
|
||||||
|
if(self.socket){
|
||||||
|
if(self.socket.socket){
|
||||||
if (self.socket.socket.connected) {
|
if (self.socket.socket.connected) {
|
||||||
self.scope.socketStatus = 'ok';
|
self.scope.socketStatus = 'ok';
|
||||||
}
|
}
|
||||||
@@ -173,15 +176,24 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
}
|
}
|
||||||
self.scope.socketTip = getSocketTip(self.scope.socketStatus);
|
self.scope.socketTip = getSocketTip(self.scope.socketStatus);
|
||||||
return self.scope.socketStatus;
|
return self.scope.socketStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
on: function (eventName, callback) {
|
on: function (eventName, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if(self){
|
||||||
|
if(self.socket){
|
||||||
self.socket.on(eventName, function () {
|
self.socket.on(eventName, function () {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
self.scope.$apply(function () {
|
self.scope.$apply(function () {
|
||||||
callback.apply(self.socket, args);
|
callback.apply(self.socket, args);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
emit: function (eventName, data, callback) {
|
emit: function (eventName, data, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user