ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Fixed eslint warnings.
Date Fri, 12 Feb 2016 08:09:44 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 dfeb830a8 -> da4708746


IGNITE-843 Fixed eslint warnings.


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

Branch: refs/heads/ignite-843-rc2
Commit: da470874676fb33c9fc17a84042cc024b7a8c5ad
Parents: dfeb830
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Fri Feb 12 15:08:14 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Fri Feb 12 15:08:14 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/serve/routes/admin.js           | 22 +++---
 .../src/main/js/serve/routes/agent.js           | 73 ++++++++++----------
 .../src/main/js/serve/routes/caches.js          | 59 ++++++++--------
 3 files changed, 81 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/da470874/modules/control-center-web/src/main/js/serve/routes/admin.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/admin.js b/modules/control-center-web/src/main/js/serve/routes/admin.js
index 765b8e8..e57410d 100644
--- a/modules/control-center-web/src/main/js/serve/routes/admin.js
+++ b/modules/control-center-web/src/main/js/serve/routes/admin.js
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+'use strict';
+
 // Fire me up!
 
 module.exports = {
@@ -42,9 +44,9 @@ module.exports.factory = function(_, express, nodemailer, settings, mongo)
{
         router.post('/remove', function(req, res) {
             const userId = req.body.userId;
 
-            mongo.Account.findByIdAndRemove(userId, function(err, user) {
-                if (err)
-                    return res.status(500).send(err.message);
+            mongo.Account.findByIdAndRemove(userId, function(errAccount, user) {
+                if (errAccount)
+                    return res.status(500).send(errAccount.message);
 
                 mongo.Space.find({owner: userId}, function(err, spaces) {
                     _.forEach(spaces, (space) => {
@@ -65,9 +67,9 @@ module.exports.factory = function(_, express, nodemailer, settings, mongo)
{
                 };
 
                 if (transporter.service !== '' || transporter.auth.user !== '' || transporter.auth.pass
!== '') {
-                    var mailer = nodemailer.createTransport(transporter);
+                    const mailer = nodemailer.createTransport(transporter);
 
-                    var mailOptions = {
+                    const mailOptions = {
                         from: settings.smtp.address(settings.smtp.username, settings.smtp.email),
                         to: settings.smtp.address(user.username, user.email),
                         subject: 'Your account was deleted',
@@ -76,9 +78,9 @@ module.exports.factory = function(_, express, nodemailer, settings, mongo)
{
                         'Apache Ignite Web Console http://' + req.headers.host + '\n'
                     };
 
-                    mailer.sendMail(mailOptions, function(err) {
-                        if (err)
-                            return res.status(503).send('Account was removed, but failed
to send e-mail notification to user!<br />' + err);
+                    mailer.sendMail(mailOptions, function(errMailer) {
+                        if (errMailer)
+                            return res.status(503).send('Account was removed, but failed
to send e-mail notification to user!<br />' + errMailer);
 
                         res.sendStatus(200);
                     });
@@ -90,8 +92,8 @@ module.exports.factory = function(_, express, nodemailer, settings, mongo)
{
 
         // Save user.
         router.post('/save', function(req, res) {
-            var userId = req.body.userId;
-            var adminFlag = req.body.adminFlag;
+            const userId = req.body.userId;
+            const adminFlag = req.body.adminFlag;
 
             mongo.Account.findByIdAndUpdate(userId, {admin: adminFlag}, function(err) {
                 if (err)

http://git-wip-us.apache.org/repos/asf/ignite/blob/da470874/modules/control-center-web/src/main/js/serve/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/agent.js b/modules/control-center-web/src/main/js/serve/routes/agent.js
index 4582820..5fa0328 100644
--- a/modules/control-center-web/src/main/js/serve/routes/agent.js
+++ b/modules/control-center-web/src/main/js/serve/routes/agent.js
@@ -38,7 +38,8 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip, settings,
     return new Promise((resolve) => {
         const router = express.Router();
 
-        const SqlFieldsQuery = apacheIgnite.SqlFieldsQuery, ScanQuery = apacheIgnite.ScanQuery;
+        const SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
+        const ScanQuery = apacheIgnite.ScanQuery;
 
         const _client = (userId) => {
             return new Promise((resolve, reject) => {
@@ -66,24 +67,24 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
 
         /* Get grid topology. */
         router.get('/download/zip', function(req, res) {
-            var agentFld = settings.agent.file;
-            var agentZip = agentFld + '.zip';
-            var agentPathZip = 'public/agent/' + agentFld + '.zip';
+            const agentFld = settings.agent.file;
+            const agentZip = agentFld + '.zip';
+            const agentPathZip = 'public/agent/' + agentFld + '.zip';
 
             fs.stat(agentPathZip, function(err, stats) {
                 if (err)
                     return res.download(agentPathZip, agentZip);
 
                 // Read a zip file.
-                fs.readFile(agentPathZip, function(err, data) {
-                    if (err)
+                fs.readFile(agentPathZip, function(errFs, data) {
+                    if (errFs)
                         return res.download(agentPathZip, agentZip);
 
-                    var zip = new JSZip(data);
+                    const zip = new JSZip(data);
 
-                    var prop = [];
+                    const prop = [];
 
-                    var host = req.hostname.match(/:/g) ? req.hostname.slice(0, req.hostname.indexOf(':'))
: req.hostname;
+                    const host = req.hostname.match(/:/g) ? req.hostname.slice(0, req.hostname.indexOf(':'))
: req.hostname;
 
                     prop.push('token=' + req.user.token);
                     prop.push('server-uri=wss://' + host + ':' + settings.agent.port);
@@ -96,7 +97,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip, settings,
 
                     zip.file(agentFld + '/default.properties', prop.join('\n'));
 
-                    var buffer = zip.generate({type: 'nodebuffer', platform: 'UNIX'});
+                    const buffer = zip.generate({type: 'nodebuffer', platform: 'UNIX'});
 
                     // Set the archive name.
                     res.attachment(agentZip);
@@ -119,7 +120,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
             _client(req.currentUserId())
                 .then((client) => {
                     // Create sql query.
-                    var qry = new SqlFieldsQuery(req.body.query);
+                    const qry = new SqlFieldsQuery(req.body.query);
 
                     // Set page size for query.
                     qry.setPageSize(req.body.pageSize);
@@ -148,10 +149,10 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
                     const cursor = client.ignite(req.body.demo).cache(req.body.cacheName).query(qry);
 
                     return new Promise(function(resolve) {
-                        cursor.getAll().then(rows => resolve({meta: cursor.fieldsMetadata(),
rows}));
+                        cursor.getAll().then((rows) => resolve({meta: cursor.fieldsMetadata(),
rows}));
                     });
                 })
-                .then(response => res.json(response))
+                .then((response) => res.json(response))
                 .catch(_handleException(res));
         });
 
@@ -160,7 +161,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
             _client(req.currentUserId())
                 .then((client) => {
                     // Create sql query.
-                    var qry = new ScanQuery();
+                    const qry = new ScanQuery();
 
                     // Set page size for query.
                     qry.setPageSize(req.body.pageSize);
@@ -180,15 +181,15 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
         router.post('/query/fetch', function(req, res) {
             _client(req.currentUserId())
                 .then((client) => {
-                    var cache = client.ignite(req.body.demo).cache(req.body.cacheName);
+                    const cache = client.ignite(req.body.demo).cache(req.body.cacheName);
 
-                    var cmd = cache._createCommand('qryfetch')
+                    const cmd = cache._createCommand('qryfetch')
                         .addParam('qryId', req.body.queryId)
                         .addParam('pageSize', req.body.pageSize);
 
                     return cache.__createPromise(cmd);
                 })
-                .then((page) => res.json({rows: page['items'], last: page === null ||
page['last']}))
+                .then((page) => res.json({rows: page.items, last: page === null || page.last}))
                 .catch(_handleException(res));
         });
 
@@ -196,7 +197,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
         router.post('/query/close', function(req, res) {
             _client(req.currentUserId())
                 .then((client) => {
-                    var cache = client.ignite(req.body.demo).cache(req.body.cacheName);
+                    const cache = client.ignite(req.body.demo).cache(req.body.cacheName);
 
                     return cache.__createPromise(cache._createCommand('qrycls').addParam('qryId',
req.body.queryId));
                 })
@@ -209,40 +210,40 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
             _client(req.currentUserId())
                 .then((client) => client.ignite(req.body.demo).cache(req.body.cacheName).metadata())
                 .then((caches) => {
-                    var types = [];
+                    let types = [];
 
-                    for (var meta of caches) {
-                        var cacheTypes = meta.types.map(function(typeName) {
-                            var fields = meta.fields[typeName];
+                    for (const meta of caches) {
+                        const cacheTypes = meta.types.map(function(typeName) {
+                            let fields = meta.fields[typeName];
 
-                            var columns = [];
+                            let columns = [];
 
-                            for (var fieldName in fields) {
-                                var fieldClass = _compact(fields[fieldName]);
+                            for (const fieldName in fields) {
+                                const fieldClass = _compact(fields[fieldName]);
 
                                 columns.push({
                                     type: 'field',
                                     name: fieldName,
                                     clazz: fieldClass,
-                                    system: fieldName === "_KEY" || fieldName === "_VAL",
+                                    system: fieldName === '_KEY' || fieldName === '_VAL',
                                     cacheName: meta.cacheName,
-                                    typeName: typeName
+                                    typeName
                                 });
                             }
 
-                            var indexes = [];
+                            const indexes = [];
 
-                            for (var index of meta.indexes[typeName]) {
+                            for (const index of meta.indexes[typeName]) {
                                 fields = [];
 
-                                for (var field of index.fields) {
+                                for (const field of index.fields) {
                                     fields.push({
                                         type: 'index-field',
                                         name: field,
                                         order: index.descendings.indexOf(field) < 0,
                                         unique: index.unique,
                                         cacheName: meta.cacheName,
-                                        typeName: typeName
+                                        typeName
                                     });
                                 }
 
@@ -252,7 +253,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
                                         name: index.name,
                                         children: fields,
                                         cacheName: meta.cacheName,
-                                        typeName: typeName
+                                        typeName
                                     });
                                 }
                             }
@@ -264,7 +265,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
                                     type: 'indexes',
                                     name: 'Indexes',
                                     cacheName: meta.cacheName,
-                                    typeName: typeName,
+                                    typeName,
                                     children: indexes
                                 });
                             }
@@ -305,11 +306,11 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
         router.post('/schemas', function(req, res) {
             _client(req.currentUserId())
                 .then((client) => {
-                    var args = req.body;
+                    const args = req.body;
 
                     args.jdbcInfo = {user: args.user, password: args.password};
 
-                    return client.metadataSchemas(args.jdbcDriverJar, args.jdbcDriverClass,
args.jdbcUrl, args.jdbcInfo)
+                    return client.metadataSchemas(args.jdbcDriverJar, args.jdbcDriverClass,
args.jdbcUrl, args.jdbcInfo);
                 })
                 .then((arr) => res.json(arr))
                 .catch(_handleException(res));
@@ -319,7 +320,7 @@ module.exports.factory = function(_, express, apacheIgnite, fs, JSZip,
settings,
         router.post('/tables', function(req, res) {
             _client(req.currentUserId())
                 .then((client) => {
-                    var args = req.body;
+                    const args = req.body;
 
                     args.jdbcInfo = {user: args.user, password: args.password};
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/da470874/modules/control-center-web/src/main/js/serve/routes/caches.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/caches.js b/modules/control-center-web/src/main/js/serve/routes/caches.js
index 3d3824a..bb7097a 100644
--- a/modules/control-center-web/src/main/js/serve/routes/caches.js
+++ b/modules/control-center-web/src/main/js/serve/routes/caches.js
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+'use strict';
+
 // Fire me up!
 
 module.exports = {
@@ -33,21 +35,21 @@ module.exports.factory = function(_, express, mongo) {
          * @param res Response.
          */
         router.post('/list', function(req, res) {
-            var user_id = req.currentUserId();
+            const user_id = req.currentUserId();
 
             // Get owned space and all accessed space.
-            mongo.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]},
function(err, spaces) {
-                if (mongo.processed(err, res)) {
-                    var space_ids = spaces.map(function(value) {
+            mongo.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]},
function(errSpace, spaces) {
+                if (mongo.processed(errSpace, res)) {
+                    const space_ids = spaces.map(function(value) {
                         return value._id;
                     });
 
                     // Get all clusters for spaces.
-                    mongo.Cluster.find({space: {$in: space_ids}}, '_id name caches').sort('name').exec(function(err,
clusters) {
-                        if (mongo.processed(err, res)) {
+                    mongo.Cluster.find({space: {$in: space_ids}}, '_id name caches').sort('name').exec(function(errCluster,
clusters) {
+                        if (mongo.processed(errCluster, res)) {
                             // Get all domain models for spaces.
-                            mongo.DomainModel.find({space: {$in: space_ids}}).sort('name').exec(function(err,
domains) {
-                                if (mongo.processed(err, res)) {
+                            mongo.DomainModel.find({space: {$in: space_ids}}).sort('name').exec(function(errDomainModel,
domains) {
+                                if (mongo.processed(errDomainModel, res)) {
                                     // Get all caches for spaces.
                                     mongo.Cache.find({space: {$in: space_ids}}).sort('name').exec(function(err,
caches) {
                                         if (mongo.processed(err, res)) {
@@ -67,15 +69,15 @@ module.exports.factory = function(_, express, mongo) {
                                                 // Remove deleted clusters.
                                                 cache.clusters = _.filter(cache.clusters,
function(clusterId) {
                                                     return _.findIndex(clusters, function(cluster)
{
-                                                            return cluster._id.equals(clusterId);
-                                                        }) >= 0;
+                                                        return cluster._id.equals(clusterId);
+                                                    }) >= 0;
                                                 });
 
                                                 // Remove deleted domain models.
                                                 cache.domains = _.filter(cache.domains, function(metaId)
{
                                                     return _.findIndex(domains, function(domain)
{
-                                                            return domain._id.equals(metaId);
-                                                        }) >= 0;
+                                                        return domain._id.equals(metaId);
+                                                    }) >= 0;
                                                 });
                                             });
 
@@ -88,8 +90,8 @@ module.exports.factory = function(_, express, mongo) {
                                                         caches: cluster.caches
                                                     };
                                                 }),
-                                                domains: domains,
-                                                caches: caches
+                                                domains,
+                                                caches
                                             });
                                         }
                                     });
@@ -105,27 +107,30 @@ module.exports.factory = function(_, express, mongo) {
          * Save cache.
          */
         router.post('/save', function(req, res) {
-            var params = req.body;
-            var cacheId = params._id;
-            var clusters = params.clusters;
-            var domains = params.domains;
+            const params = req.body;
+            const clusters = params.clusters;
+            const domains = params.domains;
+            let cacheId = params._id;
 
             if (params._id) {
                 mongo.Cache.update({_id: cacheId}, params, {upsert: true}, function(err)
{
-                    if (mongo.processed(err, res))
-                        mongo.Cluster.update({_id: {$in: clusters}}, {$addToSet: {caches:
cacheId}}, {multi: true}, function(err) {
-                            if (mongo.processed(err, res))
-                                mongo.Cluster.update({_id: {$nin: clusters}}, {$pull: {caches:
cacheId}}, {multi: true}, function(err) {
-                                    if (mongo.processed(err, res))
-                                        mongo.DomainModel.update({_id: {$in: domains}}, {$addToSet:
{caches: cacheId}}, {multi: true}, function(err) {
+                    if (mongo.processed(err, res)) {
+                        mongo.Cluster.update({_id: {$in: clusters}}, {$addToSet: {caches:
cacheId}}, {multi: true}, function (err) {
+                            if (mongo.processed(err, res)) {
+                                mongo.Cluster.update({_id: {$nin: clusters}}, {$pull: {caches:
cacheId}}, {multi: true}, function (err) {
+                                    if (mongo.processed(err, res)) {
+                                        mongo.DomainModel.update({_id: {$in: domains}}, {$addToSet:
{caches: cacheId}}, {multi: true}, function (err) {
                                             if (mongo.processed(err, res))
-                                                mongo.DomainModel.update({_id: {$nin: domains}},
{$pull: {caches: cacheId}}, {multi: true}, function(err) {
+                                                mongo.DomainModel.update({_id: {$nin: domains}},
{$pull: {caches: cacheId}}, {multi: true}, function (err) {
                                                     if (mongo.processed(err, res))
                                                         res.send(params._id);
                                                 });
                                         });
+                                    }
                                 });
+                            }
                         });
+                    }
                 });
             }
             else
@@ -165,12 +170,12 @@ module.exports.factory = function(_, express, mongo) {
          * Remove all caches.
          */
         router.post('/remove/all', function(req, res) {
-            var user_id = req.currentUserId();
+            const user_id = req.currentUserId();
 
             // Get owned space and all accessed space.
             mongo.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]},
function(err, spaces) {
                 if (mongo.processed(err, res)) {
-                    var space_ids = spaces.map(function(value) {
+                    const space_ids = spaces.map(function(value) {
                         return value._id;
                     });
 


Mime
View raw message