ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [04/50] [abbrv] git commit: AMBARI-7606. Admin View: show positive confirmation on user/group/view instance create (alejandro)
Date Sat, 04 Oct 2014 03:16:47 GMT
AMBARI-7606. Admin View: show positive confirmation on user/group/view instance create (alejandro)


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

Branch: refs/heads/branch-alerts-dev
Commit: 0fdd4b3483a3c6bed37953f4c2de1f94392f6d7e
Parents: 051f070
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Wed Oct 1 11:48:03 2014 -0700
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Wed Oct 1 18:46:55 2014 -0700

----------------------------------------------------------------------
 .../main/resources/ui/admin-web/app/index.html  |   2 +-
 .../resources/ui/admin-web/app/scripts/app.js   |   1 -
 .../app/scripts/controllers/NavbarCtrl.js       |   8 +-
 .../ambariViews/CreateViewInstanceCtrl.js       |   8 +-
 .../controllers/ambariViews/ViewsEditCtrl.js    |  22 ++--
 .../controllers/ambariViews/ViewsListCtrl.js    |   5 +-
 .../clusters/ClustersManageAccessCtrl.js        |   6 +-
 .../controllers/groups/GroupsCreateCtrl.js      |   7 +-
 .../controllers/groups/GroupsEditCtrl.js        |  34 +++---
 .../app/scripts/controllers/mainCtrl.js         |   4 +-
 .../controllers/users/UsersCreateCtrl.js        |   7 +-
 .../scripts/controllers/users/UsersShowCtrl.js  |  49 ++++----
 .../ui/admin-web/app/scripts/services/Alert.js  | 106 +++++++++++++++++
 .../ui/admin-web/app/scripts/services/Group.js  |   2 +-
 .../app/scripts/services/PermissionLoader.js    |   8 +-
 .../ui/admin-web/app/scripts/services/User.js   |   2 +-
 .../admin-web/app/scripts/services/uiAlert.js   | 115 -------------------
 .../resources/ui/admin-web/app/styles/main.css  |  92 +++++++++++++++
 18 files changed, 277 insertions(+), 201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index b197302..1b517d5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -135,7 +135,7 @@
     <script src="scripts/services/Group.js"></script>
     <script src="scripts/services/View.js"></script>
     <script src="scripts/services/Cluster.js"></script>
-    <script src="scripts/services/uiAlert.js"></script>
+    <script src="scripts/services/Alert.js"></script>
     <script src="scripts/services/PermissionLoader.js"></script>
     <script src="scripts/services/PermissionsSaver.js"></script>
     <script src="scripts/services/ConfirmationModal.js"></script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
index 868dafe..e949527 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
@@ -22,7 +22,6 @@ angular.module('ambariAdminConsole', [
   'ngAnimate',
   'ui.bootstrap',
   'restangular',
-  'angularAlert',
   'toggle-switch',
   'pascalprecht.translate'
 ])

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
index 130d6fc..d88864b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('NavbarCtrl',['$scope', 'Cluster', '$location', 'uiAlert', 'ROUTES', 'ConfirmationModal',
'$rootScope', function($scope, Cluster, $location, uiAlert, ROUTES, ConfirmationModal, $rootScope)
{
+.controller('NavbarCtrl',['$scope', 'Cluster', '$location', 'Alert', 'ROUTES', 'ConfirmationModal',
'$rootScope', function($scope, Cluster, $location, Alert, ROUTES, ConfirmationModal, $rootScope)
{
   $scope.cluster = null;
   $scope.editCluster = {
     name        : '',
@@ -28,7 +28,7 @@ angular.module('ambariAdminConsole')
   Cluster.getStatus().then(function(cluster) {
     $scope.cluster = cluster;
   }).catch(function(data) {
-  	uiAlert.danger(data.status, data.message);
+    Alert.error('Cannot load cluster status', data.data.message);
   });
 
   $scope.toggleEditName = function($event) {
@@ -57,9 +57,9 @@ angular.module('ambariAdminConsole')
 
     Cluster.editName(oldClusterName, newClusterName).then(function(data) {
       $scope.cluster.Clusters.cluster_name = newClusterName;
-      uiAlert.success('Success', 'The cluster has been renamed to ' + newClusterName + '.');
+      Alert.success('The cluster has been renamed to ' + newClusterName + '.');
     }).catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot rename cluster to ' + newClusterName, data.data.message);
     });
 
     $scope.toggleEditName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 47b8f6a..40a90c8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('CreateViewInstanceCtrl',['$scope', 'View', 'uiAlert', '$routeParams', '$location',
function($scope, View, uiAlert, $routeParams, $location) {
+.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', '$routeParams', '$location',
function($scope, View, Alert, $routeParams, $location) {
   $scope.form = {};
 
   function loadMeta(){
@@ -74,16 +74,16 @@ angular.module('ambariAdminConsole')
         } else {
           View.createInstance($scope.instance)
           .then(function(data) {
-            uiAlert.success('Created View Instance ' + $scope.instance.instance_name);
+            Alert.success('Created View Instance ' + $scope.instance.instance_name);
             $location.path('/views/' + $scope.instance.view_name + '/versions/' + $scope.instance.version
+ '/instances/' + $scope.instance.instance_name + '/edit');
           })
           .catch(function(data) {
-            uiAlert.danger(data.data.status, data.data.message);
+            Alert.error('Cannot create instance', data.data.message);
           });
         }
       })
       .catch(function(data) {
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot create instance', data.data.message);
       });
     }
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
index bfe0d14..1ff860a 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('ViewsEditCtrl', ['$scope', '$routeParams' , 'View', 'uiAlert', 'PermissionLoader',
'PermissionSaver', 'ConfirmationModal', '$location', function($scope, $routeParams, View,
uiAlert, PermissionLoader, PermissionSaver, ConfirmationModal, $location) {
+.controller('ViewsEditCtrl', ['$scope', '$routeParams' , 'View', 'Alert', 'PermissionLoader',
'PermissionSaver', 'ConfirmationModal', '$location', function($scope, $routeParams, View,
Alert, PermissionLoader, PermissionSaver, ConfirmationModal, $location) {
   $scope.identity = angular.identity;
   $scope.isConfigurationEmpty = true;
   function reloadViewInfo(){
@@ -42,7 +42,7 @@ angular.module('ambariAdminConsole')
       $scope.isConfigurationEmpty = angular.equals({}, $scope.configuration);
     })
     .catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot load instance info', data.data.message);
     });
   }
 
@@ -53,7 +53,7 @@ angular.module('ambariAdminConsole')
     reloadViewInfo();
   });
 
-  function reloadViewPrivilegies(){
+  function reloadViewPrivileges(){
     PermissionLoader.getViewPermissions({
       viewName: $routeParams.viewId,
       version: $routeParams.version,
@@ -66,13 +66,13 @@ angular.module('ambariAdminConsole')
       $scope.isPermissionsEmpty = angular.equals({}, $scope.permissions);
     })
     .catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot load permissions', data.data.message);
     });
   }
 
   $scope.permissions = [];
   
-  reloadViewPrivilegies();
+  reloadViewPrivileges();
 
   $scope.editSettingsDisabled = true;
   $scope.toggleSettingsEdit = function() {
@@ -93,7 +93,7 @@ angular.module('ambariAdminConsole')
         $scope.editSettingsDisabled = true;
       })
       .catch(function(data) {
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot save settings', data.data.message);
       });
     }
   };
@@ -122,7 +122,7 @@ angular.module('ambariAdminConsole')
         $scope.editConfigurationDisabled = true;
       })
       .catch(function(data) {
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot save properties', data.data.message);
       });
     }
   };
@@ -147,10 +147,10 @@ angular.module('ambariAdminConsole')
         instance_name: $routeParams.instanceId,
       }
     )
-    .then(reloadViewPrivilegies)
+    .then(reloadViewPrivileges)
     .catch(function(data) {
-      reloadViewPrivilegies();
-      uiAlert.danger(data.data.status, data.data.message);
+      reloadViewPrivileges();
+      Alert.error('Cannot save permissions', data.data.message);
     });
     $scope.editPermissionDisabled = true;
   };
@@ -170,7 +170,7 @@ angular.module('ambariAdminConsole')
         $location.path('/views');
       })
       .catch(function(data) {
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot delete instance', data.data.message);
       });
     });
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
index 5c1d93b..4fad3b3 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
@@ -18,8 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('ViewsListCtrl',['$scope', 'View', '$modal', 'uiAlert', 'ConfirmationModal',
function($scope, View, $modal, uiAlert, ConfirmationModal) {
-
+.controller('ViewsListCtrl',['$scope', 'View', '$modal', 'Alert', 'ConfirmationModal', function($scope,
View, $modal, Alert, ConfirmationModal) {
   var deferredList = [];
   $scope.$on('$locationChangeStart', function() {
     deferredList.forEach(function(def) {
@@ -60,7 +59,7 @@ angular.module('ambariAdminConsole')
         });
       })
     }).catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot load views', data.data.message);
     });
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
index 4cf39af..6aae599 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ClustersManageAccessCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('ClustersManageAccessCtrl', ['$scope', 'Cluster', '$routeParams', 'uiAlert',
'PermissionLoader', 'PermissionSaver', function($scope, Cluster, $routeParams, uiAlert, PermissionLoader,
PermissionSaver) {
+.controller('ClustersManageAccessCtrl', ['$scope', 'Cluster', '$routeParams', 'Alert', 'PermissionLoader',
'PermissionSaver', function($scope, Cluster, $routeParams, Alert, PermissionLoader, PermissionSaver)
{
   $scope.identity = angular.identity;
   function reloadClusterData(){
     PermissionLoader.getClusterPermissions({
@@ -29,7 +29,7 @@ angular.module('ambariAdminConsole')
       $scope.permissions = angular.copy(permissions);
     })
     .catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot load cluster data', data.data.message);
     });;
   }
  
@@ -56,7 +56,7 @@ angular.module('ambariAdminConsole')
       }
     ).then(reloadClusterData)
     .catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot save permissions', data.data.message);
       reloadClusterData();
     });
     $scope.isEditMode = false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
index ba35026..7ee02c0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsCreateCtrl.js
@@ -18,19 +18,18 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('GroupsCreateCtrl',['$scope', 'Group', '$location', 'uiAlert', function($scope,
Group, $location, uiAlert) {
+.controller('GroupsCreateCtrl',['$scope', 'Group', '$location', 'Alert', function($scope,
Group, $location, Alert) {
   $scope.group = new Group();
 
   $scope.createGroup = function() {
     $scope.form.submitted = true;
     if ($scope.form.$valid){
       $scope.group.save().then(function() {
-        uiAlert.success('Created group ' + $scope.group.group_name);
+        Alert.success('Created group <a href="#/groups/' + $scope.group.group_name + '/edit">'
+ $scope.group.group_name + '</a>');
         $location.path('/groups');
       })
       .catch(function(data) {
-      	data = data.data;
-        uiAlert.danger(data.status, data.message);
+        Alert.error('Group creation error', data.data.message);
       });
     }
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
index 8164240..48ec98f 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/groups/GroupsEditCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'uiAlert', 'ConfirmationModal',
'$location', function($scope, Group, $routeParams, uiAlert, ConfirmationModal, $location)
{
+.controller('GroupsEditCtrl',['$scope', 'Group', '$routeParams', 'Alert', 'ConfirmationModal',
'$location', function($scope, Group, $routeParams, Alert, ConfirmationModal, $location) {
   $scope.editMode = false;
   $scope.group = new Group($routeParams.id);
   $scope.group.editingUsers = [];
@@ -48,7 +48,7 @@ angular.module('ambariAdminConsole')
     $scope.group.members = newMembers;
     $scope.group.saveMembers().then(loadMembers)
     .catch(function(data) {
-      uiAlert.danger(data.status, data.message);
+      Alert.error('Cannot update group members', data.data.message);
     });
     $scope.isMembersEditing = false;
   };
@@ -76,30 +76,30 @@ angular.module('ambariAdminConsole')
     });
   };
 
-  // Load privilegies
-  Group.getPrivilegies($routeParams.id).then(function(data) {
-    var privilegies = {
+  // Load privileges
+  Group.getPrivileges($routeParams.id).then(function(data) {
+    var privileges = {
       clusters: {},
       views: {}
     };
-    angular.forEach(data.data.items, function(privilegie) {
-      privilegie = privilegie.PrivilegeInfo;
-      if(privilegie.type === 'CLUSTER'){
+    angular.forEach(data.data.items, function(privilege) {
+      privilege = privilege.PrivilegeInfo;
+      if(privilege.type === 'CLUSTER'){
         // This is cluster
-        privilegies.clusters[privilegie.cluster_name] = privilegies.clusters[privilegie.cluster_name]
|| [];
-        privilegies.clusters[privilegie.cluster_name].push(privilegie.permission_name);
-      } else if ( privilegie.type === 'VIEW'){
-        privilegies.views[privilegie.instance_name] = privilegies.views[privilegie.instance_name]
|| { privileges:[]};
-        privilegies.views[privilegie.instance_name].version = privilegie.version;
-        privilegies.views[privilegie.instance_name].view_name = privilegie.view_name;
-        privilegies.views[privilegie.instance_name].privileges.push(privilegie.permission_name);
+        privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name]
|| [];
+        privileges.clusters[privilege.cluster_name].push(privilege.permission_name);
+      } else if ( privilege.type === 'VIEW'){
+        privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name]
|| { privileges:[]};
+        privileges.views[privilege.instance_name].version = privilege.version;
+        privileges.views[privilege.instance_name].view_name = privilege.view_name;
+        privileges.views[privilege.instance_name].privileges.push(privilege.permission_name);
       }
     });
 
-    $scope.privileges = data.data.items.length ? privilegies : null;
+    $scope.privileges = data.data.items.length ? privileges : null;
     $scope.dataLoaded = true;
   }).catch(function(data) {
-    uiAlert.danger(data.data.status, data.data.message);
+    Alert.error('Cannot load privileges', data.data.message);
   });
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
index 64b9e27..2a5c64b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope', '$window','Auth', 'uiAlert', '$modal', 'Cluster', function($scope,
$window, Auth, uiAlert, $modal, Cluster) {
+.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 'Cluster', function($scope,
$window, Auth, Alert, $modal, Cluster) {
   $scope.signOut = function() {
     var data = JSON.parse(localStorage.ambari);
     delete data.app.authenticated;
@@ -50,7 +50,7 @@ angular.module('ambariAdminConsole')
     $scope.cluster = cluster;
     $scope.isLoaded = true;
   }).catch(function(data) {
-      uiAlert.danger(data.status, data.message);
+    Alert.error('Check cluster status error', data.data.message);
   });
 
 }]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
index 7918be0..e91d4b7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersCreateCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('UsersCreateCtrl',['$scope', '$routeParams', 'User', '$location', 'uiAlert',
function($scope, $routeParams, User, $location, uiAlert) {
+.controller('UsersCreateCtrl',['$scope', '$routeParams', 'User', '$location', 'Alert', function($scope,
$routeParams, User, $location, Alert) {
   $scope.user = {
     active: true
   };
@@ -32,11 +32,10 @@ angular.module('ambariAdminConsole')
         'Users/active': !!$scope.user.active,
         'Users/admin': !!$scope.user.admin
       }).then(function() {
-        uiAlert.success('Created user ' + $scope.user.user_name);
+        Alert.success('Created user <a href="#/users/' + $scope.user.user_name + '">'
+ $scope.user.user_name + "</a>");
         $location.path('/users');
       }).catch(function(data) {;
-        data = data.data;
-        uiAlert.danger(data.status, data.message);
+        Alert.error('User creation error', data.data.message);
       });
     }
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
index 0aaf871..6451387 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('UsersShowCtrl', ['$scope', '$routeParams', 'User', '$modal', '$location', 'ConfirmationModal',
'uiAlert', 'Auth', 'getDifference', 'Group', '$q', function($scope, $routeParams, User, $modal,
$location, ConfirmationModal, uiAlert, Auth, getDifference, Group, $q) {
+.controller('UsersShowCtrl', ['$scope', '$routeParams', 'User', '$modal', '$location', 'ConfirmationModal',
'Alert', 'Auth', 'getDifference', 'Group', '$q', function($scope, $routeParams, User, $modal,
$location, ConfirmationModal, Alert, Auth, getDifference, Group, $q) {
 
   function loadUserInfo(){
     User.get($routeParams.id).then(function(data) {
@@ -58,13 +58,13 @@ angular.module('ambariAdminConsole')
     // Remove user from groups
     angular.forEach(diff.del, function(groupName) {
       promises.push(Group.removeMemberFromGroup(groupName, $scope.user.user_name).catch(function(data)
{
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Removing from group error', data.data.message);
       }));
     });
     // Add user to groups
     angular.forEach(diff.add, function(groupName) {
       promises.push(Group.addMemberToGroup(groupName, $scope.user.user_name).catch(function(data)
{
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot add user to group', data.data.message);
       }));
     });
     $q.all(promises).then(function() {
@@ -113,9 +113,9 @@ angular.module('ambariAdminConsole')
 
     modalInstance.result.then(function(data) {
       User.setPassword($scope.user, data.password, data.currentUserPassword).then(function()
{
-        uiAlert.success('Password changed.');
+        Alert.success('Password changed.');
       }).catch(function(data) {
-        uiAlert.danger(data.data.status, data.data.message);
+        Alert.error('Cannot change password', data.data.message);
       });
     }); 
   };
@@ -141,7 +141,7 @@ angular.module('ambariAdminConsole')
       ConfirmationModal.show('Change Admin Privilege', message + '"'+$scope.user.user_name+'"?').then(function()
{
         User.setAdmin($scope.user.user_name, $scope.user.admin)
         .then(function() {
-          loadPrivilegies();
+          loadPrivileges();
         });
       })
       .catch(function() {
@@ -159,37 +159,34 @@ angular.module('ambariAdminConsole')
     });
   };
 
-  // Load privilegies
-  function loadPrivilegies(){
-    User.getPrivilegies($routeParams.id).then(function(data) {
-      var privilegies = {
+  // Load privileges
+  function loadPrivileges(){
+    User.getPrivileges($routeParams.id).then(function(data) {
+      var privileges = {
         clusters: {},
         views: {}
       };
-      angular.forEach(data.data.items, function(privilegie) {
-        privilegie = privilegie.PrivilegeInfo;
-        if(privilegie.type === 'CLUSTER'){
+      angular.forEach(data.data.items, function(privilege) {
+        privilege = privilege.PrivilegeInfo;
+        if(privilege.type === 'CLUSTER'){
           // This is cluster
-          privilegies.clusters[privilegie.cluster_name] = privilegies.clusters[privilegie.cluster_name]
|| [];
-          privilegies.clusters[privilegie.cluster_name].push(privilegie.permission_name);
-        } else if ( privilegie.type === 'VIEW'){
-          privilegies.views[privilegie.instance_name] = privilegies.views[privilegie.instance_name]
|| { privileges:[]};
-          privilegies.views[privilegie.instance_name].version = privilegie.version;
-          privilegies.views[privilegie.instance_name].view_name = privilegie.view_name;
-          privilegies.views[privilegie.instance_name].privileges.push(privilegie.permission_name);
+          privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name]
|| [];
+          privileges.clusters[privilege.cluster_name].push(privilege.permission_name);
+        } else if ( privilege.type === 'VIEW'){
+          privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name]
|| { privileges:[]};
+          privileges.views[privilege.instance_name].version = privilege.version;
+          privileges.views[privilege.instance_name].view_name = privilege.view_name;
+          privileges.views[privilege.instance_name].privileges.push(privilege.permission_name);
 
         }
       });
 
-      $scope.privileges = data.data.items.length ? privilegies : null;
+      $scope.privileges = data.data.items.length ? privileges : null;
       $scope.dataLoaded = true;
 
     }).catch(function(data) {
-      uiAlert.danger(data.data.status, data.data.message);
+      Alert.error('Cannot load privileges', data.data.message);
     });
   }
-
-  loadPrivilegies();
-  
-    
+  loadPrivileges();  
 }]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Alert.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Alert.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Alert.js
new file mode 100644
index 0000000..e9a1cf1
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Alert.js
@@ -0,0 +1,106 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.factory('Alert', [function() {
+  
+  var hideTimeout = null;
+  var $boxContainer = null;
+  var removingTimeout = null;
+
+  function createAlertBox(innerHTML, moreInfo, type){
+    if (!$boxContainer) {
+      $boxContainer = angular.element('<div class="alert-container"/>').appendTo('body');
+      $boxContainer
+        .on('mouseenter', function() {
+          clearTimeout(removingTimeout);
+        })
+        .on('mouseleave', function() {
+          startRemovingTimeout();
+        });
+    }
+    var elem = angular.element('<div><div class="icon-box"></div></div>').addClass('ambariAlert').addClass(type).addClass('invisible');
+
+    elem.append('<div class="content">' + innerHTML + '</div>');
+    if (moreInfo) {
+      $(' <a href class="more-collapse"> more...</a>').appendTo(elem.find('.content'))
+      .on('click', function() {
+        elem.find('.more').show();
+        $(this).remove();
+        return false;
+      });
+      elem.append('<div class="more">'+moreInfo+'</div>');
+    }
+
+    $('<button type="button" class="close"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span></button>')
+      .appendTo(elem)
+      .on('click', function() {
+        var $box = $(this).closest('.ambariAlert');
+        $box.remove();
+      });
+
+    var $icon = $('<span class="glyphicon"></span>');
+    switch (type){
+      case 'error':
+        $icon.addClass('glyphicon-remove-sign');
+        break;
+      case 'success':
+        $icon.addClass('glyphicon-ok-sign');
+        break;
+      case 'info':
+        $icon.addClass('glyphicon-info-sign');
+        break;
+    }
+    elem.find('.icon-box').append($icon);
+
+    elem.appendTo($boxContainer);
+    setTimeout(function() {
+      elem.removeClass('invisible');
+    }, 0);
+
+    startRemovingTimeout();
+  };
+
+  function startRemovingTimeout(){
+    clearTimeout(removingTimeout);
+    removingTimeout = setTimeout(removeTopBox, 5000);
+  }
+
+  function removeTopBox(){
+    $boxContainer.children().first().remove();
+    if (!$boxContainer.children().length) {
+      $boxContainer.remove();
+      $boxContainer = null;
+    } else {
+      startRemovingTimeout();
+    }
+  }
+
+  return {
+    error: function(innerHTML, moreInfo) {
+      createAlertBox(innerHTML, moreInfo, 'error');
+    },
+    success: function(innerHTML, moreInfo) {
+      createAlertBox(innerHTML, moreInfo, 'success');
+    },
+    info: function(innerHTML, moreInfo) {
+      createAlertBox(innerHTML, moreInfo, 'info');
+    }
+  };
+}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Group.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Group.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Group.js
index 87f7831..cf35d4f 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Group.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Group.js
@@ -180,7 +180,7 @@ angular.module('ambariAdminConsole')
     );
   };
 
-  Group.getPrivilegies = function(groupId) {
+  Group.getPrivileges = function(groupId) {
     return $http.get(Settings.baseUrl + '/privileges', {
         params:{
           'PrivilegeInfo/principal_type': 'GROUP',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/PermissionLoader.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/PermissionLoader.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/PermissionLoader.js
index 29138d5..cc56191 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/PermissionLoader.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/PermissionLoader.js
@@ -30,10 +30,10 @@ angular.module('ambariAdminConsole')
         permissionsInner[permission.PermissionInfo.permission_name] = permission;
       });
 
-      // Now we can get privilegies
-      resource.getPrivileges(params).then(function(privilegies) {
-        angular.forEach(privilegies, function(privilegie) {
-          permissionsInner[privilegie.PrivilegeInfo.permission_name][privilegie.PrivilegeInfo.principal_type].push(privilegie.PrivilegeInfo.principal_name);
+      // Now we can get privileges
+      resource.getPrivileges(params).then(function(privileges) {
+        angular.forEach(privileges, function(privilege) {
+          permissionsInner[privilege.PrivilegeInfo.permission_name][privilege.PrivilegeInfo.principal_type].push(privilege.PrivilegeInfo.principal_name);
         });
 
         // After all builded - return object

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js
index 40c5683..4ea048e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js
@@ -78,7 +78,7 @@ angular.module('ambariAdminConsole')
     delete: function(userId) {
       return Restangular.one('users', userId).remove();
     },
-    getPrivilegies : function(userId) {
+    getPrivileges : function(userId) {
       return $http.get(Settings.baseUrl + '/privileges', {
         params:{
           'PrivilegeInfo/principal_type': 'USER',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/uiAlert.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/uiAlert.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/uiAlert.js
deleted file mode 100644
index d916fc5..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/uiAlert.js
+++ /dev/null
@@ -1,115 +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.
- */
-'use strict';
-
-angular.module('angularAlert',[])
-.factory('uiAlert', [function() {
-  var alerts = [];
-  var isRunning = false;
-
-  var alertBoxGenerator = function(title, message, type) {
-    var elem = angular.element('<div/>').addClass('alert');
-    elem.css({
-      'position': 'fixed',
-      'left': '50%',
-      'z-index': '10000',
-      'opacity': '1',
-      'padding': '20px',
-      WebkitTransition : 'all .5s ease-in-out',
-      MozTransition    : 'all .5s ease-in-out',
-      MsTransition     : 'all .5s ease-in-out',
-      OTransition      : 'all .5s ease-in-out',
-      transition       : 'all .5s ease-in-out',
-      '-webkit-transform': 'translateX(-50%)',
-      '-ms-transform': 'translateX(-50%)',
-      '-o-transform': 'translateX(-50%)',
-      'transform': 'translateX(-50%)'
-    });
-    if(!message){
-      elem.html(title);
-    } else {
-      elem.html('<strong>' + title + '</strong> ' + message);
-    }
-
-    elem.addClass('alert-' + (type ? type : 'info') );
-    $('<button type="button" class="close"><span aria-hidden="true">&times;</span><span
class="sr-only">Close</span></button>')
-      .appendTo(elem)
-      .css({
-        'position': 'absolute',
-        'top': '0',
-        'right': '5px',
-        'outline': 'none'
-      }).on('click', function() {
-        var alert = $(this).parent()[0];
-        for(var i = 0; i < alerts.length; i++){
-          if(alert === alerts[i][0]){
-            alert.remove();
-            alerts.splice(i, 1);
-            resetAlertsPositions();
-            break;
-          }
-        }
-      });
-    elem.appendTo('body');
-    alerts.push(elem);
-    resetAlertsPositions();
-  };
-
-  var resetAlertsPositions = function() {
-    var top = 10, height=0;
-    for(var i = 0 ; i < alerts.length; i++){
-      alerts[i].css('top', top);
-      height = alerts[i].css('height').replace('px', '') * 1;
-      top += height + 10;
-    }
-
-    if(!isRunning && alerts.length){
-      isRunning = true;
-      setTimeout(function() {
-        alerts.shift().css('opacity', '0').one('transitionend webkitTransitionEnd oTransitionEnd
otransitionend MSTransitionEnd', function() {
-          isRunning = false;
-          this.remove();
-          resetAlertsPositions();
-        });
-      }, 5000);
-    }
-  };
-
-  var Alert = function(title, message, type) {
-    alertBoxGenerator(title, message, type);
-  };
-
-  Alert.success = function(title, message) {
-    alertBoxGenerator(title, message, 'success');
-  };
-
-  Alert.info = function(title, message) {
-    alertBoxGenerator(title, message, 'info');
-  };
-
-  Alert.warning = function(title, message) {
-    alertBoxGenerator(title, message, 'warning');
-  };
-
-
-  Alert.danger = function(title, message) {
-    alertBoxGenerator(title, message, 'danger');
-  };
-
-  return Alert;
-}]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fdd4b34/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index da79676..2b80604 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1022,6 +1022,98 @@ button.btn.btn-xs{
   color: #666;
 }
 
+.alert-container {
+  position: fixed;
+  top: 50px;
+  right: 20px;
+  z-index: 1000;
+  text-align: right;
+  max-width: 450px;
+}
+.ambariAlert {
+  position: relative;
+  border: 1px solid #c4c4c4;
+  border-radius: 4px 0 0 4px;
+  box-shadow: 0 0px 4px #ebebeb;
+  min-width: 200px;
+  max-width: 450px;
+  background: white;
+  margin-bottom: 20px;
+  z-index: 1000;
+  padding: 20px 20px 20px 60px;
+  max-height: 100%;
+  display: block;
+  float: right;
+  clear: both;
+  text-align: left;
+  -webkit-box-sizing: border-box;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+
+  -webkit-transition: all 0.3s linear;
+  -o-transition: all 0.3s linear;
+  transition: all 0.3s linear;
+
+  -webkit-transform: translateX(0px);
+  -ms-transform: translateX(0px);
+  -o-transform: translateX(0px);
+  transform: translateX(0px);
+}
+.ambariAlert .content {
+  display: inline-block;
+  padding-right: 10px;
+}
+.ambariAlert .icon-box {
+  display: inline-block;
+  font-size: 30px;
+  position: absolute;
+  left: 15px;
+  top: 10px;
+}
+.ambariAlert .more {
+  display: none;
+  margin-top: 10px;
+}
+.ambariAlert .more.visible {
+  display: block;
+}
+.ambariAlert.invisible {
+  -webkit-transform: translateX(1000px);
+  -ms-transform: translateX(1000px);
+  -o-transform: translateX(1000px);
+  transform: translateX(1000px);
+  
+  padding: 0;
+  margin: 0;
+  max-height: 0;
+}
+.ambariAlert .close {
+  position: absolute;
+  right: 10px;
+  top: 10px;
+  outline: none;
+}
+.ambariAlert.error {
+  border-left: 3px solid #ef2427;
+}
+.ambariAlert.error .icon-box {
+  color: #ef2427;
+}
+
+.ambariAlert.success {
+  border-left: 3px solid #82c534;
+}
+.ambariAlert.success .icon-box {
+  color: #82c534;
+}
+
+.ambariAlert.info {
+  border-left: 3px solid #ffbc5b;
+}
+.ambariAlert.info .icon-box {
+  color: #ffbc5b;
+}
+
 .edit-cluster-name {
   cursor: pointer;
 }


Mime
View raw message