Connection Manager 56/2656/4
authorEndre Karlson <endre.karlson@gmail.com>
Tue, 12 Nov 2013 10:49:11 +0000 (11:49 +0100)
committerAndrew Kim <andrekim@cisco.com>
Mon, 18 Nov 2013 21:50:21 +0000 (15:50 -0600)
Change-Id: Iaedfd87cbd13b4c5c39cf96efda153f3a42864b3
Signed-off-by: Endre Karlson <endre.karlson@gmail.com>
12 files changed:
src/app/app.js
src/app/connection_manager/connection_manager.js [new file with mode: 0644]
src/app/connection_manager/discover.tpl.html [moved from src/app/node/discover.tpl.html with 99% similarity]
src/app/connection_manager/index.tpl.html [new file with mode: 0644]
src/app/connection_manager/root.tpl.html [new file with mode: 0644]
src/app/navigation.js
src/app/node/nodes.js
src/app/node/root.tpl.html
src/common/api-services.js
src/config.js
src/index.html
src/less/main.less

index f69c7f1008263a5f1fe4fd8abd47cfef2c85ffb7..8669273a5d3fc58af1cc757ffcc7d8a90bcf8b49 100644 (file)
@@ -18,6 +18,7 @@ var dlux = angular.module('dlux', [
   'dlux.directives.general',
   'dlux.directives.topology',
   'dlux.container',
+  'dlux.connection_manager',
   'dlux.flow',
   'dlux.node',
   'dlux.networking',
diff --git a/src/app/connection_manager/connection_manager.js b/src/app/connection_manager/connection_manager.js
new file mode 100644 (file)
index 0000000..f0cc66c
--- /dev/null
@@ -0,0 +1,70 @@
+angular.module('dlux.connection_manager', [])
+
+.config(function ($stateProvider) {
+  $stateProvider.state('connection_manager', {
+    abstract: true,
+    url: '/connection_manager',
+    templateUrl: 'connection_manager/root.tpl.html'
+  });
+
+  $stateProvider.state('connection_manager.index', {
+    url: '/index',
+    templateUrl: 'connection_manager/index.tpl.html',
+    views: {
+      '': {
+        templateUrl: 'connection_manager/index.tpl.html',
+        controller: function ($scope, ConnectionManagerSvc) {
+          $scope.svc = ConnectionManagerSvc;
+
+          $scope.gridOptions = {
+            data: 'data["node"]',
+            selectedItems: [],
+            enableRowSelection: true,
+            showSelectionCheckbox: true,
+            selectWithCheckboxOnly: true,
+            columnDefs: [
+              {
+                field: 'id', displayName: 'ID',
+              },
+              {
+                field: 'type', displayName: 'Type',
+              }
+            ]
+          };
+
+          $scope.$watch(
+            function () {
+              return ConnectionManagerSvc.data;
+            },
+            function (data) {
+              $scope.data = data;
+            }
+          );
+        }
+      }
+    }
+  });
+
+  $stateProvider.state('connection_manager.discover', {
+    url: '/discover',
+    views: {
+      '': {
+        templateUrl: 'connection_manager/discover.tpl.html',
+        controller: function ($scope, SwitchSvc, ConnectionManagerSvc) {
+          $scope.nodePort = 6633;
+
+          $scope.doDiscover = function () {
+            ConnectionManagerSvc.discover($scope.nodeId, $scope.nodeAddress, $scope.nodePort).then(
+              function () {
+                $scope.$state.go('connection_manager.index');
+              },
+              function (error) {
+                $scope.error = error.data;
+              }
+            );
+          };
+        }
+      }
+    }
+  });
+});
similarity index 99%
rename from src/app/node/discover.tpl.html
rename to src/app/connection_manager/discover.tpl.html
index 419b14638c03efcb93ddb9d752c40187ea46faec..86d9a19d74dccfca59e212d58c433bc87102f7d5 100644 (file)
@@ -5,6 +5,7 @@
             <label for="nodeId" class="control-label">ID / Name</label>
             <input type="text" class="form-control input-sm" id="nodeId" ng-model="nodeId" placeholder="Example: management-switch01" required>
         </div>
+
         <div class="form-group">
             <label for="nodeAddress" class="control-label">Address</label>
             <input type="text" class="form-control input-sm" id="nodeAddress" ng-model="nodeAddress" placeholder="Example: 10.0.0.1" required>
diff --git a/src/app/connection_manager/index.tpl.html b/src/app/connection_manager/index.tpl.html
new file mode 100644 (file)
index 0000000..0efd419
--- /dev/null
@@ -0,0 +1,3 @@
+<ctrl-reload service="svc"></ctrl-reload>
+<show-selected data="gridOptions.selectedItems"></show-selected>
+<div class="indexGrid" ng-grid="gridOptions"></div>
diff --git a/src/app/connection_manager/root.tpl.html b/src/app/connection_manager/root.tpl.html
new file mode 100644 (file)
index 0000000..1cdbe7f
--- /dev/null
@@ -0,0 +1,11 @@
+<div class="menu">
+  <ul class="nav nav-pills">
+    <li ng-class="{ active: $state.includes('connection_manager.index') }"><a ui-sref="connection_manager.index()">Home</a></li>
+    <li ng-class="{ active: $state.includes('connection_manager.discover') }"><a ui-sref="connection_manager.discover()">Discover</a></li>
+  </ul>
+
+  <!-- For child state use-->
+  <div ui-view="submenu"></div>
+</div>
+
+<div ui-view></div>
index 8facc3d14514e45058ed6930bd7c242f0cd693fa..0ee55ccd052e70f4c51301b6ff0e37d275be4d4a 100644 (file)
@@ -54,10 +54,9 @@ angular.module('dlux.navigation', [])
     if (stateToServices[stateBase] !== undefined) {
       svcName = stateToServices[stateBase];
     } else {
-      svcName = _.str.capitalize(stateBase) + 'Svc';
+      svcName = _.string.capitalize(_.string.camelize(stateBase)) + 'Svc';
     }
 
-
     if (!$injector.has(svcName)) {
       $scope.menu = null;
       return;
index c50e1d2e021715c99a8be0fc05beb9db186986d9..b7d22af55d254c543eb9ff06da1206fd2ca2ae14 100644 (file)
@@ -55,28 +55,6 @@ angular.module('dlux.node', [])
     }
   });
 
-  $stateProvider.state('node.discover', {
-    url: '/discover',
-    views: {
-      '': {
-        templateUrl: 'node/discover.tpl.html',
-        controller: function ($scope, SwitchSvc, ConnectionManagerSvc) {
-          $scope.nodePort = 6633;
-
-          $scope.doDiscover = function () {
-            ConnectionManagerSvc.discover($scope.nodeId, $scope.nodeAddress, $scope.nodePort).then(
-              function () {
-                $scope.$state.go('node.index');
-              },
-              function (error) {
-                $scope.error = error.data;
-              }
-            );
-          };
-        }
-      }
-    }
-  });
 
   $stateProvider.state('node.detail', {
     url: '/{nodeType}/{nodeId}/detail',
index d395de6bf9bb22e3d25767c394daed6b2f3decd4..4a3c7b5523dd74d8a8b3b05fea2d9a4e7d7f511c 100644 (file)
@@ -1,7 +1,6 @@
 <div class="menu">
   <ul class="nav nav-pills">
     <li ng-class="{ active: $state.includes('node.index') }"><a ui-sref="node.index()">Home</a></li>
-    <li ng-class="{ active: $state.includes('node.discover') }"><a ui-sref="node.discover()">Discover</a></li>
   </ul>
 
   <!-- For child state use-->
index 6266bf5ca0f00e21513e66a9d0ada799936900d3..3f179d09a100b59958f7097613c90af2eec75c8a 100644 (file)
@@ -135,7 +135,7 @@ angular.module('dlux.nbapi', [])
   };
 
   svc.getAll = function () {
-    Restangular.one('connectionmanager').one('nodes').then(function (data) {
+    Restangular.one('connectionmanager').one('nodes').getList().then(function (data) {
       svc.data = data;
     });
   };
index 220989e4e72f8d8b87e26ca1dcbc6912743d591c..793670619be1b61a1fff12f19bb2ee7a39c83ace 100644 (file)
@@ -3,7 +3,7 @@ NOTE: Configure these values before doing any grunt task to build the applicatio
 These are available from the root scope and elsewhere.
 */
 var endpoint_proto = 'http';
-var endpoint_host = 'localhost';
+var endpoint_host = 'odl.cloudistic.me';
 var endpoint_port = '8080';
 var endpoint_path = '/controller/nb/v2';
 
index 84c43e3e1cdd8366fe0d38755e415da9b92e40e2..317768db25d3a56e2d0ad9fa19ecf350bcfd8cf9 100644 (file)
@@ -60,6 +60,9 @@
               <li is-active state="node">
                 <brd-anchor label="Nodes" state="node.index"></brd-anchor>
               </li>
+              <li is-active state="connection_manager">
+                <brd-anchor label="Connection Manager" state="connection_manager.index">
+              </brd-anchor>
               <li is-active state="flow">
                 <brd-anchor label="Flows" state="flow.index"></brd-anchor>
               <li>
index 59e53b9b1e2d34bd3f7b51f9f8d051db0b2bf662..1c1d791f21aa36ce6cd5472bf76fd8168e93a358 100644 (file)
@@ -97,6 +97,7 @@ body, html {
         border-radius: 5px 5px 0 0;
         border: 1px solid #ccc;
         height: 175px;
+        overflow-y: auto;
         .title {
           background-image: linear-gradient(to bottom, #eee, #ccc);
           color: #222;