You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/02/11 13:31:54 UTC

[3/7] ignite git commit: IGNITE-843 Check es6 in server side code.

IGNITE-843 Check es6 in server side code.


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

Branch: refs/heads/ignite-843-rc3
Commit: 28bc296da4741d4138107556b50a29daedb2cb0a
Parents: 9da27eb
Author: Andrey <an...@gridgain.com>
Authored: Thu Feb 11 13:41:53 2016 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Feb 11 13:41:53 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/gulpfile.js/tasks/eslint.js     | 16 ++++++++++++--
 .../src/main/js/serve/routes/routes.js          | 23 ++++++++------------
 2 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/28bc296d/modules/control-center-web/src/main/js/gulpfile.js/tasks/eslint.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/gulpfile.js/tasks/eslint.js b/modules/control-center-web/src/main/js/gulpfile.js/tasks/eslint.js
index 696144f..fa8dce0 100644
--- a/modules/control-center-web/src/main/js/gulpfile.js/tasks/eslint.js
+++ b/modules/control-center-web/src/main/js/gulpfile.js/tasks/eslint.js
@@ -16,14 +16,26 @@
  */
 
 var gulp = require('gulp');
+var sequence = require('gulp-sequence');
+
 var eslint = require('gulp-eslint');
 
 var paths = [
     './app/**/*.js'
 ];
 
-gulp.task('eslint', function() {
+gulp.task('eslint:node', function() {
+	return gulp.src('./serve/**/*.js')
+		.pipe(eslint({envs: ['node']}))
+		.pipe(eslint.format());
+});
+
+gulp.task('eslint:browser', function() {
 	return gulp.src(paths)
-		.pipe(eslint())
+		.pipe(eslint({envs: ['browser']}))
 		.pipe(eslint.format());
 });
+
+gulp.task('eslint', function(cb) {
+	return sequence('eslint:browser', 'eslint:node')(cb);
+});

http://git-wip-us.apache.org/repos/asf/ignite/blob/28bc296d/modules/control-center-web/src/main/js/serve/routes/routes.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/routes.js b/modules/control-center-web/src/main/js/serve/routes/routes.js
index 268931f..9c7e7c9 100644
--- a/modules/control-center-web/src/main/js/serve/routes/routes.js
+++ b/modules/control-center-web/src/main/js/serve/routes/routes.js
@@ -35,10 +35,8 @@ module.exports = {
     ]
 };
 
-module.exports.factory = function (publicRoutes, adminRoutes, profileRoutes,
-                                   clusterRoutes, domainRoutes, cacheRoutes, igfsRoutes,
-                                   notebookRoutes, agentRoutes,
-                                   pluginRoutes) {
+module.exports.factory = function(publicRoutes, adminRoutes, profileRoutes, clusterRoutes, domainRoutes, cacheRoutes,
+                                  igfsRoutes, notebookRoutes, agentRoutes, pluginRoutes) {
     return {
         register: (app) => {
             app.all('*', (req, res, next) => {
@@ -55,13 +53,9 @@ module.exports.factory = function (publicRoutes, adminRoutes, profileRoutes,
                 next();
             });
 
-            const _mustAuthenticated = (req, res, next) => {
-                req.isAuthenticated() ? next() : res.redirect('/');
-            };
+            const _mustAuthenticated = (req, res, next) => req.isAuthenticated() ? next() : res.redirect('/');
 
-            const _adminOnly = (req, res, next) => {
-                req.isAuthenticated() && req.user.admin ? next() : res.sendStatus(403);
-            };
+            const _adminOnly = (req, res, next) => req.isAuthenticated() && req.user.admin ? next() : res.sendStatus(403);
 
             // Registering the standard routes
             app.use('/', publicRoutes);
@@ -79,13 +73,14 @@ module.exports.factory = function (publicRoutes, adminRoutes, profileRoutes,
             app.use('/agent', _mustAuthenticated, agentRoutes);
 
             // Registering the routes of all plugin modules
-            for (var name in pluginRoutes)
+            for (const name in pluginRoutes) {
                 if (pluginRoutes.hasOwnProperty(name))
                     pluginRoutes[name].register(app, _mustAuthenticated, _adminOnly);
+            }
 
             // Catch 404 and forward to error handler.
-            app.use(function (req, res, next) {
-                var err = new Error('Not Found: ' + req.originalUrl);
+            app.use((req, res, next) => {
+                const err = new Error('Not Found: ' + req.originalUrl);
 
                 err.status = 404;
 
@@ -93,7 +88,7 @@ module.exports.factory = function (publicRoutes, adminRoutes, profileRoutes,
             });
 
             // Production error handler: no stacktraces leaked to user.
-            app.use(function (err, req, res) {
+            app.use((err, req, res) => {
                 res.status(err.status || 500);
 
                 res.render('error', {