Merge pull request #544 in FS/freeswitch from ~STEFAN_YOHANSSON/freeswitch:bugfix/FS-8247-when-websocket-disconnections-go to master

* commit '6df703fc40fc89366bb9094c859e2c4a004c66e2':
  FS-8247 [verto_communicator] Waiting for server reconnection.
This commit is contained in:
Ítalo Rossi
2015-10-05 21:19:30 -05:00
5 changed files with 61 additions and 3 deletions

View File

@@ -128,12 +128,16 @@
);
};
$rootScope.openModal = function(templateUrl, controller) {
var modalInstance = $modal.open({
$rootScope.openModal = function(templateUrl, controller, _options) {
var options = {
animation: $scope.animationsEnabled,
templateUrl: templateUrl,
controller: controller,
});
};
angular.extend(options, _options);
var modalInstance = $modal.open(options);
modalInstance.result.then(
function(result) {
@@ -149,7 +153,33 @@
jQuery.material.init();
}
);
return modalInstance;
};
$rootScope.$on('ws.close', onWSClose);
$rootScope.$on('ws.login', onWSLogin);
var ws_modalInstance;
function onWSClose(ev, data) {
if(ws_modalInstance) {
return;
};
var options = {
backdrop: 'static',
keyboard: false
};
ws_modalInstance = $scope.openModal('partials/ws_reconnect.html', 'ModalWsReconnectController', options);
};
function onWSLogin(ev, data) {
if(!ws_modalInstance) {
return;
};
ws_modalInstance.close();
ws_modalInstance = null;
};
$scope.showAbout = function() {

View File

@@ -0,0 +1,15 @@
(function() {
'use strict';
angular
.module('vertoControllers')
.controller('ModalWsReconnectController', ModalWsReconnectController);
ModalWsReconnectController.$inject = ['$scope', 'storage', 'verto'];
function ModalWsReconnectController($scope, storage, verto) {
console.debug('Executing ModalWsReconnectController');
};
})();