Merge changes from topic 'yangman'
authorMaxime Millette-Coulombe <mmcoulombe@inocybe.com>
Mon, 7 Nov 2016 13:15:57 +0000 (13:15 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 7 Nov 2016 13:15:57 +0000 (13:15 +0000)
* changes:
  Yangman - make elements accessible via ids - part1
  Yangman - view switched to json when request is run from history
  Yangman - hide show previous item icon if there are no data
  Remove version tags from modules/*/pom.xml
  Yangman - delayed progress bar is displayed
  Yangman - zero out Status and Time-update
  Yangman - Show all items box showed for a moment-update
  Yangman - Rpc output list is appending elements instead of replacing
  Yangman - fix fill node after put request

23 files changed:
archetype/src/main/resources/archetype-resources/__rootArtifactId__-bundle/pom.xml
dlux-web/config/env.module.js
features/pom.xml
features/src/main/features/features.xml
modules/common-authentication-resources/src/main/resources/authentification/auth.module.js
modules/common-authentication-resources/src/main/resources/authentification/auth.services.js
modules/common-authentication-resources/src/main/resources/authentification/auth.spec.js
modules/common-layout-resources/src/main/resources/layout/layout.module.js
modules/common-login-resources/src/main/resources/login/login.module.js
modules/common-navigation-resources/src/main/resources/navigation/nav_item_template.tpl.html
modules/common-navigation-resources/src/main/resources/navigation/navigation.controller.js
modules/common-navigation-resources/src/main/resources/navigation/navigation.module.js
modules/common-navigation-resources/src/main/resources/navigation/navigation.services.js
modules/common-navigation-resources/src/main/resources/navigation/navigation.spec.js
modules/common-navigation-resources/src/main/resources/navigation/navigation.tpl.html
modules/core-resources/src/main/resources/core/core.module.js
modules/core-resources/src/main/resources/core/core.services.js
modules/loader-resources/src/main/resources/test-main.js
modules/node-resources/src/main/resources/node/detail.tpl.html
modules/node-resources/src/main/resources/node/index.tpl.html
modules/node-resources/src/main/resources/node/nodes.controller.js
modules/node-resources/src/main/resources/node/nodes.services.js
modules/node-resources/src/main/resources/node/nodes.spec.js

index 8bc38fe01b469ec41e814073db6b220a46dd5bcf..07a3fb4fd82af743f01316dffc070605afa17e3d 100644 (file)
@@ -33,6 +33,7 @@
             <groupId>${groupId}</groupId>
             <artifactId>${rootArtifactId}-module</artifactId>
             <version>${version}</version>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
     <build>
@@ -61,7 +62,7 @@
                             <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
                             <groupId>${groupId}</groupId>
                             <includeArtifactIds>${rootArtifactId}-module</includeArtifactIds>
-                            <excludes>META-INF\/**</excludes>
+                            <excludes>META-INF\/**,*/node\/**,*/node_modules\/**</excludes>
                             <excludeTransitive>true</excludeTransitive>
                             <ignorePermissions>false</ignorePermissions>
                         </configuration>
index 6c9c6cee2d8f0a0521dc8ace370759398833775b..ae8301b53905db8ed6cf282a8c9d811caa2824b1 100644 (file)
@@ -1,32 +1,32 @@
-define(['angularAMD'], function(ng) {
-    'use strict';
+define(['angular'], function (angular) {
+  'use strict';
 
-    var config = angular.module('config', [])
-        .constant('ENV', {
+  var config = angular.module('config', [])
+    .constant('ENV', {
 
-                baseURL: "@@baseURL",
-                adSalPort: "@@adSalPort",
-                mdSalPort : "@@mdSalPort",
-                configEnv : "@@configEnv",
-                getBaseURL : function(salType){
-                    if(salType!==undefined){
-                        var urlPrefix = "";
-                        if(this.configEnv==="ENV_DEV"){
-                            urlPrefix = this.baseURL;
-                        }else{
-                            urlPrefix = window.location.protocol+"//"+window.location.hostname+":";
-                        }
+      baseURL: '@@baseURL',
+      adSalPort: '@@adSalPort',
+      mdSalPort: '@@mdSalPort',
+      configEnv: '@@configEnv',
+      getBaseURL: function (salType) {
+        if (salType !== undefined) {
+          var urlPrefix = '';
+          if (this.configEnv === 'ENV_DEV') {
+            urlPrefix = this.baseURL;
+          } else {
+            urlPrefix = window.location.protocol + '//' + window.location.hostname + ':';
+          }
 
-                        if(salType==="AD_SAL"){
-                            return urlPrefix + this.adSalPort;
-                        }else if(salType==="MD_SAL"){
-                            return  urlPrefix + this.mdSalPort;
-                        }
-                    }
-                    //default behavior
-                    return "";
-                }
-            });
+          if (salType === 'AD_SAL') {
+            return urlPrefix + this.adSalPort;
+          } else if (salType === 'MD_SAL') {
+            return urlPrefix + this.mdSalPort;
+          }
+        }
+        //default behavior
+        return '';
+      }
+    });
 
-    return config;
-});
\ No newline at end of file
+  return config;
+});
index f5ce7c8d4529074d27f346a7be48bffd794c90fe..de76f4886a86f27fc53961897c51f392c60a597a 100644 (file)
          <version>1.8.0-SNAPSHOT</version>
          <type>zip</type>
       </dependency>
-      <dependency>
-          <groupId>com.google.guava</groupId>
-          <artifactId>guava</artifactId>
-      </dependency>
       <dependency>
           <groupId>org.opendaylight.dlux</groupId>
           <artifactId>loader</artifactId>
index 8ee80f59b6ee5669ccb65206196e1a1fde66a90b..e056ce21a5d685615b0b2a49641af555ef6c9f72 100644 (file)
@@ -15,7 +15,6 @@
     <feature name='odl-dlux-core' version='${project.version}' description="Opendaylight dlux minimal feature">
         <feature>http</feature>
         <feature version="${restconf.version}">odl-restconf</feature>
-        <bundle>mvn:com.google.guava/guava/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.dlux/loader/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.dlux/loader.implementation/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.dlux/dlux.core/{{VERSION}}</bundle>
index 50be4dbf37b7f6b23b84bf799dc5f77f017c9889..ec953e40a9354f1e8ad58e9bbfa37b977d2bd734 100644 (file)
@@ -6,8 +6,14 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-define(['angularAMD', 'common/config/env.module'], function(ng) {
+define(['angular', './auth.services', 'common/config/env.module'], function (angular, services) {
+  'use strict';
   var auth = angular.module('app.common.auth', ['config']);
 
+  // services
+  auth.factory('Auth', services.Auth);
+  auth.factory('Base64', services.Base64);
+  auth.factory('NbInterceptor', services.NbInterceptor);
+
   return auth;
 });
index 89fde0f466ae011dd61c2b8e1b70e823fd607a28..4c81bbb547fbd70c4eb0e4ba235459ecbb23fb40 100644 (file)
@@ -6,79 +6,75 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-define(['common/authentification/auth.module'], function(auth) {
-
-  auth.factory('Auth', function($http, $window, Base64, ENV){
-          var factory = {};
-          // Set Authorization header to username + password
-          factory.setBasic = function(user, pw) {
-            $window.sessionStorage.odlUser = user;
-            $window.sessionStorage.odlPass = pw;
-          };
-
-          factory.unsetBasic = function() {
-              if ($http.defaults.headers.common.Authorization !== null) {
-                delete $http.defaults.headers.common.Authorization;
-              }
-              delete $window.sessionStorage.odlUser;
-              delete $window.sessionStorage.odlPass;
-          };
-
-          // Return the current user object
-          factory.getUser = function() {
-              var user = $window.sessionStorage.odlUser || null;
-              return user;
-          };
-
-          factory.authorize = function(accessLevel, role) {
-              if(role === undefined) {
-                  role = currentUser.role;
-              }
-              return accessLevel.bitMask & role.bitMask;
-          };
-          factory.isAuthed = function () {
-              var authed = factory.getUser() ? true : false;
-              return authed;
-          };
-          factory.isLoggedIn = function(user) {
-              if(user === undefined) {
-                  user = currentUser;
-              }
-              return user.role.title == userRoles.user.title || user.role.title == userRoles.admin.title;
-          };
-          /*factory.register = function(user, success, error) {
-              $http.post('/register', user).success(function(res) {
-                  changeUser(res);
-                  success();
-              }).error(error);
-          };*/
-          factory.login = function (user, pw, cb, eb) {
-              factory.setBasic(user, pw);
-              $http.get(ENV.getBaseURL("MD_SAL") + "/restconf/modules")
-                  .success(function (data, status, headers, config) {
-                    cb(data);
-                  })
-                  .error(function (resp) {
-                    if(resp.errors) {
-                        var errorDetails = resp.errors.error[0];
-                        if(errorDetails && errorDetails["error-tag"] === "data-missing") {
-                            // Authentication succeed, but API does not have data, allow to enter
-                            cb(resp);
-                            return;
-                        }
-                    }
-                    factory.unsetBasic();
-                    eb(resp);
-                  });
-          };
-          factory.logout = function(success) {
-                  factory.unsetBasic();
-                  success();
-          };
-          return factory;
-  });
-
-  auth.factory('Base64', function() {
+define([], function () {
+  'use strict';
+
+  var Auth = function ($http, $window, Base64, ENV) {
+    var factory = {};
+    // Set Authorization header to username + password
+    factory.setBasic = function (user, pw) {
+      $window.sessionStorage.odlUser = user;
+      $window.sessionStorage.odlPass = pw;
+    };
+
+    factory.unsetBasic = function () {
+      if ($http.defaults.headers.common.Authorization !== null) {
+        delete $http.defaults.headers.common.Authorization;
+      }
+      delete $window.sessionStorage.odlUser;
+      delete $window.sessionStorage.odlPass;
+    };
+
+    // Return the current user object
+    factory.getUser = function () {
+      var user = $window.sessionStorage.odlUser || null;
+      return user;
+    };
+
+    factory.authorize = function (accessLevel, role) {
+      if (role === undefined) {
+        role = currentUser.role;
+      }
+      return accessLevel.bitMask & role.bitMask;
+    };
+    factory.isAuthed = function () {
+      var authed = factory.getUser() ? true : false;
+      return authed;
+    };
+    factory.isLoggedIn = function (user) {
+      if (user === undefined) {
+        user = currentUser;
+      }
+      return user.role.title === userRoles.user.title || user.role.title === userRoles.admin.title;
+    };
+    factory.login = function (user, pw, cb, eb) {
+      factory.setBasic(user, pw);
+      $http.get(ENV.getBaseURL('MD_SAL') + '/restconf/modules')
+        .success(function (data) {
+          cb(data);
+        })
+        .error(function (resp) {
+          if (resp.errors) {
+            var errorDetails = resp.errors.error[0];
+            if (errorDetails && errorDetails['error-tag'] === 'data-missing') {
+              // Authentication succeed, but API does not have data, allow to enter
+              cb(resp);
+              return;
+            }
+          }
+          factory.unsetBasic();
+          eb(resp);
+        });
+    };
+    factory.logout = function (success) {
+      factory.unsetBasic();
+      success();
+    };
+    return factory;
+  };
+  Auth.$inject = ['$http', '$window', 'Base64', 'ENV'];
+
+  var Base64 = function () {
     var keyStr = 'ABCDEFGHIJKLMNOP' +
       'QRSTUVWXYZabcdef' +
       'ghijklmnopqrstuv' +
@@ -92,28 +88,28 @@ define(['common/authentification/auth.module'], function(auth) {
         var i = 0;
 
         do {
-            chr1 = input.charCodeAt(i++);
-            chr2 = input.charCodeAt(i++);
-            chr3 = input.charCodeAt(i++);
-
-            enc1 = chr1 >> 2;
-            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
-            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
-            enc4 = chr3 & 63;
-
-            if (isNaN(chr2)) {
-                enc3 = enc4 = 64;
-            } else if (isNaN(chr3)) {
-                enc4 = 64;
-            }
+          chr1 = input.charCodeAt(i++);
+          chr2 = input.charCodeAt(i++);
+          chr3 = input.charCodeAt(i++);
+
+          enc1 = chr1 >> 2;
+          enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+          enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+          enc4 = chr3 & 63;
+
+          if (isNaN(chr2)) {
+            enc3 = enc4 = 64;
+          } else if (isNaN(chr3)) {
+            enc4 = 64;
+          }
 
-            output = output +
-                keyStr.charAt(enc1) +
-                keyStr.charAt(enc2) +
-                keyStr.charAt(enc3) +
-                keyStr.charAt(enc4);
-            chr1 = chr2 = chr3 = "";
-            enc1 = enc2 = enc3 = enc4 = "";
+          output = output +
+            keyStr.charAt(enc1) +
+            keyStr.charAt(enc2) +
+            keyStr.charAt(enc3) +
+            keyStr.charAt(enc4);
+          chr1 = chr2 = chr3 = "";
+          enc1 = enc2 = enc3 = enc4 = "";
         } while (i < input.length);
 
         return output;
@@ -128,8 +124,8 @@ define(['common/authentification/auth.module'], function(auth) {
         var base64test = /[^A-Za-z0-9\+\/\=]/g;
         if (base64test.exec(input)) {
           alert("There were invalid base64 characters in the input text.\n" +
-              "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
-              "Expect errors in decoding.");
+            "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
+            "Expect errors in decoding.");
         }
 
         input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
@@ -147,10 +143,10 @@ define(['common/authentification/auth.module'], function(auth) {
           output = output + String.fromCharCode(chr1);
 
           if (enc3 != 64) {
-              output = output + String.fromCharCode(chr2);
+            output = output + String.fromCharCode(chr2);
           }
           if (enc4 != 64) {
-              output = output + String.fromCharCode(chr3);
+            output = output + String.fromCharCode(chr3);
           }
 
           chr1 = chr2 = chr3 = "";
@@ -161,14 +157,14 @@ define(['common/authentification/auth.module'], function(auth) {
         return output;
       }
     };
-  });
+  };
 
   // Filter to add authorization header if its a nb api call
-  auth.factory('NbInterceptor', function($q, $window, Base64) {
+  var NbInterceptor = function ($q, $window, Base64) {
     return {
-      request : function(config) {
-          // Use AAA basic authentication
-        if (config.url.indexOf('restconf') != -1 || config.url.indexOf('apidoc') != -1) {
+      request: function (config) {
+        // Use AAA basic authentication
+        if (config.url.indexOf('restconf') !== -1 || config.url.indexOf('apidoc') !== -1) {
           config.headers = config.headers || {};
           if ($window.sessionStorage.odlUser && $window.sessionStorage.odlPass) {
             var encoded = Base64.encode($window.sessionStorage.odlUser + ':' + $window.sessionStorage.odlPass);
@@ -177,9 +173,17 @@ define(['common/authentification/auth.module'], function(auth) {
         }
         return config;
       },
-      response : function(response) {
+      response: function (response) {
         return response || $q.when(response);
       }
     };
-  });
+  };
+  NbInterceptor.$inject = ['$q', '$window', 'Base64'];
+
+  return {
+    Auth: Auth,
+    Base64: Base64,
+    NbInterceptor: NbInterceptor
+  };
+
 });
index 76d3ac77091378704f4301bc78820a2f536d336a..c75b769123d67a6a080efd753d5f234df991a9d3 100644 (file)
@@ -1,14 +1,14 @@
-define(['common/authentification/auth.services'], function() {
-  describe('Auth Module', function() {
+define(['common/authentification/auth.module'], function () {
+  describe('Auth Module', function () {
     var _Auth, httpBackend, deferred;
     beforeEach(module('app.common.auth'));
 
-    beforeEach(inject(function($injector) {
+    beforeEach(inject(function ($injector) {
       _Auth = $injector.get('Auth');
       httpBackend = $injector.get('$httpBackend');
     }));
 
-    it('Should have defined function facilate the authentication process', function() {
+    it('Should have defined function facilate the authentication process', function () {
       expect(_Auth.setBasic).toBeDefined();
       expect(_Auth.unsetBasic).toBeDefined();
       expect(_Auth.getUser).toBeDefined();
@@ -19,16 +19,16 @@ define(['common/authentification/auth.services'], function() {
       expect(_Auth.logout).toBeDefined();
     });
 
-    describe(':: Authentication header', function() {
+    describe(':: Authentication header', function () {
       var username = 'john',
-          password = 'abc123',
-          _window = null;
+        password = 'abc123',
+        _window = null;
 
-      beforeEach(inject(function($window) {
+      beforeEach(inject(function ($window) {
         _window = $window;
       }));
 
-      it('Should set the basic authenticate header', function() {
+      it('Should set the basic authenticate header', function () {
         _Auth.setBasic(username, password);
 
         expect(_window.sessionStorage.odlUser).toBeDefined();
@@ -38,7 +38,7 @@ define(['common/authentification/auth.services'], function() {
         expect(_window.sessionStorage.odlPass).toEqual(password);
       });
 
-      it('Should unset the basic authenticate header', inject(function($http) {
+      it('Should unset the basic authenticate header', inject(function ($http) {
         _Auth.setBasic(username, password);
         _Auth.unsetBasic();
 
@@ -48,11 +48,11 @@ define(['common/authentification/auth.services'], function() {
       }));
     });
 
-    describe(':: Login management', function() {
+    describe(':: Login management', function () {
       var username = 'john',
-          password = 'abc123';
+        password = 'abc123';
 
-      it('Should return the current user or null otherwise', function() {
+      it('Should return the current user or null otherwise', function () {
         var user = _Auth.getUser();
         expect(user).toBeNull();
 
@@ -60,8 +60,8 @@ define(['common/authentification/auth.services'], function() {
         expect(user).toEqual(user);
       });
 
-      it('Should set the authentication header and send a callback if success', function() {
-        httpBackend.expect('GET',/.*/).respond(200, '');
+      it('Should set the authentication header and send a callback if success', function () {
+        httpBackend.expect('GET', /.*/).respond(200, '');
         var successSpy = jasmine.createSpy("successSpy");
         var errorSpy = jasmine.createSpy("errorSpy");
         spyOn(_Auth, 'setBasic');
@@ -74,8 +74,8 @@ define(['common/authentification/auth.services'], function() {
         expect(errorSpy).not.toHaveBeenCalled();
       });
 
-      it('Should unset the authentication header and send a callback if error', function() {
-        httpBackend.expect('GET',/.*/).respond(404, '');
+      it('Should unset the authentication header and send a callback if error', function () {
+        httpBackend.expect('GET', /.*/).respond(404, '');
         var successSpy = jasmine.createSpy("successSpy");
         var errorSpy = jasmine.createSpy("errorSpy");
         spyOn(_Auth, 'setBasic');
@@ -90,7 +90,7 @@ define(['common/authentification/auth.services'], function() {
         expect(errorSpy).toHaveBeenCalled();
       });
 
-      it('Should unset the authentication header on logout', function() {
+      it('Should unset the authentication header on logout', function () {
         var successSpy = jasmine.createSpy("successSpy");
         spyOn(_Auth, 'unsetBasic');
 
@@ -100,7 +100,7 @@ define(['common/authentification/auth.services'], function() {
         expect(successSpy).toHaveBeenCalled();
       });
 
-      afterEach(function() {
+      afterEach(function () {
         httpBackend.verifyNoOutstandingExpectation();
         httpBackend.verifyNoOutstandingRequest();
       });
index a12792e73766c6280a139d64d277ac39a1358b2c..5438b0505a23aeec9dd20228870495585794b2c6 100644 (file)
@@ -1,32 +1,35 @@
 // This module is used to populate views from the index.tpl.html
-// Each module will register html pages with the appropriate HelperProvider's and this module will take everything from those Helpers and fill the view.
-define(['angularAMD' ,'angular-ui-router', 'ocLazyLoad', 'common/general/common.general.directives', 'common/general/common.navigation.directives','app/core/core.services'], function(app) {
+// Each module will register html pages with the appropriate HelperProvider's
+// and this module will take everything from those Helpers and fill the view.
+define(['angular', 'angular-ui-router', 'ocLazyLoad', 'common/general/common.general.directives',
+  'common/general/common.navigation.directives', 'app/core/core.module'], function (angular) {
+  'use strict';
+
   var layout = angular.module('app.common.layout', ['ui.router.state', 'app.core', 'app.common.general', 'app.common.navigation']);
 
-  layout.config(function($stateProvider, $urlRouterProvider, TopBarHelperProvider, NavHelperProvider, ContentHelperProvider) {
-    $urlRouterProvider.otherwise("/topology");
+  layout.config(function ($stateProvider, TopBarHelperProvider, NavHelperProvider, ContentHelperProvider) {
 
     $stateProvider.state('main', {
       url: '/',
-      views : {
-        'mainContent@' : {
+      views: {
+        'mainContent@': {
           controller: 'AppCtrl',
-          templateUrl : 'src/common/layout/index.tpl.html'
+          templateUrl: 'src/common/layout/index.tpl.html'
         },
-        'navigation@main' : {
+        'navigation@main': {
           template: NavHelperProvider.getViews(),
           controller: 'NavCtrl'
         },
-        'topbar@main' : {
-          template : TopBarHelperProvider.getViews(),
+        'topbar@main': {
+          template: TopBarHelperProvider.getViews(),
           controller: 'TopbarCtrl'
         },
-        'content@main' : {
-          template : ContentHelperProvider.getViews()
+        'content@main': {
+          template: ContentHelperProvider.getViews()
         }
       },
       resolve: {
-        loadCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
+        loadCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
           return $ocLazyLoad.load({
             files: ['app/app.controller'].concat(TopBarHelperProvider.getControllers()).concat(NavHelperProvider.getControllers())
           });
index 7819dce0bbca749d04420230b61d121832aa1fba..72702c656787e05bdbdb10ff92d5068afa5484cb 100644 (file)
@@ -6,21 +6,21 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-define(['angularAMD', 'jquery', 'common/authentification/auth.services', 'ocLazyLoad'], function(ng, $) {
+define(['angularAMD', 'jquery', 'common/authentification/auth.module', 'ocLazyLoad'], function (ng, $) {
   var login = angular.module('app.common.login', ['app.common.auth', 'ui.router.state']);
 
-  login.config(function($stateProvider, $httpProvider) {
+  login.config(function ($stateProvider, $httpProvider) {
     $stateProvider
       .state('login', {
         url: '/login',
         views: {
-          'mainContent@' : {
+          'mainContent@': {
             templateUrl: 'src/common/login/login.tpl.html',
-            controller : 'LoginCtrl'
+            controller: 'LoginCtrl'
           }
         },
         resolve: {
-          loadController: ['$ocLazyLoad', function($ocLazyLoad) {
+          loadController: ['$ocLazyLoad', function ($ocLazyLoad) {
             return $ocLazyLoad.load({
               files: ['src/common/login/login.controller.js']
             });
@@ -31,20 +31,20 @@ define(['angularAMD', 'jquery', 'common/authentification/auth.services', 'ocLazy
     $httpProvider.interceptors.push('NbInterceptor');
   });
 
-  login.run(function($rootScope, $location, Auth) {
+  login.run(function ($rootScope, $location, Auth) {
 
     // to avoid recursive loop
     var publicPath = ['/login'];
 
-    var isPublicPath = function(route) {
+    var isPublicPath = function (route) {
       var found = false;
-      $.each(publicPath, function(key, value) {
+      $.each(publicPath, function (key, value) {
         found = found || route.match('^' + value);
       });
       return found;
     };
 
-    $rootScope.$on('$stateChangeStart', function() {
+    $rootScope.$on('$stateChangeStart', function () {
       if (!isPublicPath($location.url()) && !Auth.isAuthed()) {
         $location.path('/login');
       }
index ce23a23d9bdaaf44843ff116014f3061f20a891a..391696c2d592b8087d354268a8d85fa8e1790e15 100644 (file)
@@ -1,19 +1,14 @@
 <a href="{{item.link}}" ng-if="isValid(item.submenu)" target="_self" ng-click="updateTemplate($event, item)">
-    <i class="{{item.icon}}"></i>
-    {{item.title | translate}}
-    <span ng-show="isValid(item.submenu)" class="arrow icon-angle-down"></span>
+  <i class="{{item.icon}}"></i> {{item.title | translate}}
+  <span ng-show="isValid(item.submenu)" class="arrow icon-angle-down"></span>
 </a>
 <a href="{{item.link}}" target="_self" ng-if="!isValid(item.submenu)">
-    <i class="{{item.icon}}"></i>
-    {{item.title | translate}}
+  <i class="{{item.icon}}"></i> {{item.title | translate}}
 </a>
 
 <ul class="nav nav-second-level collapse" style="display: {{display}}">
 
-  <li ng-class="{ active: (isState(item.active) && !isValid(item.submenu)) }" ng-controller="navItemCtrl" ng-repeat="item in item.submenu"
-        ng-include="'src/common/navigation/nav_item_template.tpl.html'">
-
-    </li>
-
+  <li ng-class="{ active: (isState(item.active) && !isValid(item.submenu)) }" ng-controller="NavItemCtrl" ng-repeat="item in item.submenu" ng-include="'src/common/navigation/nav_item_template.tpl.html'">
 
+  </li>
 </ul>
index 057f4447a1e307b5a3a200df7138aefeee9f8ca4..5faa039aede1f2739fa017ce006a53d8f9683084 100644 (file)
@@ -1,33 +1,40 @@
-define(['common/navigation/navigation.module', 'app/core/core.services', 'common/navigation/navigation.services'], function(nav, services) {
-  nav.controller('NavCtrl', function($scope, NavHelper) {
+define(['angular'], function (angular) {
+  'use strict';
+
+  var NavCtrl = function ($scope, NavHelper) {
     $scope.navList = NavHelper.getMenu();
-  });
+  };
+  NavCtrl.$inject = ['$scope', 'NavHelper'];
 
-  nav.controller('navItemCtrl', function($scope, NavHelper) {
+  var NavItemCtrl = function ($scope) {
     $scope.display = 'none';
     $scope.isOpen = false;
 
     $scope.isValid = function (value) {
       if (angular.isUndefined(value) || value === null) {
         return false;
-      }
-      else {
+      } else {
         return true;
       }
     };
 
-    $scope.updateTemplate = function (e, item) {
+    $scope.updateTemplate = function (e) {
       e.stopPropagation();
       e.preventDefault();
 
       $scope.isOpen = !$scope.isOpen;
-      if ($scope.display == 'none') {
+      if ($scope.display === 'none') {
         $scope.display = 'block';
-      }
-      else {
+      } else {
         $scope.display = 'none';
       }
     };
-  });
+  };
+  NavItemCtrl.$inject = ['$scope', 'NavHelper'];
+
+  return {
+    NavCtrl: NavCtrl,
+    NavItemCtrl: NavItemCtrl
+  };
 
 });
index ece1f42bfe9792e49a8358d107b6526240904301..e3c0627c3043df8eb3093039280f9ec0eb7b98ba 100644 (file)
@@ -1,10 +1,20 @@
-define(['angularAMD', 'app/core/core.module' ,'app/core/core.services','Restangular', 'common/config/env.module'], function (ng) {
-  var nav = angular.module('app.common.nav', ['app.core','restangular', 'config']);
+define(['angular', './navigation.controller', './navigation.services', 'app/core/core.module',
+  'Restangular', 'common/config/env.module'], function (angular, controller, services) {
 
-  nav.config( function($stateProvider, NavHelperProvider) {
+  'use strict';
+  var nav = angular.module('app.common.nav', ['app.core', 'restangular', 'config']);
+
+  nav.config(function (NavHelperProvider) {
     NavHelperProvider.addToView('src/common/navigation/navigation.tpl.html');
     NavHelperProvider.addControllerUrl('common/navigation/navigation.controller');
   });
 
+  // controllers
+  nav.controller('NavCtrl', controller.NavCtrl);
+  nav.controller('NavItemCtrl', controller.NavItemCtrl);
+
+  // services
+  nav.factory('MDSalRestangular', services.MDSalRestangular);
+
   return nav;
 });
index eb9bbd6efc925306e64624ec31e33d354e731a2a..33db13a919403790947620a642399a3175855a5a 100644 (file)
@@ -1,9 +1,14 @@
-define(['common/navigation/navigation.module'], function(nav) {
+define([], function () {
+  'use strict';
 
-    nav.factory('MDSalRestangular', function(Restangular, ENV) {
-        return Restangular.withConfig(function(RestangularConfig) {
-            RestangularConfig.setBaseUrl(ENV.getBaseURL("MD_SAL"));
-        });
+  var MDSalRestangular = function (Restangular, ENV) {
+    return Restangular.withConfig(function (RestangularConfig) {
+      RestangularConfig.setBaseUrl(ENV.getBaseURL('MD_SAL'));
     });
+  };
+  MDSalRestangular.$inject = ['Restangular', 'ENV'];
 
+  return {
+    MDSalRestangular: MDSalRestangular
+  };
 });
index 5aaa3068220654374d8ea293a35f7a4f5c38c634..5328dfd28e2a78596aa44674f597dc8d822112c5 100644 (file)
@@ -1,13 +1,13 @@
-define(['common/navigation/navigation.controller'], function() {
-  describe('Navigation Module', function(){
+define(['common/navigation/navigation.module'], function () {
+  describe('Navigation Module', function () {
     var scope, NavHelperMock, EventMock, controller, NavHelperProviderMock;
 
     beforeEach(angular.mock.module('ui.router'));
-    beforeEach(module('app.core', function($provide) {
+    beforeEach(module('app.core', function ($provide) {
       function NavHelperProvider() {
-        this.addToView = function(url) {};
-        this.addControllerUrl = function(url) {};
-        this.$get =  function NavHelperFactory() {
+        this.addToView = function (url) {};
+        this.addControllerUrl = function (url) {};
+        this.$get = function NavHelperFactory() {
           return new NavHelperProvider();
         };
       }
@@ -16,42 +16,48 @@ define(['common/navigation/navigation.controller'], function() {
 
     beforeEach(module('app.common.nav'));
 
-    beforeEach(inject(function($rootScope, $controller){
+    beforeEach(inject(function ($rootScope, $controller) {
       scope = $rootScope.$new();
       controller = $controller;
 
       NavHelperMock = {
-        getMenu: function() {
+        getMenu: function () {
           return {
-            "id" : "",
-            "title" : "",
-            "active" : "",
-            "submenu" : ""
+            "id": "",
+            "title": "",
+            "active": "",
+            "submenu": ""
           };
         }
       };
 
       EventMock = {
-        stopPropagation: function() {
+        stopPropagation: function () {
           return null;
         },
-        preventDefault: function() {
+        preventDefault: function () {
           return null;
         }
       };
 
     }));
 
-    it('Should have receive all menu items', function() {
+    it('Should have receive all menu items', function () {
       spyOn(NavHelperMock, 'getMenu').andCallThrough();
-      controller('NavCtrl', {$scope: scope, NavHelper:NavHelperMock });
+      controller('NavCtrl', {
+        $scope: scope,
+        NavHelper: NavHelperMock
+      });
 
       expect(NavHelperMock.getMenu).toHaveBeenCalled();
       expect(scope.navList).toBeDefined();
     });
 
-    it('Should have create utility methods to show and hide submenu', function() {
-      controller('navItemCtrl', {$scope: scope, NavHelper:NavHelperMock });
+    it('Should have create utility methods to show and hide submenu', function () {
+      controller('NavItemCtrl', {
+        $scope: scope,
+        NavHelper: NavHelperMock
+      });
 
       expect(scope.display).toEqual('none');
       expect(scope.isOpen).toBeFalsy();
@@ -60,27 +66,33 @@ define(['common/navigation/navigation.controller'], function() {
       expect(scope.updateTemplate).toBeDefined();
     });
 
-    it('Should look if a item exist or not', function(){
-      controller('navItemCtrl', {$scope: scope, NavHelper:NavHelperMock });
+    it('Should look if a item exist or not', function () {
+      controller('NavItemCtrl', {
+        $scope: scope,
+        NavHelper: NavHelperMock
+      });
       var item = {};
 
       expect(scope.isValid(item)).toBeTruthy();
       expect(scope.isValid(null)).toBeFalsy();
     });
 
-    it('Should toggle the status of the item scope', function() {
+    it('Should toggle the status of the item scope', function () {
       spyOn(EventMock, 'stopPropagation').andCallThrough();
       spyOn(EventMock, 'preventDefault').andCallThrough();
-      controller('navItemCtrl', {$scope: scope, NavHelper:NavHelperMock });
+      controller('NavItemCtrl', {
+        $scope: scope,
+        NavHelper: NavHelperMock
+      });
 
       var initOpen = scope.isOpen;
       var initDisplay = scope.display;
 
-      scope.updateTemplate(EventMock, { });
+      scope.updateTemplate(EventMock, {});
       expect(scope.isOpen).not.toEqual(initOpen);
       expect(scope.display).not.toEqual(initDisplay);
 
-      scope.updateTemplate(EventMock, { });
+      scope.updateTemplate(EventMock, {});
       expect(scope.isOpen).toEqual(initOpen);
       expect(scope.display).toEqual(initDisplay);
 
index 9e2fcbe0e1ee6cd0e51b0ec86b4240f6c835a865..d1053ac25a51307d7599e77b7d753900e743c4e0 100644 (file)
@@ -1,24 +1,6 @@
-    <div class="sidebar-collapse">
-    <ul id="side-menu" class="nav">
-        <!--
-
-        We don't need the side-search for now...
-        <li class="sidebar-search">
-            <div class="input-group custom-search-form">
-                <input class="form-control" placeholder="Search..." type="text">
-                <span class="input-group-btn">
-                    <button class="btn btn-default" type="button">
-                        <i class="icon-search"></i>
-                    </button>
-                </span>
-            </div>
-        </li>          
-                   --> 
-        <li ng-class="{ active: (isState(item.active) && !isValid(item.submenu))}" ng-controller="navItemCtrl" ng-repeat="item in navList"
-            ng-include="'src/common/navigation/nav_item_template.tpl.html'" ng-type="{{item.id}}">
-
-
-        </li>
-
-    <ul>
+<div class="sidebar-collapse">
+  <ul id="side-menu" class="nav">
+    <li ng-class="{ active: (isState(item.active) && !isValid(item.submenu))}" ng-controller="NavItemCtrl" ng-repeat="item in navList" ng-include="'src/common/navigation/nav_item_template.tpl.html'" ng-type="{{item.id}}">
+    </li>
+  </ul>
 </div>
index 9e4355ad0bb3194ec1abd28d22105dc89c851e34..c065ddcaad837e8234a4ecf0ecfd4ca93fd6cff7 100644 (file)
@@ -1,6 +1,10 @@
-define(['angularAMD'], function() {
+define(['angular', './core.services'], function (angular, services) {
+  'use strict';
   var core = angular.module('app.core', []);
 
-  return core;
+  core.provider('ContentHelper', services.ContentHelper);
+  core.provider('NavHelper', services.NavHelper);
+  core.provider('TopBarHelper', services.TopBarHelper);
 
+  return core;
 });
index 68479b32dd1adc7e0737127105bfc46334eac7ac..d7e24fd408ca1fb06c915dbe38aa63e6c7069f7c 100644 (file)
@@ -1,84 +1,85 @@
-define(['app/core/core.module', 'jquery'], function(core, $) {
-  core.provider('TopBarHelper', function TopBarHelperProvider() {
+define(['jquery'], function ($) {
+  'use strict';
+
+  var TopBarHelper = function () {
     var ids = [];
     var ctrls = [];
 
-    this.addToView = function(url) {
-        $.ajax({
-          url : url,
-          method: 'GET',
-          async : false
-        }).done(function(data) {
-          ids.push(data);
-        });
+    this.addToView = function (url) {
+      $.ajax({
+        url: url,
+        method: 'GET',
+        async: false
+      }).done(function (data) {
+        ids.push(data);
+      });
     };
 
-    this.getViews = function() {
-      var template = "";
+    this.getViews = function () {
+      var template = '';
 
-      for(var i = 0; i < ids.length; ++i) {
+      for (var i = 0; i < ids.length; ++i) {
         template += ids[i];
       }
 
       return template;
     };
 
-    this.addControllerUrl = function(url) {
+    this.addControllerUrl = function (url) {
       ctrls.push(url);
     };
 
-    this.getControllers = function() {
+    this.getControllers = function () {
       return ctrls;
     };
 
-    this.$get = ['apiToken', function TopBarHelper(apiToken) {
-      return new TopBarHelperProvider(apiToken);
+    this.$get = ['apiToken', function (apiToken) {
+      return new TopBarHelper(apiToken);
     }];
+  };
 
-  });
-
-  core.provider('NavHelper', function() {
+  var NavHelper = function () {
     var ids = [];
     var ctrls = [];
     var menu = [];
 
     function NavHelperProvider() {
-      this.addToView = function(url) {
-          $.ajax({
-            url : url,
-            method: 'GET',
-            async : false
-          }).done(function(data) {
-            ids.push(data);
-          });
+      this.addToView = function (url) {
+        $.ajax({
+          url: url,
+          method: 'GET',
+          async: false
+        }).done(function (data) {
+          ids.push(data);
+        });
       };
 
-      this.getViews = function() {
-        var template = "";
+      this.getViews = function () {
+        var template = '';
 
-        for(var i = 0; i < ids.length; ++i) {
+        for (var i = 0; i < ids.length; ++i) {
           template += ids[i];
         }
 
         return template;
       };
 
-      this.addControllerUrl = function(url) {
+      this.addControllerUrl = function (url) {
         ctrls.push(url);
       };
 
-      this.getControllers = function() {
+      this.getControllers = function () {
         return ctrls;
       };
 
-      getMenuWithId = function(menu, level) {
-        if(menu === undefined) {
+      var getMenuWithId = function (menu, level) {
+        if (menu === undefined) {
           return null;
         }
         var currentLevel = level[0];
 
-        var menuItem = $.grep(menu, function(item) {
-          return item.id == currentLevel;
+        var menuItem = $.grep(menu, function (item) {
+          return item.id === currentLevel;
         })[0];
 
         if (level.length === 1) {
@@ -88,37 +89,37 @@ define(['app/core/core.module', 'jquery'], function(core, $) {
         }
       };
 
-      this.addToMenu = function(id, obj) {
-        var lvl = id.split(".");
-        obj["id"] = lvl.pop();
+      this.addToMenu = function (id, obj) {
+        var lvl = id.split('.');
+        obj.id = lvl.pop();
 
         if (lvl.length === 0) {
           menu.push(obj);
         } else {
           var menuItem = getMenuWithId(menu, lvl);
 
-        if(menuItem) {
-          if(!menuItem.submenu) {
-            menuItem.submenu = [];
-          }
-          menuItem.submenu.push(obj);
-        } else {
-           var submenu = {
-              "id" : lvl[0],
-              "title" : lvl[0],
-              "active" : "",
-              "submenu" : [obj]
+          if (menuItem) {
+            if (!menuItem.submenu) {
+              menuItem.submenu = [];
+            }
+            menuItem.submenu.push(obj);
+          } else {
+            var submenu = {
+              'id': lvl[0],
+              'title': lvl[0],
+              'active': '',
+              'submenu': [obj]
             };
             menu.push(submenu);
           }
         }
       };
 
-      this.getMenu = function() {
+      this.getMenu = function () {
         return menu;
       };
 
-      this.$get =  function NavHelperFactory() {
+      this.$get = function NavHelperFactory() {
         return new NavHelperProvider();
       };
     }
@@ -126,42 +127,42 @@ define(['app/core/core.module', 'jquery'], function(core, $) {
 
     return persistentProvider;
 
-   });
+  };
 
-  core.provider('ContentHelper', function() {
+  var ContentHelper = function () {
     var ids = [];
     var ctrls = [];
 
     function ContentHelperProvider() {
-      this.addToView = function(url) {
-          $.ajax({
-            url : url,
-            method: 'GET',
-            async : false
-          }).done(function(data) {
-            ids.push(data);
-          });
+      this.addToView = function (url) {
+        $.ajax({
+          url: url,
+          method: 'GET',
+          async: false
+        }).done(function (data) {
+          ids.push(data);
+        });
       };
 
-      this.getViews = function() {
-        var template = "";
+      this.getViews = function () {
+        var template = '';
 
-        for(var i = 0; i < ids.length; ++i) {
+        for (var i = 0; i < ids.length; ++i) {
           template += ids[i];
         }
 
         return template;
       };
 
-      this.addControllerUrl = function(url) {
+      this.addControllerUrl = function (url) {
         ctrls.push(url);
       };
 
-      this.getControllers = function() {
+      this.getControllers = function () {
         return ctrls;
       };
 
-      this.$get =  function ContentHelperFactory() {
+      this.$get = function ContentHelperFactory() {
         return new ContentHelperProvider();
       };
     }
@@ -169,5 +170,12 @@ define(['app/core/core.module', 'jquery'], function(core, $) {
 
     return persistentProvider;
 
-   });
+  };
+
+  return {
+    ContentHelper: ContentHelper,
+    NavHelper: NavHelper,
+    TopBarHelper: TopBarHelper
+  };
+
 });
index d4dcbd4bf7c5305758a3dd9f67726c6bb25d374c..9a4625a58cb8bc15ac3524d2f35645ca938f46a4 100644 (file)
@@ -1,86 +1,99 @@
 var allTestFiles = [];
 var TEST_REGEXP = /spec\.js$/;
 
-var pathToModule = function(path) {
+var pathToModule = function (path) {
   return path.replace(/^\/base\/src\//, '').replace(/\.js$/, '');
 };
 
-Object.keys(window.__karma__.files).forEach(function(file) {
+Object.keys(window.__karma__.files).forEach(function (file) {
   if (TEST_REGEXP.test(file)) {
-    if (file.indexOf('yang') < 0 ) { // yang spec are broken
+    if (file.indexOf('yang') < 0) { // yang spec are broken
       allTestFiles.push(pathToModule(file));
     }
   }
 });
 
-var run = function() {
-  test(allTestFiles, function() {
+var run = function () {
+  test(allTestFiles, function () {
     console.log('Starting Karma');
     window.__karma__.start();
   });
 };
 
 var test = require.config({
-  baseUrl : '/base/src',
-  paths : {
-    'angular' : '../vendor/angular/angular',
-    'angular-mocks' : '../vendor/angular-mocks/angular-mocks',
-    'ui-bootstrap' : '../vendor/angular-bootstrap/ui-bootstrap-tpls.min',
-    'Restangular' : '../vendor/restangular/dist/restangular.min',
-    'underscore' : '../vendor/underscore/underscore',
-    'angular-ui-router' : '../vendor/angular-ui-router/release/angular-ui-router',
-    'angular-css-injector' : '../vendor/angular-css-injector/angular-css-injector',
-    'angular-cookies' : '../vendor/angular-cookies/angular-cookies.min',
-    'angular-translate' : '../vendor/angular-translate/angular-translate.min',
-    'angular-translate-loader-static-files' : '../vendor/angular-translate-loader-static-files/angular-translate-loader-static-files.min',
-    'jquery' : '../vendor/jquery/jquery',
-    'jquery-ui' : '../vendor/jquery-ui/jquery-ui.min',
-    'footable' : '../vendor/footable/dist/footable.min',
-    'd3' : '../vendor/d3/d3.min',
-    'vis' : '../vendor/vis/dist/vis.min',
-    'ocLazyLoad' : '../vendor/ocLazyLoad/dist/ocLazyLoad',
-    'sigma' : '../vendor/sigma/sigma.min',
-    'sigma-parsers-gexf' : '../vendor/sigma/plugins/sigma.parsers.gexf.min',
-    'sigma-forceAtlas2' : '../vendor/sigma/plugins/sigma.layout.forceAtlas2.min',
-    'sigma-dragNodes' : '../vendor/sigma/plugins/sigma.plugins.dragNodes.min',
-    'sigma-customShapes' : '../vendor/sigma/plugins/sigma.renderers.customShapes.min',
-    'ngSlider' : '../vendor/ng-slider/dist/ng-slider.min'
+  baseUrl: '/base/src',
+  paths: {
+    'angular': '../vendor/angular/angular',
+    'angular-mocks': '../vendor/angular-mocks/angular-mocks',
+    'ui-bootstrap': '../vendor/angular-bootstrap/ui-bootstrap-tpls.min',
+    'Restangular': '../vendor/restangular/dist/restangular.min',
+    'underscore': '../vendor/underscore/underscore',
+    'angular-ui-router': '../vendor/angular-ui-router/release/angular-ui-router',
+    'angular-css-injector': '../vendor/angular-css-injector/angular-css-injector',
+    'angular-cookies': '../vendor/angular-cookies/angular-cookies.min',
+    'angular-translate': '../vendor/angular-translate/angular-translate.min',
+    'angular-sanitize': '../vendor/angular-sanitize/angular-sanitize.min',
+    'angular-translate-loader-static-files': '../vendor/angular-translate-loader-static-files/angular-translate-loader-static-files.min',
+    'jquery': '../vendor/jquery/jquery.min',
+    'jquery-ui': '../vendor/jquery-ui/jquery-ui.min',
+    'footable': '../vendor/footable/dist/footable.min',
+    'd3': '../vendor/d3/d3.min',
+    'ocLazyLoad': '../vendor/ocLazyLoad/dist/ocLazyLoad',
+    'vis': '../vendor/vis/dist/vis.min',
+    'sigma': '../vendor/sigma/sigma.min',
+    'sigma-parsers-gexf': '../vendor/sigma/plugins/sigma.parsers.gexf.min',
+    'sigma-forceAtlas2': '../vendor/sigma/plugins/sigma.layout.forceAtlas2.min',
+    'sigma-dragNodes': '../vendor/sigma/plugins/sigma.plugins.dragNodes.min',
+    'sigma-customShapes': '../vendor/sigma/plugins/sigma.renderers.customShapes.min',
+    'ngSlider': '../vendor/ng-slider/dist/ng-slider.min',
+    'ZeroClipboard': '../vendor/zeroclipboard/dist/ZeroClipboard',
+    'ngClip': '../vendor/ng-clip/src/ngClip',
+    'angular-translate-loader-partial': '../vendor/angular-translate-loader-partial/angular-translate-loader-partial'
   },
-  map:{
+  map: {
     '*': {
       'angularAMD': 'angular'
-    }        
+    }
   },
-  shim : {
-    'angular' : ['jquery'],
-    'angular-mocks' : ['angular'],
-    'ocLazyLoad' : ['angular'],
-    'Restangular' : ['angular', 'underscore'],
-    'ui-bootstrap' : ['angular'],
-    'angular-css-injector' : ['angular'],
-    'angular-ui-router' : ['angular'],
-    'angular-cookies' : ['angular'],
+  shim: {
+    'angular-mocks': ['angular'],
+    'ocLazyLoad': ['angular'],
+    'Restangular': ['angular', 'underscore'],
+    'ui-bootstrap': ['angular'],
+    'angular-css-injector': ['angular'],
+    'angular-ui-router': ['angular'],
+    'angular-cookies': ['angular'],
     'angular-translate': ['angular'],
-    'angular-translate-loader-static-files' : ['angular-translate'],
-    'vis' : {
-        exports: 'vis'
+    'angular-sanitize': ['angular'],
+    'angular-translate-loader-static-files': ['angular-translate'],
+    'vis': {
+      exports: 'vis'
+    },
+    'jquery': {
+      exports: '$'
     },
-    'jquery' : {
-      exports : '$'
+    'jquery-ui': ['jquery'],
+    'angular': {
+      deps: ['jquery', 'jquery-ui'],
+      exports: 'angular'
     },
-    'footable' : ['jquery'],
-    'undescore' : {
-      exports : '_'
+    'footable': ['jquery'],
+    'undescore': {
+      exports: '_'
     },
-    'sticky' : ['jquery', 'angular'],
-    'sigma-parsers-gexf' : ['sigma'],
-    'sigma-forceAtlas2' : ['sigma'],
-    'sigma-dragNodes' : ['sigma'],
-    'sigma-customShapes' : ['sigma'],
-    'ngSlider' : ['angular']
+    'sticky': ['jquery', 'angular'],
+    'sigma-parsers-gexf': ['sigma'],
+    'sigma-forceAtlas2': ['sigma'],
+    'sigma-dragNodes': ['sigma'],
+    'sigma-customShapes': ['sigma'],
+    'ngSlider': ['angular'],
+    'ZeroClipboard': ['angular'],
+    'ngClip': ['angular', 'ZeroClipboard'],
+    'angular-translate-loader-partial': ['angular-translate']
   },
 
-  deps : ['angular', 'angular-mocks'],
+
+  deps: ['angular', 'angular-mocks'],
 
   callback: run
 });
index 6e7b1af517489b62bd012b6bab29ef5e25a232ed..412718c184c19802f8b31b1c345c46d9bb74da1f 100644 (file)
     <tr>
       <th>{{ 'NODE_CONNECTOR_ID' | translate }}</th>
       <th>{{ 'NAME' | translate }}</th>
-      <th data-hide="phone">{{ 'PORT_NUMBER' | translate }}</th>
+      <th>{{ 'PORT_NUMBER' | translate }}</th>
       <th>{{ 'MAC_ADDRESS' | translate }}</th>
     </tr>
   </thead>
   <tbody>
-    <tr ng-hide="data['node-connector'].length"><td colspan="4" class="centerAlign">{{ 'NO_DATA_FOUND' | translate }}</td></tr>
+    <tr ng-hide="data['node-connector'].length"><td colspan="5" class="centerAlign">{{ 'NO_DATA_FOUND' | translate }}</td></tr>
     <tr ng-repeat="ncp in data['node-connector'] | filter:nodeConnectorSearch" node-table>
         <td>{{ncp.id}}</td>
         <td>{{ncp['flow-node-inventory:name']}}</td>
@@ -41,4 +41,4 @@
         </td>
     </tr>
     </tfoot>
-</table>
\ No newline at end of file
+</table>
index f290eff993f39dc3e94f085a053b450f9aa96b06..723d8385b9efaa0e7410d99390d6100c8a81dbee 100644 (file)
        <thead>\r
       <tr>\r
         <th>{{ 'NODE_ID' | translate }}</th>\r
-        <th data-hide="phone">{{ 'NODE_NAME' | translate }}</th>\r
+        <th>{{ 'NODE_NAME' | translate }}</th>\r
         <th>{{ 'NODE_CONNECTORS' | translate }}</th>\r
         <th data-sort-ignore="true">{{ 'STATISTICS' | translate }}</th>\r
       </tr>\r
        </thead>\r
        <tbody>\r
-           <tr ng-hide="data.length > 1"><td colspan="4" class="centerAlign">{{ 'NO_DATA_FOUND' | translate }}</td></tr>\r
+           <tr ng-hide="data.length > 0"><td colspan="5" class="centerAlign">{{ 'NO_DATA_FOUND' | translate }}</td></tr>\r
                <tr ng-repeat="item in data | filter:{id:'!config'} | filter:nodeSearch" node-table>\r
         <td>{{item.id}}</td>\r
         <td>{{item['flow-node-inventory:description']}}</td>\r
index 5716289ffbc09bb1144c1fc8abbd5617ddca82fa..5117bbcc882a28aba288e760720f58a889662544 100644 (file)
@@ -15,7 +15,7 @@ define(['app/node/nodes.module','app/node/nodes.services'], function(node) {
 \r
   node.controller('allNodesCtrl', function($scope, NodeInventorySvc, $timeout) {\r
     NodeInventorySvc.getAllNodes().then(function(data) {\r
-      $scope.data = data[0].node;\r
+      $scope.data = data.nodes.node;\r
     });\r
     var tableRendered = false;\r
     $scope.$watch('nodeSearch.id', function() {\r
@@ -39,7 +39,7 @@ define(['app/node/nodes.module','app/node/nodes.services'], function(node) {
     var currentData = NodeInventorySvc.getCurrentData();\r
     if(currentData != null) {\r
       currentData.then(function(data) {\r
-        var node = _.find(data[0].node, function(entry) {if(entry.id == $stateParams.nodeId) { return entry;}});\r
+        var node = _.find(data.nodes.node, function(entry) {if(entry.id == $stateParams.nodeId) { return entry;}});\r
         $scope.data = node;\r
       });\r
     }\r
index 1aea2783e1c6fda98a4e5db6a905422cd0e6333d..678dd1e269094f0b6b3e3eadf5f3c623e7e572d8 100644 (file)
@@ -39,7 +39,7 @@ define(['app/node/nodes.module'],function(node) {
     };\r
 \r
     svc.getAllNodes = function() {\r
-      svc.data = svc.base().getList();\r
+      svc.data = svc.base().get();\r
       return svc.data;\r
     };\r
 \r
index 4915e7cbb1735864ced9e5b5d690740a34b341ef..ef9a465cb577d7f39a8718325ad413f6f5d47e7e 100644 (file)
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-define(['app/node/nodes.module', 'app/node/nodes.controller', 'angular-ui-router', 'common/layout/layout.module'], function() {
-  describe("Node Listing Screen", function() {
-    var scope, state, nodeServiceMock, rootScope;
-    beforeEach(angular.mock.module('ui.router'));
-    beforeEach(angular.mock.module('app.common.layout'));
-    beforeEach(angular.mock.module('app.nodes'));
+define(['app/node/nodes.module', 'app/node/nodes.controller', 'angular-ui-router', 'common/layout/layout.module'], function () {
+    describe("Node Listing Screen", function () {
+        var scope, state, nodeServiceMock, rootScope;
+        beforeEach(angular.mock.module('ui.router'));
+        beforeEach(angular.mock.module('app.common.layout'));
+        beforeEach(angular.mock.module('app.nodes'));
 
-    beforeEach(angular.mock.inject( function( $controller, $q, $state, $rootScope, $templateCache) {
-      rootScope = $rootScope;
-      scope = $rootScope.$new();
-      state = $state;
-      $templateCache.put('src/app/node/root.tpl.html', '');
-      $templateCache.put('src/app/node/index.tpl.html', '');
-      $templateCache.put('src/app/node/detail.tpl.html', '');
-      nodeServiceMock = {
-        getAllNodes : function() {
-          var deferred = $q.defer();
-          deferred.resolve([{"node":"node1"}]);
-          return deferred.promise;
-        },
-        getCurrentData : function() {
-            return null;
-        },
-        getNode : function(id){
-          var deferred = $q.defer();
-          deferred.resolve({"node":[{"id":id}]});
-          return deferred.promise;
-        }
-      };
-    })); 
+        beforeEach(angular.mock.inject(function ($controller, $q, $state, $rootScope, $templateCache) {
+            rootScope = $rootScope;
+            scope = $rootScope.$new();
+            state = $state;
+            $templateCache.put('src/app/node/root.tpl.html', '');
+            $templateCache.put('src/app/node/index.tpl.html', '');
+            $templateCache.put('src/app/node/detail.tpl.html', '');
+            nodeServiceMock = {
+                getAllNodes: function () {
+                    // TODO: rewrite this test
+                    var deferred = $q.defer();
+                    deferred.resolve(
+                        {
+                            'nodes': {
+                                'node': [{
+                                    'id': 'node1',
+                                }],
+                            },
+                        }
+                    );
+                    return deferred.promise;
+                },
+                getCurrentData: function () {
+                    return null;
+                },
+                getNode: function (id) {
+                    var deferred = $q.defer();
+                    deferred.resolve({"node": [{"id": id}]});
+                    return deferred.promise;
+                }
+            };
+        }));
 
-    it('should load the root states', angular.mock.inject(function($controller) {
-      var stateName = 'main.node';
-      
-      $controller('rootNodeCtrl', {$scope: scope, $state: state});
-      expect(state.href(stateName, {})).toBe('#/node');
-    }));
+        it('should load the root states', angular.mock.inject(function ($controller) {
+            var stateName = 'main.node';
 
+            $controller('rootNodeCtrl', {$scope: scope, $state: state});
+            expect(state.href(stateName, {})).toBe('#/node');
+        }));
 
-    it("should call get Nodes", angular.mock.inject( function($controller, $q) {
-      var stateName = 'main.node.index';
 
-      spyOn(nodeServiceMock, 'getAllNodes').andCallThrough();
-      $controller( 'allNodesCtrl', { $scope: scope, $state:state, NodeInventorySvc:nodeServiceMock });
-      rootScope.$digest();
+        it('should call get Nodes', angular.mock.inject(function ($controller, $q) {
+            var stateName = 'main.node.index';
 
-      expect(state.href(stateName, {})).toBe('#/node/index');
-      expect(nodeServiceMock.getAllNodes).toHaveBeenCalled();
-      expect(scope.data).toBe('node1');
-    }));
+            spyOn(nodeServiceMock, 'getAllNodes').andCallThrough();
+            $controller('allNodesCtrl', {$scope: scope, $state: state, NodeInventorySvc: nodeServiceMock});
+            rootScope.$digest();
 
-    it("ensure node connector link works using existing Data", angular.mock.inject( function($controller, $q) {
-        nodeServiceMock.getCurrentData = function() {
-          var deferred = $q.defer();
-          deferred.resolve([{"node":[{"id":2},{"id" :3}]}]);
-          return deferred.promise;
-        };
-        
-        var stateName = 'main.node.detail';
-        var stateParams = { nodeId: 2 };
-        spyOn(nodeServiceMock, 'getCurrentData').andCallThrough();
-        $controller( 'nodeConnectorCtrl', { $scope: scope, $stateParams : stateParams, NodeInventorySvc:nodeServiceMock });
-        rootScope.$digest();
-        
-        expect(state.href(stateName, stateParams)).toBe('#/node/%d/detail'.replace('%d', stateParams.nodeId));
-        expect(nodeServiceMock.getCurrentData).toHaveBeenCalled();
-        expect(scope.data.id).toEqual(2);
-    }));
+            expect(state.href(stateName, {})).toBe('#/node/index');
+            expect(nodeServiceMock.getAllNodes).toHaveBeenCalled();
+            expect(scope.data[0].id).toBe('node1');
+        }));
 
-    it("ensure node connector can be fetched separately", angular.mock.inject(function($controller) {
-        var stateName = 'main.node.detail';
-        var stateParams = { nodeId: 3 };
-        spyOn(nodeServiceMock, 'getCurrentData').andCallThrough();
-        spyOn(nodeServiceMock, 'getNode').andCallThrough();
-        $controller( 'nodeConnectorCtrl', { $scope: scope, $stateParams : stateParams, NodeInventorySvc:nodeServiceMock });
-        rootScope.$digest();
-        
-        expect(state.href(stateName, stateParams)).toBe('#/node/%d/detail'.replace('%d',stateParams.nodeId));
-        expect(nodeServiceMock.getNode).toHaveBeenCalled();
-        expect(scope.data.id).toEqual(3);
-    }));
-  });
+        it("ensure node connector link works using existing Data", angular.mock.inject(function ($controller, $q) {
+            nodeServiceMock.getCurrentData = function () {
+                var deferred = $q.defer();
+                deferred.resolve(
+                    {
+                        'nodes': {
+
+                            'node': [
+                                {
+                                    'id': 2,
+                                },
+                                {
+                                    'id': 3,
+                                },
+                            ],
+                        },
+                    }
+                );
+
+                return deferred.promise;
+            };
+
+            var stateName = 'main.node.detail';
+            var stateParams = {nodeId: 2};
+            spyOn(nodeServiceMock, 'getCurrentData').andCallThrough();
+            $controller('nodeConnectorCtrl', {
+                $scope: scope,
+                $stateParams: stateParams,
+                NodeInventorySvc: nodeServiceMock
+            });
+            rootScope.$digest();
+
+            expect(state.href(stateName, stateParams)).toBe('#/node/%d/detail'.replace('%d', stateParams.nodeId));
+            expect(nodeServiceMock.getCurrentData).toHaveBeenCalled();
+            expect(scope.data.id).toEqual(2);
+        }));
+
+        it("ensure node connector can be fetched separately", angular.mock.inject(function ($controller) {
+            var stateName = 'main.node.detail';
+            var stateParams = {nodeId: 3};
+            spyOn(nodeServiceMock, 'getCurrentData').andCallThrough();
+            spyOn(nodeServiceMock, 'getNode').andCallThrough();
+            $controller('nodeConnectorCtrl', {
+                $scope: scope,
+                $stateParams: stateParams,
+                NodeInventorySvc: nodeServiceMock
+            });
+            rootScope.$digest();
+
+            expect(state.href(stateName, stateParams)).toBe('#/node/%d/detail'.replace('%d', stateParams.nodeId));
+            expect(nodeServiceMock.getNode).toHaveBeenCalled();
+            expect(scope.data.id).toEqual(3);
+        }));
+    });
 });