ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [5/5] incubator-ignite git commit: # 843 WIP Login page.
Date Mon, 25 May 2015 08:21:39 GMT
# 843 WIP Login page.


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

Branch: refs/heads/ignite-843
Commit: a4497031faee77259678c6d6cca2f86e8410a1c9
Parents: 0cbdbee
Author: Andrey <anovikov@gridgain.com>
Authored: Mon May 25 15:20:32 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon May 25 15:20:32 2015 +0700

----------------------------------------------------------------------
 modules/webconfig/nodejs/app.js                 |   33 +-
 modules/webconfig/nodejs/configuration.js       |    2 +-
 modules/webconfig/nodejs/db.js                  |   28 +-
 modules/webconfig/nodejs/package.json           |    1 +
 .../public/javascripts/controllers/common.js    |   17 +-
 .../nodejs/public/stylesheets/AdminLTE.css      | 4363 ------------------
 .../nodejs/public/stylesheets/AdminLTE.min.css  |    7 -
 .../nodejs/public/stylesheets/_all-skins.css    | 1787 -------
 .../public/stylesheets/_all-skins.min.css       |    1 -
 .../nodejs/public/stylesheets/skin-ignite.css   |  133 -
 modules/webconfig/nodejs/routes/auth.js         |    6 +-
 modules/webconfig/nodejs/routes/clusters.js     |    6 +-
 modules/webconfig/nodejs/routes/pages.js        |    6 +-
 .../webconfig/nodejs/views/includes/header.jade |   13 +-
 modules/webconfig/nodejs/views/login.jade       |   11 +-
 15 files changed, 73 insertions(+), 6341 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4497031/modules/webconfig/nodejs/app.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/app.js b/modules/webconfig/nodejs/app.js
index 186b352..34a8b63 100644
--- a/modules/webconfig/nodejs/app.js
+++ b/modules/webconfig/nodejs/app.js
@@ -1,10 +1,11 @@
+var flash = require('connect-flash');
 var express = require('express');
 var path = require('path');
 var favicon = require('serve-favicon');
 var logger = require('morgan');
 var cookieParser = require('cookie-parser');
 var bodyParser = require('body-parser');
-var session = require('express-session')
+var session = require('express-session');
 
 var pageRoutes = require('./routes/pages');
 var clustersRouter = require('./routes/clusters');
@@ -20,21 +21,27 @@ var app = express();
 app.set('views', path.join(__dirname, 'views'));
 app.set('view engine', 'jade');
 
-// uncomment after placing your favicon in /public
+// Site favicon
 app.use(favicon(__dirname + '/public/favicon.ico'));
+
 app.use(logger('dev'));
+
 app.use(bodyParser.json());
 app.use(bodyParser.urlencoded({extended: false}));
+
 app.use(require('less-middleware')(path.join(__dirname, 'public')));
+
 app.use(express.static(path.join(__dirname, 'public')));
-app.use(cookieParser());
+
+app.use(cookieParser('keyboard cat'));
+
 app.use(session({
     secret: 'keyboard cat',
     resave: false,
-    saveUninitialized: true,
+    saveUninitialized: true
 }));
 
-app.use(require('flash')());
+app.use(flash());
 
 app.use(passport.initialize());
 app.use(passport.session());
@@ -57,11 +64,11 @@ app.use('/rest/clusters', clustersRouter);
 app.use('/rest/auth', authRouter);
 
 // catch 404 and forward to error handler
-app.use(function (req, res, next) {
-    var err = new Error('Not Found');
-    err.status = 404;
-    next(err);
-});
+//app.use(function (req, res, next) {
+//    var err = new Error('Not Found');
+//    err.status = 404;
+//    next(err);
+//});
 
 // error handlers
 
@@ -87,10 +94,4 @@ app.use(function (err, req, res, next) {
     });
 });
 
-//app.use(function(req, res, next) {
-//    res.header("Access-Control-Allow-Origin", "*");
-//    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type,
Accept");
-//    next();
-//});
-
 module.exports = app;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4497031/modules/webconfig/nodejs/configuration.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/configuration.js b/modules/webconfig/nodejs/configuration.js
index 9482235..b0b8388 100644
--- a/modules/webconfig/nodejs/configuration.js
+++ b/modules/webconfig/nodejs/configuration.js
@@ -2,4 +2,4 @@ var config = require('nconf');
 
 config.file({'file': 'config/default.json'});
 
-module.exports = config
\ No newline at end of file
+module.exports = config;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4497031/modules/webconfig/nodejs/db.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/db.js b/modules/webconfig/nodejs/db.js
index 59808f7..5c711bf 100644
--- a/modules/webconfig/nodejs/db.js
+++ b/modules/webconfig/nodejs/db.js
@@ -3,7 +3,7 @@ var config = require('./configuration.js');
 // mongoose for mongodb
 var mongoose = require('mongoose'),
     Schema = mongoose.Schema,
-    ObjectId = mongoose.Types.ObjectId,
+    ObjectId = mongoose.Schema.Types.ObjectId,
     passportLocalMongoose = require('passport-local-mongoose');
 
 // connect to mongoDB database on modulus.io
@@ -11,24 +11,36 @@ mongoose.connect(config.get('mongoDB:url'), {server: {poolSize: 4}});
 
 // define user model.
 var AccountSchema = new Schema({
-    email: String
+    username: String
 });
 
-AccountSchema.plugin(passportLocalMongoose);
+AccountSchema.plugin(passportLocalMongoose, { usernameField: 'email' });
 
 exports.Account = mongoose.model('Account', AccountSchema);
 
-// define cache model.
-exports.Cache =  mongoose.model('Cache', new Schema({
+// define space model.
+exports.Space =  mongoose.model('Space', new Schema({
     name: String,
-    mode: { type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL'] },
-    backups: Number
+    owner: { type: ObjectId, ref: 'Account' },
+    usedBy: [{
+        permission: { type: String, enum: ['VIEW', 'FULL']},
+        account: { type: ObjectId, ref: 'Account' }
+    }]
 }));
 
 // define cluster model.
 exports.Cluster =  mongoose.model('Cluster', new Schema({
+    space: { type: ObjectId, ref: 'Space' },
     name : String,
-    caches : [String],
     discovery : { type: String, enum: ['TcpDiscoveryVmIpFinder', 'TcpDiscoveryMulticastIpFinder']
},
     addresses : [String]
 }));
+
+// define cache model.
+exports.Cache =  mongoose.model('Cache', new Schema({
+    space: { type: ObjectId, ref: 'Space' },
+    name: String,
+    mode: { type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL'] },
+    backups: Number,
+    clusters: [{ type: ObjectId, ref: 'Cluster' }]
+}));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4497031/modules/webconfig/nodejs/package.json
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/package.json b/modules/webconfig/nodejs/package.json
index a8e4c77..35bad28 100644
--- a/modules/webconfig/nodejs/package.json
+++ b/modules/webconfig/nodejs/package.json
@@ -11,6 +11,7 @@
   "dependencies": {
     "angularjs": "0.0.1",
     "body-parser": "~1.12.0",
+    "connect-flash": "^0.1.1",
     "cookie-parser": "~1.3.4",
     "debug": "~2.1.1",
     "express": "~4.12.2",

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4497031/modules/webconfig/nodejs/public/javascripts/controllers/common.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/common.js b/modules/webconfig/nodejs/public/javascripts/controllers/common.js
index 0e1e388..9d85423 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/common.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/common.js
@@ -22,11 +22,16 @@ configuratorModule.controller('auth', ['$scope', '$modal', '$http', function($sc
     };
 
     $scope.auth = function(action, user_info) {
-        if (action == 'signup') {
-            $http.post('/rest/auth/register', user_info)
-                .error(function (data) {
-                    $scope.message = data;
-                });
-        }
+        $http.post('/rest/auth/' + action, user_info)
+            .success(function(data) {
+                console.log(data);
+
+                authModal.hide();
+            });
+            //.error(function (data) {
+            //    console.log(data);
+            //
+            //    $scope.message = data;
+            //});
     };
 }]);
\ No newline at end of file


Mime
View raw message