diff --git a/res/app/components/stf/user/user-service.js b/res/app/components/stf/user/user-service.js index c6d32b3a..064f8c1a 100644 --- a/res/app/components/stf/user/user-service.js +++ b/res/app/components/stf/user/user-service.js @@ -1,4 +1,4 @@ -module.exports = function UserServiceFactory($http, $rootScope, socket) { +module.exports = function UserServiceFactory($http, $rootScope, socket, $timeout) { var userService = {} userService.user = (function () { @@ -8,23 +8,24 @@ module.exports = function UserServiceFactory($http, $rootScope, socket) { } })() - socket.on('forward.create', function(data) { - userService.user().then(function(user) { - $rootScope.$apply(function() { - user.forwards.push(data) - }) - }) - }) - - socket.on('forward.remove', function(data) { - userService.user().then(function(user) { - $rootScope.$apply(function() { - user.forwards = user.forwards.filter(function(forward) { - return forward.devicePort !== data.devicePort - }) - }) - }) - }) + // TODO: Disabled for now +// socket.on('forward.create', function (data) { +// userService.user().then(function (user) { +// $timeout(function () { +// user.forwards.push(data) +// }) +// }) +// }) +// +// socket.on('forward.remove', function (data) { +// userService.user().then(function (user) { +// $timeout(function () { +// user.forwards = user.forwards.filter(function (forward) { +// return forward.devicePort !== data.devicePort +// }) +// }) +// }) +// }) return userService } diff --git a/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js b/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js index 1dc9aaa4..0a41ecb5 100644 --- a/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js +++ b/res/app/control-panes/advanced/port-forwarding/port-forwarding-controller.js @@ -1,6 +1,6 @@ var _ = require('lodash') -module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsService) { +module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsService, gettext) { $scope.forwarding = false @@ -23,6 +23,9 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ _.forEach(getPortSets(), function (portSet) { $scope.control.createForward(portSet).then(function (result) { console.log(result) + if (result.error === 'fail_forward') { + alert(gettext('Error: Forwarding ports failed.')) + } }).catch(function (err) { console.error(err) }) @@ -33,6 +36,9 @@ module.exports = function PortForwardingCtrl($scope, ngTableParams, SettingsServ _.forEach(getPortSets(), function (portSet) { $scope.control.removeForward(portSet).then(function (result) { console.log(result) + if (result.error) { + alert(result.error) + } }).catch(function (err) { console.error(err) })