Moved src/app/connection_manager to modules/connection_manager-resources
[dlux.git] / modules / connection_manager-resources / src / main / resources / connection_manager / connection_manager.controller.js
1 define (['app/connection_manager/connection_manager.module', 'app/connection_manager/connection_manager.services'], function(connection_manager) {
2
3   connection_manager.register.controller('rootConnectionManagerCtrl', ['$rootScope', function($rootScope) {
4     $rootScope['section_logo'] = 'logo_connection_manager';
5   }]);
6
7   connection_manager.register.controller('ConnectionManagerCtrl',  ['$scope', 'ConnectionManagerSvc', function ($scope, ConnectionManagerSvc) {
8     $scope.svc = ConnectionManagerSvc;
9     ConnectionManagerSvc.getAll(null).then(function(data) {
10       $scope.data = data[0];
11     });
12   }]);
13
14   connection_manager.register.controller('ConnectionManagerDiscoveryCtrl', ['$scope', 'ConnectionManagerSvc', '$state', function ($scope, ConnectionManagerSvc, $state) {
15     $scope.nodePort = 6633;
16     $scope.doDiscover = function () {
17       ConnectionManagerSvc.discover($scope.nodeId, $scope.nodeAddress, $scope.nodePort).then(
18         function () {
19           $state.transitionTo('connection_manager.index', null, { location: true, inherit: true, relative: $state.$current, notify: true });
20         },
21         function (error) {
22           $scope.error = error.data;
23         }
24       );
25     };
26   }]);
27 });