ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [1/2] incubator-ignite git commit: # ignite-843 Fixed dropdown, modal.
Date Wed, 15 Jul 2015 10:25:37 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 34d54d341 -> ecf4e20ad


# ignite-843 Fixed dropdown, modal.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1d07c2a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1d07c2a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1d07c2a6

Branch: refs/heads/ignite-843
Commit: 1d07c2a6fe033d4e27636f5091dc5f3ecf469796
Parents: 55f7e07
Author: Andrey <anovikov@gridgain.com>
Authored: Wed Jul 15 17:25:49 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Wed Jul 15 17:25:49 2015 +0700

----------------------------------------------------------------------
 .../nodejs/controllers/common-module.js            | 17 +++++++++++++----
 .../nodejs/controllers/models/summary.json         |  4 ++--
 modules/web-control-center/nodejs/db.js            | 12 ++++++++++++
 modules/web-control-center/nodejs/routes/admin.js  |  4 ++--
 .../web-control-center/nodejs/routes/profile.js    |  4 ++--
 .../nodejs/views/includes/header.jade              | 14 +++-----------
 6 files changed, 34 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/common-module.js b/modules/web-control-center/nodejs/controllers/common-module.js
index 39b89db..9388802 100644
--- a/modules/web-control-center/nodejs/controllers/common-module.js
+++ b/modules/web-control-center/nodejs/controllers/common-module.js
@@ -114,7 +114,7 @@ controlCenterModule.service('$confirm', function($modal, $rootScope, $q)
{
         confirm.hide();
     };
 
-    var confirm = $modal({template: '/confirm', scope: scope, placement: 'center', show:
false});
+    var confirm = $modal({templateUrl: '/confirm', scope: scope, placement: 'center', show:
false});
 
     var parentShow = confirm.show;
 
@@ -145,7 +145,7 @@ controlCenterModule.config(function ($selectProvider) {
         maxLength: '1',
         allText: 'Select All',
         noneText: 'Clear All',
-        template: '/select'
+        templateUrl: '/select'
     });
 });
 
@@ -244,8 +244,17 @@ controlCenterModule.controller('auth', [
 
         $scope.valid = false;
 
+        $scope.userDropdown = [{"text": "Profile", "href": "/profile"}];
+
+        if (!$scope.becomeUsed) {
+            if ($scope.user.admin)
+                $scope.userDropdown.push({"text": "Admin Panel", "href": "/admin"});
+
+            $scope.userDropdown.push({"text": "Log Out", "href": "/logout"});
+        }
+
         // Pre-fetch an external template populated with a custom scope
-        var authModal = $modal({scope: $scope, template: '/login', show: false});
+        var authModal = $modal({scope: $scope, templateUrl: '/login', show: false});
 
         $scope.login = function () {
             // Show when some event occurs (use $promise property to ensure the template
has been loaded)
@@ -254,7 +263,7 @@ controlCenterModule.controller('auth', [
 
         $scope.auth = function (action, user_info) {
             $http.post('/' + action, user_info)
-                .success(function (data) {
+                .success(function () {
                     authModal.hide();
 
                     $window.location = '/configuration/clusters';

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/controllers/models/summary.json
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/models/summary.json b/modules/web-control-center/nodejs/controllers/models/summary.json
index d0a2db1..245448c 100644
--- a/modules/web-control-center/nodejs/controllers/models/summary.json
+++ b/modules/web-control-center/nodejs/controllers/models/summary.json
@@ -4,7 +4,7 @@
   ],
   "clientFields": [
     {
-      "label": "Start size",
+      "label": "Near cache start size",
       "type": "number",
       "path": "nearConfiguration",
       "model": "nearStartSize",
@@ -14,7 +14,7 @@
       ]
     },
     {
-      "label": "Eviction policy",
+      "label": "Near cache eviction policy",
       "type": "dropdown-details",
       "path": "nearConfiguration.nearEvictionPolicy",
       "model": "kind",

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/db.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/db.js b/modules/web-control-center/nodejs/db.js
index a03ae1b..8629f09 100644
--- a/modules/web-control-center/nodejs/db.js
+++ b/modules/web-control-center/nodejs/db.js
@@ -37,6 +37,18 @@ var AccountSchema = new Schema({
 AccountSchema.plugin(passportLocalMongoose, {usernameField: 'email', limitAttempts: true,
lastLoginField: 'lastLogin',
     usernameLowerCase: true});
 
+AccountSchema.set('toJSON', {
+    transform: function(doc, ret) {
+        return {
+            _id: ret._id,
+            email: ret.email,
+            username: ret.username,
+            admin: ret.admin,
+            lastLogin: ret.lastLogin
+        };
+    }
+});
+
 exports.Account = mongoose.model('Account', AccountSchema);
 
 // Define space model.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/routes/admin.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/routes/admin.js b/modules/web-control-center/nodejs/routes/admin.js
index 9731603..51d6892 100644
--- a/modules/web-control-center/nodejs/routes/admin.js
+++ b/modules/web-control-center/nodejs/routes/admin.js
@@ -26,7 +26,7 @@ router.get('/', function (req, res) {
  * Get list of user accounts.
  */
 router.post('/list', function (req, res) {
-    db.Account.find({}).select('-attempts -hash -salt').exec(function (err, users) {
+    db.Account.find({}, function (err, users) {
         if (err)
             return res.status(500).send(err.message);
 
@@ -66,7 +66,7 @@ router.get('/become', function (req, res) {
         return res.redirect('/admin');
     }
 
-    db.Account.findById(viewedUserId, function (err, viewedUser) {
+    db.Account.findById(viewedUserId).exec(function (err, viewedUser) {
         if (err)
             return res.sendStatus(404);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/routes/profile.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/routes/profile.js b/modules/web-control-center/nodejs/routes/profile.js
index 7051eb6..0269e7d 100644
--- a/modules/web-control-center/nodejs/routes/profile.js
+++ b/modules/web-control-center/nodejs/routes/profile.js
@@ -53,7 +53,7 @@ router.post('/saveUser', function (req, res) {
         if (!newPassword || newPassword.length == 0)
             return res.status(500).send('Wrong value for new password');
 
-        db.Account.findById(params._id).select('-attempts -hash -salt').exec(function (err,
user) {
+        db.Account.findById(params._id, function (err, user) {
             if (err)
                 return res.status(500).send(err);
 
@@ -85,7 +85,7 @@ router.post('/saveUser', function (req, res) {
         if (params.email)
             upd.email = params.email;
 
-        db.Account.findByIdAndUpdate(params._id, upd, {new: true}).select('-attempts -hash
-salt').exec(function (err, val) {
+        db.Account.findByIdAndUpdate(params._id, upd, {new: true}, function (err, val) {
             if (err)
                 return res.status(500).send(err.message);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d07c2a6/modules/web-control-center/nodejs/views/includes/header.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/includes/header.jade b/modules/web-control-center/nodejs/views/includes/header.jade
index 071c996..ab2d31e 100644
--- a/modules/web-control-center/nodejs/views/includes/header.jade
+++ b/modules/web-control-center/nodejs/views/includes/header.jade
@@ -32,16 +32,8 @@ header.header(id='header')
                 //+header-item('/sql', '/sql', 'SQL')
                 //+header-item('/deploy', '/deploy', 'Deploy')
             ul.nav.navbar-nav.pull-right
-                li(ng-show='user')
-                    a.dropdown-toggle(data-toggle='dropdown' aria-expanded='true' bs-dropdown
data-template='user-dropdown' data-placement='bottom-right') {{user.username}}
+                li(ng-if='user')
+                    a.dropdown-toggle(data-toggle='dropdown' bs-dropdown='userDropdown' data-placement='bottom-right')
{{user.username}}
                         span.caret
-                    script#user-dropdown(type='text/ng-template')
-                        ul.dropdown-menu
-                            li
-                                a(href='/profile') Profile
-                            li(ng-if='!becomeUsed && user.admin')
-                                a(href='/admin') Admin Panel
-                            li(ng-if='!becomeUsed')
-                                a(href='/logout') Log Out
-                li.nav-login(ng-show='!user')
+                li.nav-login(ng-if='!user')
                     a(ng-click='login()' href='#') Log In
\ No newline at end of file


Mime
View raw message