1 angular.module('console.node', [])
3 .controller('nodeCtrl', function($scope, SwitchSvc) {
6 // Fetch the node then fetch more info about each node
7 SwitchSvc.nodeUrl().getList().then(function(npData) {
8 $scope.npData = npData.nodeProperties;
12 .config(function ($stateProvider) {
13 var access = routingConfig.accessLevels;
14 $stateProvider.state('node', {
17 templateUrl: 'node/root.tpl.html'
20 $stateProvider.state('node.index', {
25 templateUrl: 'node/index.tpl.html',
26 controller: ['$scope', 'SwitchSvc', function ($scope, SwitchSvc) {
27 $scope.selectAll = function() {
28 console.log($('input[id^=select-node-]'));
29 if($("#checkAll")[0].checked) {
30 $scope.numberSelectedItems = $('input[id^=select-node-]').length;
33 $scope.numberSelectedItems = 0;
35 $('input[id^=select-node-]').each(function(i, el) {
36 el.checked = $("#checkAll")[0].checked;
40 $scope.unselect = function($event) {
41 if(!$event.target.checked) {
42 $("#checkAll")[0].checked = false;
43 $scope.numberSelectedItems--;
46 $scope.numberSelectedItems++;
49 $scope.svc = SwitchSvc;
50 $scope.numberSelectedItems = 0;
51 SwitchSvc.getAll(null).then(function(data) {
52 $scope.data = data[0];
61 $stateProvider.state('node.detail', {
62 url: '/:nodeType/:nodeId/detail',
66 templateUrl: 'node/detail.tpl.html',
67 controller: ['$scope', '$stateParams', 'SwitchSvc', function ($scope, $stateParams, SwitchSvc) {
68 SwitchSvc.nodeUrl(null, $stateParams.nodeType, $stateParams.nodeId).get().then(
73 // Filter function to remove ports with id 0
74 $scope.portNotNull = function (property) {
75 return property.nodeconnector.id !== "0";