You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/17 13:47:54 UTC

syncope git commit: [SYNCOPE-721] missing tidybits

Repository: syncope
Updated Branches:
  refs/heads/master e308d6299 -> b96771c02


[SYNCOPE-721] missing tidybits


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b96771c0
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b96771c0
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b96771c0

Branch: refs/heads/master
Commit: b96771c027125a4f4d76575679a0be570f8b89c4
Parents: e308d62
Author: Matteo Di Carlo <ma...@tirasa.net>
Authored: Fri Jun 17 09:32:38 2016 +0200
Committer: Matteo Di Carlo <ma...@tirasa.net>
Committed: Fri Jun 17 15:35:23 2016 +0200

----------------------------------------------------------------------
 .../resources/META-INF/resources/app/index.html |   2 +-
 .../resources/META-INF/resources/app/js/app.js  |  32 ++---
 .../app/js/controllers/LoginController.js       |   6 +-
 .../angular-translate-loader-static-files.js    | 126 -------------------
 .../resources/app/js/services/authService.js    |   5 +-
 5 files changed, 22 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b96771c0/client/enduser/src/main/resources/META-INF/resources/app/index.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html
index 7f00f85..fee67ff 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/index.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html
@@ -78,7 +78,7 @@ under the License.
     <script src="../webjars/FileSaver.js/${fileSaver.version}/FileSaver.js"></script>
     <script src="../webjars/lodash/${lodash.version}/lodash.min.js"></script>
     <script src="../webjars/angular-translate/${angular-translate.version}/angular-translate.js"></script>
-    <script src="../webjars/angular-translate-loader-partial/${angular-translate-loader-partial.version}/angular-translate-loader-partial.js"></script>
+    <script src="../webjars/angular-translate-loader-partial/${angular-translate.version}/angular-translate-loader-partial.js"></script>
     <!--main angular application-->
     <script src="js/app.js"></script>
     <!--services-->

http://git-wip-us.apache.org/repos/asf/syncope/blob/b96771c0/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
index cd2247a..abdc70d 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
@@ -1,3 +1,5 @@
+/* global $templateCache */
+
 /**
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -31,7 +33,6 @@ var app = angular.module('SyncopeEnduserApp', [
   'ngSanitize',
   'ngAnimate',
   'ngResource',
-  'ngCookies',
   'treasure-overlay-spinner',
   'ngPasswordStrength',
   'kendo.directives',
@@ -46,9 +47,8 @@ var app = angular.module('SyncopeEnduserApp', [
 app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$translateProvider', '$translatePartialLoaderProvider',
   function ($stateProvider, $urlRouterProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) {
 
-    // translate provider configuration
-    $translatePartialLoaderProvider.addPart('static')
-            .addPart('dynamic');
+   $translatePartialLoaderProvider.addPart('static');
+    $translatePartialLoaderProvider.addPart('dynamic');
     $translateProvider.useLoader('$translatePartialLoader', {
       urlTemplate: 'languages/{lang}/{part}.json'
     })
@@ -250,8 +250,8 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$translate
       };
     });
   }]);
-app.run(['$rootScope', '$location', '$cookies', '$state', 'AuthService',
-  function ($rootScope, $location, $cookies, $state, AuthService) {
+app.run(['$rootScope', '$location', '$state', 'AuthService',
+  function ($rootScope, $location, $state, AuthService) {
     // main program
     // keep user logged in after page refresh
     //If the route change failed due to authentication error, redirect them out
@@ -346,7 +346,7 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
           component.options.autoHideAfter = 3000;
           component.show(message, "success");
         }
-      }
+      };
       $scope.showError = function (message, component) {
         if (!$scope.notificationExists(message)) {
           //forcing scrollTo since kendo doesn't disable scrollTop if pinned is true
@@ -354,17 +354,17 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
           component.options.autoHideAfter = 0;
           component.show(message, "error");
         }
-      }
+      };
       $scope.hideError = function (message, component) {
         var popup;
         if (popup = $scope.notificationExists(message)) {
           popup.hide = true;
           popup.close();
         }
-      }
+      };
       $scope.notificationExists = function (message) {
         var result = false;
-        if ($scope.notification != null) {
+        if ($scope.notification !== null) {
           var pendingNotifications = $scope.notification.getNotifications();
           pendingNotifications.each(function (idx, element) {
             var popup = $(element).data("kendoPopup");
@@ -375,9 +375,9 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
           });
         }
         return result;
-      }
+      };
       $scope.hideNotifications = function (timer) {
-        if ($scope.notification != null) {
+        if ($scope.notification !== null) {
           var pendingNotifications = $scope.notification.getNotifications();
           if (timer && timer > 0) {
             setTimeout(function () {
@@ -400,11 +400,11 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
             });
           }
         }
-      }
+      };
       //Intercepting location change event
       $rootScope.$on("$locationChangeStart", function (event, next, current) {
         //When a location changes, old notifications should be removed
-        $scope.hideNotifications(3000)
+        $scope.hideNotifications(3000);
       });
       //Intercepting xhr start event
       $scope.$on('xhrStarted', function (event, next, current) {
@@ -426,6 +426,6 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
       };
       $scope.clearCache = function () {
         $templateCache.removeAll();
-      }
-    }
+      };
+    };
   }]);

http://git-wip-us.apache.org/repos/asf/syncope/blob/b96771c0/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
index 41228c2..9715bb4 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
@@ -18,9 +18,9 @@
  */
 
 'use strict';
-angular.module("login").controller("LoginController", ['$scope', '$rootScope', '$http', '$location', '$cookies',
-  'AuthService', '$translate', '$translatePartialLoader', function ($scope, $rootScope, $http,
-          $location, $cookies, AuthService, $translate) {
+angular.module("login").controller("LoginController", ['$scope', '$http', '$location',
+  'AuthService', '$translate', '$translatePartialLoader', function ($scope, $http,
+          $location, AuthService, $translate) {
 
     $scope.credentials = {
       username: '',

http://git-wip-us.apache.org/repos/asf/syncope/blob/b96771c0/client/enduser/src/main/resources/META-INF/resources/app/js/lib/angular-translate-loader-static-files.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/lib/angular-translate-loader-static-files.js b/client/enduser/src/main/resources/META-INF/resources/app/js/lib/angular-translate-loader-static-files.js
deleted file mode 100644
index 8b22fb7..0000000
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/lib/angular-translate-loader-static-files.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*!
- * angular-translate - v2.11.0 - 2016-03-20
- * 
- * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT
- */
-(function (root, factory) {
-  if (typeof define === 'function' && define.amd) {
-    // AMD. Register as an anonymous module unless amdModuleId is set
-    define([], function () {
-      return (factory());
-    });
-  } else if (typeof exports === 'object') {
-    // Node. Does not work with strict CommonJS, but
-    // only CommonJS-like environments that support module.exports,
-    // like Node.
-    module.exports = factory();
-  } else {
-    factory();
-  }
-}(this, function () {
-
-$translateStaticFilesLoader.$inject = ['$q', '$http'];
-angular.module('pascalprecht.translate')
-/**
- * @ngdoc object
- * @name pascalprecht.translate.$translateStaticFilesLoader
- * @requires $q
- * @requires $http
- *
- * @description
- * Creates a loading function for a typical static file url pattern:
- * "lang-en_US.json", "lang-de_DE.json", etc. Using this builder,
- * the response of these urls must be an object of key-value pairs.
- *
- * @param {object} options Options object, which gets prefix, suffix and key.
- */
-.factory('$translateStaticFilesLoader', $translateStaticFilesLoader);
-
-function $translateStaticFilesLoader($q, $http) {
-
-  'use strict';
-
-  return function (options) {
-
-    if (!options || (!angular.isArray(options.files) && (!angular.isString(options.prefix) || !angular.isString(options.suffix)))) {
-      throw new Error('Couldn\'t load static files, no files and prefix or suffix specified!');
-    }
-
-    if (!options.files) {
-      options.files = [{
-        prefix: options.prefix,
-        suffix: options.suffix
-      }];
-    }
-
-    var load = function (file) {
-      if (!file || (!angular.isString(file.prefix) || !angular.isString(file.suffix))) {
-        throw new Error('Couldn\'t load static file, no prefix or suffix specified!');
-      }
-
-      return $http(angular.extend({
-        url: [
-          file.prefix,
-          options.key,
-          file.suffix
-        ].join(''),
-        method: 'GET',
-        params: ''
-      }, options.$http))
-        .then(function(result) {
-          return result.data;
-        }, function () {
-          return $q.reject(options.key);
-        });
-    };
-
-    var promises = [],
-        length = options.files.length;
-
-    for (var i = 0; i < length; i++) {
-      promises.push(load({
-        prefix: options.files[i].prefix,
-        key: options.key,
-        suffix: options.files[i].suffix
-      }));
-    }
-
-    return $q.all(promises)
-      .then(function (data) {
-        var length = data.length,
-            mergedData = {};
-
-        for (var i = 0; i < length; i++) {
-          for (var key in data[i]) {
-            mergedData[key] = data[i][key];
-          }
-        }
-
-        return mergedData;
-      });
-  };
-}
-
-$translateStaticFilesLoader.displayName = '$translateStaticFilesLoader';
-return 'pascalprecht.translate';
-
-}));

http://git-wip-us.apache.org/repos/asf/syncope/blob/b96771c0/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
index 3a98af8..d23e68a 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
@@ -20,11 +20,10 @@
 'use strict';
 
 angular.module('login')
-        .factory('AuthService', ['$rootScope', '$resource', '$q', '$http', '$cookies',
-          function ($rootScope, $resource, $q, $http, $cookies) {
+        .factory('AuthService', ['$rootScope', '$resource', '$q', '$http',
+          function ($rootScope, $resource, $q, $http) {
 
             var authService = {};
-
             authService.login = function (credentials) {
               return $http
                       .post('/syncope-enduser/api/login', credentials)