syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacom...@apache.org
Subject syncope git commit: [SYNCOPE-719] Enduser notifications now are similar to console notifications
Date Thu, 07 Jan 2016 15:19:31 GMT
Repository: syncope
Updated Branches:
  refs/heads/master ee590ed7c -> 861457d4f


[SYNCOPE-719] Enduser notifications now are similar to console notifications


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

Branch: refs/heads/master
Commit: 861457d4f47a282181a60542937282361d5418be
Parents: ee590ed
Author: giacomolm <giacomolm@hotmail.it>
Authored: Thu Jan 7 16:19:07 2016 +0100
Committer: giacomolm <giacomolm@hotmail.it>
Committed: Thu Jan 7 16:19:07 2016 +0100

----------------------------------------------------------------------
 client/enduser/pom.xml                          |  2 +-
 .../META-INF/resources/app/css/app.css          |  8 ++++
 .../META-INF/resources/app/css/login.css        |  2 +-
 .../resources/META-INF/resources/app/index.html | 15 ++++---
 .../resources/META-INF/resources/app/js/app.js  | 41 +++++++++++++-------
 .../app/js/controllers/LoginController.js       |  4 +-
 .../app/js/controllers/UserController.js        | 18 ++++-----
 .../META-INF/resources/app/views/self.html      |  3 +-
 pom.xml                                         |  6 +--
 9 files changed, 62 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/client/enduser/pom.xml
----------------------------------------------------------------------
diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml
index b1c49ec..eea3e87 100644
--- a/client/enduser/pom.xml
+++ b/client/enduser/pom.xml
@@ -96,7 +96,7 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.webjars</groupId>
-      <artifactId>angular-growl-2</artifactId>
+      <artifactId>kendo-ui-core</artifactId>
     </dependency>
     <!--Bootstrap-->
     <dependency>

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/app.css b/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
index e5ae8e5..a4ae15d 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
@@ -25,4 +25,12 @@ under the License.
   -moz-transition:1s linear all;
   -o-transition:1s linear all;
   transition:1s linear all;
+}
+
+.k-notification-wrap{
+  white-space: normal !important;
+}
+
+.k-notification{
+  width : 320px;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/login.css b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
index 7b0192e..461ad21 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
@@ -19,7 +19,7 @@
 
 body, html {
   /*margin: 45px 0;*/
-  height: 100%;
+  //height: 100%;
   background-repeat: no-repeat;
   /*background-image: linear-gradient(rgb(104, 145, 162), #00a65a);*/
   /*background-color: #00A65A;

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/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 b684455..eb9b50a 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
@@ -41,7 +41,10 @@ under the License.
     <![endif]-->
 
     <!--<div ng-view ng-cloak ng-controller="ApplicationController"></div>-->
-    <div ui-view ng-cloak ng-controller="ApplicationController" ng-init="initApplication()"></div>
+    <div ui-view ng-cloak ng-controller="ApplicationController" ng-init="initApplication()">
     
+    </div>
+    
+    <span id="notification" kendo-notification="notification"></span>
 
     <!--    <footer id="footer" class="hidden-print">
           <ul class="nav pull-right">
@@ -51,9 +54,6 @@ under the License.
           </ul>
         </footer>-->
 
-    <!--default global growl message-->
-    <!--<div growl></div>-->
-
     <!--    <div class="hidden-print" id="initialLoaderDiv">
           <img src="img/ajax-loader.gif" class="ajax-loader"/>
         </div>-->
@@ -70,7 +70,9 @@ under the License.
     <script src="../webjars/angular-sanitize/${angular-sanitize.version}/angular-sanitize.js"></script>
     <script src="../webjars/angular-ui-bootstrap/${angular-ui-bootstrap.version}/ui-bootstrap-tpls.js"></script>
     <script src="../webjars/angular-ui-select/${angular-ui-select.version}/select.js"></script>
-    <script src="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.js"></script>
+    <script src="../webjars/kendo-ui-core/${kendo-ui-core.version}/js/kendo.ui.core.min.js"></script>
+    <script src="../webjars/kendo-ui-core/${kendo-ui-core.version}/js/kendo.notification.min.js"></script>
+    <script src="../webjars/kendo-ui-core/${kendo-ui-core.version}/js/kendo.angular.js"></script>
     <script type="text/javascript" src="../webjars/bootstrap-select/${bootstrap-select.version}/js/bootstrap-select.min.js"></script>
     <script src="../webjars/FileSaver.js/${FileSaver.version}/FileSaver.js" type="text/javascript"></script>
     <!--main angular application-->
@@ -113,7 +115,8 @@ under the License.
     <link href="../webjars/font-awesome/${font-awesome.version}/css/font-awesome.min.css"
rel="stylesheet" type="text/css" />
     <link href="../webjars/ionicons/${ionicons.version}/css/ionicons.min.css" rel="stylesheet"
type="text/css" />
     <link href="../webjars/angular-ui-select/${angular-ui-select.version}/select.css"
rel="stylesheet" type="text/css"/>
-    <link href="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.css"
rel="stylesheet" type="text/css"/>
+    <link href="../webjars//kendo-ui-core/${kendo-ui-core.version}/styles/web/kendo.common.core.min.css"
rel="stylesheet" type="text/css"/>
+    <link href="../webjars//kendo-ui-core/${kendo-ui-core.version}/styles/web/kendo.default.min.css"
rel="stylesheet" type="text/css"/>
     <link href="../webjars/select2/${select2.version}/select2.css" rel="stylesheet" />
     <link href="css/app.css" rel="stylesheet" type="text/css" />
     <link href="css/login.css" rel="stylesheet" type="text/css" />

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/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 da0e46f..4d791dc 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
@@ -34,7 +34,7 @@ var app = angular.module('SyncopeEnduserApp', [
   'ngAnimate',
   'ngResource',
   'ngCookies',
-  'angular-growl',
+  'kendo.directives',
   'home',
   'login',
   'language',
@@ -42,8 +42,8 @@ var app = angular.module('SyncopeEnduserApp', [
   'info'
 ]);
 
-app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'growlProvider',
-  function ($stateProvider, $urlRouterProvider, $httpProvider, growlProvider) {
+app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
+  function ($stateProvider, $urlRouterProvider, $httpProvider) {
     // route configuration
     $stateProvider
             .state('home', {
@@ -229,12 +229,6 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider',
'growlProvi
       };
     });
 
-    growlProvider.globalTimeToLive(10000);
-    growlProvider.globalPosition('bottom-left');
-    growlProvider.globalInlineMessages(true);
-    growlProvider.globalDisableIcons(true);
-    //to enable html in growl
-//    growlProvider.globalEnableHtml(true);
   }]);
 
 app.run(['$rootScope', '$location', '$cookies', '$state',
@@ -300,10 +294,31 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService',
       $rootScope.getVersion = function () {
         return $rootScope.version;
       };
-//  $scope.$on('success', function (event, args) {
-//    console.log("IN CONFIG EVENTO: ", event)
-//    $scope.$broadcast("error", "success");
-//  });
+
+      //Intercepting location change event
+      $rootScope.$on("$locationChangeStart", function (event, next, current) {
+        //When a location changes, old notifications should be removed
+        if ($scope.notification != null) {
+          var pendingNotifications = $scope.notification.getNotifications();          
+          setTimeout(function () {
+            pendingNotifications.each(function (idx, element) {
+              var popup = $(element).data("kendoPopup");
+              if (popup) {
+                popup.close();
+              }
+            });
+          }, 3000);
+        }
+      });
+
+      $scope.showSuccess = function (message, component) {
+        component.options.autoHideAfter = 3000;
+        component.show(message, "success");
+      }
+      $scope.showError = function (message, component) {
+        component.options.autoHideAfter = 0;
+        component.show(message, "error");
+      }
     }
   }]);
 app.factory('AuthenticationHelper', ['$q', '$rootScope',

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/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 46ac8ea..40794a3 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
@@ -20,7 +20,7 @@
 'use strict';
 
 angular.module("login").controller("LoginController", ['$scope', '$rootScope', '$http', '$location',
'$cookies',
-  'AuthService', 'growl', function ($scope, $rootScope, $http, $location, $cookies, AuthService,
growl) {
+  'AuthService', function ($scope, $rootScope, $http, $location, $cookies, AuthService) {
 
     $scope.credentials = {
       username: '',
@@ -45,7 +45,7 @@ angular.module("login").controller("LoginController", ['$scope', '$rootScope',
'
           errorMessage = errorMessage.split("}}")[0];
         }
         $scope.credentials.errorMessage = "Login failed: " + errorMessage;
-        growl.error($scope.credentials.errorMessage, {referenceId: 1});
+        $scope.showError($scope.credentials.errorMessage, $scope.notification);        
       });
     };
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
index cb1689a..89eccae 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -21,8 +21,8 @@
 
 angular.module("self").controller("UserController", ['$scope', '$rootScope', '$location',
'$compile', 'AuthService',
   'UserSelfService', 'SchemaService', 'RealmService', 'ResourceService', 'SecurityQuestionService',
'CaptchaService',
-  'growl', function ($scope, $rootScope, $location, $compile, AuthService, UserSelfService,
SchemaService, RealmService,
-          ResourceService, SecurityQuestionService, CaptchaService, growl) {
+  function ($scope, $rootScope, $location, $compile, AuthService, UserSelfService, SchemaService,
RealmService,
+          ResourceService, SecurityQuestionService, CaptchaService) {
 
     $scope.user = {};
     $scope.confirmPassword = {
@@ -219,15 +219,15 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
       // validate captcha and then save user
       CaptchaService.validate($scope.captchaInput).then(function (response) {
         if (!(response === 'true')) {
-          growl.error("Captcha inserted is not valid, please digit the correct captcha",
{referenceId: 2});
+          $scope.showError("Captcha inserted is not valid, please digit the correct captcha",
$scope.notification);
           return;
         }
 
         if ($scope.createMode) {
 
           UserSelfService.create(user).then(function (response) {
-            console.log("Created user: ", response);
-            growl.success("User " + $scope.user.username + " successfully created", {referenceId:
1});
+            console.log("Created user: ", response);            
+            $scope.showSuccess("User " + $scope.user.username + " successfully created",
$scope.notification);
             $location.path('/self');
           }, function (response) {
             console.log("Error during user creation: ", response);
@@ -237,7 +237,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
               errorMessage = response.split("ErrorMessage{{")[1];
               errorMessage = errorMessage.split("}}")[0];
             }
-            growl.error("Error: " + (errorMessage || response), {referenceId: 2});
+            $scope.showError("Error: " + (errorMessage || response), $scope.notification);
           });
 
         } else {
@@ -247,7 +247,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
             AuthService.logout().then(function (response) {
               console.log("LOGOUT SUCCESS: ", response);
               $location.path('/self');
-              growl.success("User " + $scope.user.username + " successfully updated", {referenceId:
1});
+              $scope.showSuccess("User " + $scope.user.username + " successfully updated",
$scope.notification);
             }, function () {
               console.log("LOGOUT FAILED");
             });
@@ -259,7 +259,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
               errorMessage = response.split("ErrorMessage{{")[1];
               errorMessage = errorMessage.split("}}")[0];
             }
-            growl.error("Error: " + (errorMessage || response), {referenceId: 2});
+            $scope.showError("Error: " + (errorMessage || response), $scope.notification);
           });
         }
       }, function (response) {
@@ -270,7 +270,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope',
'$l
           errorMessage = response.split("ErrorMessage{{")[1];
           errorMessage = errorMessage.split("}}")[0];
         }
-        growl.error("Error: " + (errorMessage || response), {referenceId: 2});
+        $scope.showError("Error: " + (errorMessage || response), $scope.notification);
         return;
       });
     };

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/self.html b/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
index a684ec6..895a4db 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
@@ -55,8 +55,7 @@ under the License.
 
             <img class="login-logo" src="img/logo-green.png" />
 
-            <div id="login-form" class="form">
-              <div growl reference="1" inline="true"></div>
+            <div id="login-form" class="form">              
             </div>
 
             <form id="login-form" class="form form-signin" novalidate ng-show="!isLogged()"
>

http://git-wip-us.apache.org/repos/asf/syncope/blob/861457d4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cef536a..b0ab7c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -401,7 +401,7 @@ under the License.
     <angular-ui-bootstrap.version>0.14.0</angular-ui-bootstrap.version>
     <angular-ui-select.version>0.13.1</angular-ui-select.version>
     <angular-sanitize.version>1.4.8</angular-sanitize.version>
-    <angular-growl-2.version>0.7.3</angular-growl-2.version>
+    <kendo-ui-core.version>2014.2.716</kendo-ui-core.version>
     <select2.version>3.4.8</select2.version>
     <FileSaver.version>0.0.2</FileSaver.version>
     
@@ -1075,8 +1075,8 @@ under the License.
       </dependency>
       <dependency>
         <groupId>org.webjars</groupId>
-        <artifactId>angular-growl-2</artifactId>
-        <version>${angular-growl-2.version}</version>
+        <artifactId>kendo-ui-core</artifactId>
+        <version>${kendo-ui-core.version}</version>
       </dependency>
       <dependency>
         <groupId>org.webjars.bower</groupId>


Mime
View raw message