You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/07/23 10:41:14 UTC

[43/50] [abbrv] incubator-ignite git commit: # ignite-843 moved

# ignite-843 moved


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

Branch: refs/heads/ignite-1121
Commit: 8a33572426c877c690e788ee1f71f7ff79edae70
Parents: e7ebf45
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 22 18:01:16 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 22 18:01:16 2015 +0700

----------------------------------------------------------------------
 modules/web-control-center/nodejs/.gitignore    |    4 -
 modules/web-control-center/nodejs/DEVNOTES.txt  |   21 -
 modules/web-control-center/nodejs/app.js        |  154 ---
 modules/web-control-center/nodejs/bin/www       |   85 --
 .../nodejs/config/default.json                  |    8 -
 .../nodejs/controllers/admin-controller.js      |   68 -
 .../controllers/cache-viewer-controller.js      |   77 --
 .../nodejs/controllers/caches-controller.js     |  333 -----
 .../nodejs/controllers/clusters-controller.js   |  309 -----
 .../nodejs/controllers/common-module.js         |  422 -------
 .../nodejs/controllers/metadata-controller.js   |  678 ----------
 .../nodejs/controllers/models/caches.json       |  918 --------------
 .../nodejs/controllers/models/clusters.json     |  907 --------------
 .../nodejs/controllers/models/metadata.json     |  230 ----
 .../nodejs/controllers/models/summary.json      |  163 ---
 .../nodejs/controllers/profile-controller.js    |   51 -
 .../nodejs/controllers/summary-controller.js    |  164 ---
 modules/web-control-center/nodejs/db.js         |  358 ------
 .../nodejs/helpers/configuration-loader.js      |   22 -
 .../nodejs/helpers/data-structures.js           |   84 --
 modules/web-control-center/nodejs/package.json  |   50 -
 .../nodejs/public/favicon.ico                   |  Bin 1150 -> 0 bytes
 .../nodejs/public/images/docker.png             |  Bin 994 -> 0 bytes
 .../nodejs/public/images/java.png               |  Bin 170 -> 0 bytes
 .../nodejs/public/images/logo.png               |  Bin 8148 -> 0 bytes
 .../nodejs/public/images/xml.png                |  Bin 232 -> 0 bytes
 .../nodejs/public/stylesheets/style.less        | 1172 ------------------
 .../web-control-center/nodejs/routes/admin.js   |   79 --
 .../web-control-center/nodejs/routes/caches.js  |   95 --
 .../nodejs/routes/clusters.js                   |  104 --
 .../nodejs/routes/generator/common.js           |  299 -----
 .../nodejs/routes/generator/docker.js           |   58 -
 .../nodejs/routes/generator/java.js             |  626 ----------
 .../nodejs/routes/generator/xml.js              |  580 ---------
 .../nodejs/routes/metadata.js                   |   95 --
 .../web-control-center/nodejs/routes/profile.js |   97 --
 .../web-control-center/nodejs/routes/public.js  |  123 --
 modules/web-control-center/nodejs/routes/sql.js |   24 -
 .../web-control-center/nodejs/routes/summary.js |  108 --
 .../nodejs/views/configuration/caches.jade      |   74 --
 .../nodejs/views/configuration/clusters.jade    |   77 --
 .../nodejs/views/configuration/metadata.jade    |  121 --
 .../nodejs/views/configuration/sidebar.jade     |   39 -
 .../nodejs/views/configuration/summary.jade     |  117 --
 .../web-control-center/nodejs/views/error.jade  |   22 -
 .../nodejs/views/includes/controls.jade         |  322 -----
 .../nodejs/views/includes/footer.jade           |   22 -
 .../nodejs/views/includes/header.jade           |   39 -
 .../web-control-center/nodejs/views/index.jade  |   30 -
 .../web-control-center/nodejs/views/login.jade  |   55 -
 .../nodejs/views/settings/admin.jade            |   58 -
 .../nodejs/views/settings/profile.jade          |   58 -
 .../nodejs/views/templates/confirm.jade         |   27 -
 .../nodejs/views/templates/copy.jade            |   31 -
 .../nodejs/views/templates/layout.jade          |   61 -
 .../nodejs/views/templates/select.jade          |   26 -
 .../web-control-center/src/main/js/.gitignore   |    4 +
 .../web-control-center/src/main/js/DEVNOTES.txt |   21 +
 modules/web-control-center/src/main/js/app.js   |  154 +++
 modules/web-control-center/src/main/js/bin/www  |   85 ++
 .../src/main/js/config/default.json             |    8 +
 .../src/main/js/controllers/admin-controller.js |   68 +
 .../js/controllers/cache-viewer-controller.js   |   77 ++
 .../main/js/controllers/caches-controller.js    |  333 +++++
 .../main/js/controllers/clusters-controller.js  |  309 +++++
 .../src/main/js/controllers/common-module.js    |  422 +++++++
 .../main/js/controllers/metadata-controller.js  |  678 ++++++++++
 .../src/main/js/controllers/models/caches.json  |  918 ++++++++++++++
 .../main/js/controllers/models/clusters.json    |  907 ++++++++++++++
 .../main/js/controllers/models/metadata.json    |  230 ++++
 .../src/main/js/controllers/models/summary.json |  163 +++
 .../main/js/controllers/profile-controller.js   |   51 +
 .../main/js/controllers/summary-controller.js   |  164 +++
 modules/web-control-center/src/main/js/db.js    |  358 ++++++
 .../src/main/js/helpers/configuration-loader.js |   22 +
 .../src/main/js/helpers/data-structures.js      |   84 ++
 .../web-control-center/src/main/js/package.json |   50 +
 .../src/main/js/public/favicon.ico              |  Bin 0 -> 1150 bytes
 .../src/main/js/public/images/docker.png        |  Bin 0 -> 994 bytes
 .../src/main/js/public/images/java.png          |  Bin 0 -> 170 bytes
 .../src/main/js/public/images/logo.png          |  Bin 0 -> 8148 bytes
 .../src/main/js/public/images/xml.png           |  Bin 0 -> 232 bytes
 .../src/main/js/public/stylesheets/style.less   | 1172 ++++++++++++++++++
 .../src/main/js/routes/admin.js                 |   79 ++
 .../src/main/js/routes/caches.js                |   95 ++
 .../src/main/js/routes/clusters.js              |  104 ++
 .../src/main/js/routes/generator/common.js      |  299 +++++
 .../src/main/js/routes/generator/docker.js      |   58 +
 .../src/main/js/routes/generator/java.js        |  626 ++++++++++
 .../src/main/js/routes/generator/xml.js         |  580 +++++++++
 .../src/main/js/routes/metadata.js              |   95 ++
 .../src/main/js/routes/profile.js               |   97 ++
 .../src/main/js/routes/public.js                |  123 ++
 .../src/main/js/routes/sql.js                   |   24 +
 .../src/main/js/routes/summary.js               |  108 ++
 .../src/main/js/views/configuration/caches.jade |   74 ++
 .../main/js/views/configuration/clusters.jade   |   77 ++
 .../main/js/views/configuration/metadata.jade   |  121 ++
 .../main/js/views/configuration/sidebar.jade    |   39 +
 .../main/js/views/configuration/summary.jade    |  117 ++
 .../src/main/js/views/error.jade                |   22 +
 .../src/main/js/views/includes/controls.jade    |  322 +++++
 .../src/main/js/views/includes/footer.jade      |   22 +
 .../src/main/js/views/includes/header.jade      |   39 +
 .../src/main/js/views/index.jade                |   30 +
 .../src/main/js/views/login.jade                |   55 +
 .../src/main/js/views/settings/admin.jade       |   58 +
 .../src/main/js/views/settings/profile.jade     |   58 +
 .../src/main/js/views/templates/confirm.jade    |   27 +
 .../src/main/js/views/templates/copy.jade       |   31 +
 .../src/main/js/views/templates/layout.jade     |   61 +
 .../src/main/js/views/templates/select.jade     |   26 +
 112 files changed, 9745 insertions(+), 9745 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/.gitignore b/modules/web-control-center/nodejs/.gitignore
deleted file mode 100644
index 65f2596..0000000
--- a/modules/web-control-center/nodejs/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-node_modules
-*.idea
-*.log
-*.css
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/DEVNOTES.txt b/modules/web-control-center/nodejs/DEVNOTES.txt
deleted file mode 100644
index aa56011..0000000
--- a/modules/web-control-center/nodejs/DEVNOTES.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Ignite Web Control Center Instructions
-======================================
-
-How to deploy:
-
-1. Install locally NodeJS using installer from site https://nodejs.org for your OS.
-2. Install locally MongoDB folow instructions from site http://docs.mongodb.org/manual/installation
-3. Checkout ignite-843 branch.
-4. Change directory '$IGNITE_HOME/modules/web-control-center/nodejs'.
-5. Run "npm install" in terminal for download all dependencies.
-
-Steps 1 - 5 should be executed once.
-
-How to run:
-
-1. Run MongoDB.
- 1.1 In terminal change dir to $MONGO_ISNTALL_DIR/server/3.0/bin.
- 1.2 Run "mongod".
-2. In new terminal change directory '$IGNITE_HOME/modules/web-control-center/nodejs'.
-3. Start application by executing "npm start".
-4. In browser open: http://localhost:3000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/app.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/app.js b/modules/web-control-center/nodejs/app.js
deleted file mode 100644
index 8c347db..0000000
--- a/modules/web-control-center/nodejs/app.js
+++ /dev/null
@@ -1,154 +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.
- */
-
-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 mongoStore = require('connect-mongo')(session);
-
-var publicRoutes = require('./routes/public');
-var clustersRouter = require('./routes/clusters');
-var cachesRouter = require('./routes/caches');
-var metadataRouter = require('./routes/metadata');
-var summary = require('./routes/summary');
-var adminRouter = require('./routes/admin');
-var profileRouter = require('./routes/profile');
-var sqlRouter = require('./routes/sql');
-
-var passport = require('passport');
-
-var db = require('./db');
-
-var app = express();
-
-// Views engine setup.
-app.set('views', path.join(__dirname, 'views'));
-app.set('view engine', 'jade');
-
-// 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'), {
-    render: {
-        compress: false
-    }
-}));
-
-app.use(express.static(path.join(__dirname, 'public')));
-app.use(express.static(path.join(__dirname, 'controllers')));
-app.use(express.static(path.join(__dirname, 'helpers')));
-
-app.use(cookieParser('keyboard cat'));
-
-app.use(session({
-    secret: 'keyboard cat',
-    resave: false,
-    saveUninitialized: true,
-    store: new mongoStore({
-        mongooseConnection: db.mongoose.connection
-    })
-}));
-
-app.use(flash());
-
-app.use(passport.initialize());
-app.use(passport.session());
-
-passport.serializeUser(db.Account.serializeUser());
-passport.deserializeUser(db.Account.deserializeUser());
-
-passport.use(db.Account.createStrategy());
-
-var mustAuthenticated = function (req, res, next) {
-    req.isAuthenticated() ? next() : res.redirect('/');
-};
-
-var adminOnly = function(req, res, next) {
-    req.isAuthenticated() && req.user.admin ? next() : res.sendStatus(403);
-};
-
-app.all('/configuration/*', mustAuthenticated);
-
-app.all('*', function(req, res, next) {
-    var becomeUsed = req.session.viewedUser && req.user.admin;
-
-    res.locals.user = becomeUsed ? req.session.viewedUser : req.user;
-    res.locals.becomeUsed = becomeUsed;
-
-    req.currentUserId = function() {
-        if (!req.user)
-            return null;
-
-        if (req.session.viewedUser && req.user.admin)
-            return req.session.viewedUser._id;
-
-        return req.user._id;
-    };
-
-    next();
-});
-
-app.use('/', publicRoutes);
-app.use('/admin', mustAuthenticated, adminOnly, adminRouter);
-app.use('/profile', mustAuthenticated, profileRouter);
-
-app.use('/configuration/clusters', clustersRouter);
-app.use('/configuration/caches', cachesRouter);
-app.use('/configuration/metadata', metadataRouter);
-app.use('/configuration/summary', summary);
-app.use('/sql', sqlRouter);
-
-// Catch 404 and forward to error handler.
-app.use(function (req, res, next) {
-    var err = new Error('Not Found: ' + req.originalUrl);
-    err.status = 404;
-    next(err);
-});
-
-// Error handlers.
-
-// Development error handler: will print stacktrace.
-if (app.get('env') === 'development') {
-    app.use(function (err, req, res) {
-        res.status(err.status || 500);
-        res.render('error', {
-            message: err.message,
-            error: err
-        });
-    });
-}
-
-// Production error handler: no stacktraces leaked to user.
-app.use(function (err, req, res) {
-    res.status(err.status || 500);
-    res.render('error', {
-        message: err.message,
-        error: {}
-    });
-});
-
-module.exports = app;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/bin/www
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/bin/www b/modules/web-control-center/nodejs/bin/www
deleted file mode 100644
index 4cf0583..0000000
--- a/modules/web-control-center/nodejs/bin/www
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-var app = require('../app');
-var config = require('../helpers/configuration-loader.js');
-var debug = require('debug')('ignite-web-control-center:server');
-var http = require('http');
-
-/**
- * Get port from environment and store in Express.
- */
-var port = normalizePort(process.env.PORT || config.get('express:port'));
-app.set('port', port);
-
-/**
- * Create HTTP server.
- */
-var server = http.createServer(app);
-
-/**
- * Listen on provided port, on all network interfaces.
- */
-server.listen(port);
-server.on('error', onError);
-server.on('listening', onListening);
-
-/**
- * Normalize a port into a number, string, or false.
- */
-function normalizePort(val) {
-  var port = parseInt(val, 10);
-
-  if (isNaN(port)) {
-    // named pipe
-    return val;
-  }
-
-  if (port >= 0) {
-    // port number
-    return port;
-  }
-
-  return false;
-}
-
-/**
- * Event listener for HTTP server "error" event.
- */
-function onError(error) {
-  if (error.syscall !== 'listen') {
-    throw error;
-  }
-
-  var bind = typeof port === 'string'
-    ? 'Pipe ' + port
-    : 'Port ' + port;
-
-  // handle specific listen errors with friendly messages
-  switch (error.code) {
-    case 'EACCES':
-      console.error(bind + ' requires elevated privileges');
-      process.exit(1);
-      break;
-    case 'EADDRINUSE':
-      console.error(bind + ' is already in use');
-      process.exit(1);
-      break;
-    default:
-      throw error;
-  }
-}
-
-/**
- * Event listener for HTTP server "listening" event.
- */
-function onListening() {
-  var addr = server.address();
-  var bind = typeof addr === 'string'
-    ? 'pipe ' + addr
-    : 'port ' + addr.port;
-
-  debug('Listening on ' + bind);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/config/default.json
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/config/default.json b/modules/web-control-center/nodejs/config/default.json
deleted file mode 100644
index 72dbd4e..0000000
--- a/modules/web-control-center/nodejs/config/default.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-    "express": {
-        "port": 3000
-    },
-    "mongoDB": {
-        "url": "mongodb://localhost/web-control-center"
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/controllers/admin-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/admin-controller.js b/modules/web-control-center/nodejs/controllers/admin-controller.js
deleted file mode 100644
index 09490fe..0000000
--- a/modules/web-control-center/nodejs/controllers/admin-controller.js
+++ /dev/null
@@ -1,68 +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.
- */
-
-controlCenterModule.controller('adminController', ['$scope', '$http', '$common', '$confirm', function ($scope, $http, $common, $confirm) {
-    $scope.users = null;
-
-    function reload() {
-        $http.post('admin/list')
-            .success(function (data) {
-                $scope.users = data;
-            })
-            .error(function (errMsg) {
-                $common.showError($common.errorMessage(errMsg));
-            });
-    }
-
-    reload();
-
-    $scope.removeUser = function (user) {
-        $confirm.show('Are you sure you want to remove user: "' + user.username + '"?').then(function () {
-            $http.post('admin/remove', {userId: user._id}).success(
-                function () {
-                    var i = _.findIndex($scope.users, function (u) {
-                        return u._id == user._id;
-                    });
-
-                    if (i >= 0)
-                        $scope.users.splice(i, 1);
-
-                    $common.showInfo('User has been removed: "' + user.username + '"');
-                }).error(function (errMsg) {
-                    $common.showError('Failed to remove user: "' + $common.errorMessage(errMsg) + '"');
-                });
-        });
-    };
-
-    $scope.toggleAdmin = function (user) {
-        if (user.adminChanging)
-            return;
-
-        user.adminChanging = true;
-
-        $http.post('admin/save', {userId: user._id, adminFlag: user.admin}).success(
-            function () {
-                $common.showInfo('Admin right was successfully toggled for user: "' + user.username + '"');
-
-                user.adminChanging = false;
-            }).error(function (errMsg) {
-                $common.showError('Failed to toggle admin right for user: "' + $common.errorMessage(errMsg) + '"');
-
-                user.adminChanging = false;
-            });
-    }
-}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js b/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js
deleted file mode 100644
index 6e0c130..0000000
--- a/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js
+++ /dev/null
@@ -1,77 +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.
- */
-
-var demoResults = [
-    {
-        id: 256,
-        s: 'com.foo.User@3213',
-        fields: {
-            id: 256,
-            firstName: 'Ivan',
-            lastName: 'Ivanov',
-            old: 23
-        }
-    },
-
-    {
-        id: 384,
-        s: 'com.foo.User@23214',
-        fields: {
-            id: 384,
-            firstName: 'Sergey',
-            lastName: 'Petrov',
-            old: 28
-        }
-    },
-
-    {
-        id: 923,
-        s: 'com.foo.User@93494',
-        fields: {
-            id: 923,
-            firstName: 'Andrey',
-            lastName: 'Sidorov',
-            old: 28
-        }
-    }
-];
-
-var demoCaches = ['Users', 'Organizations', 'Cities'];
-
-controlCenterModule.controller('cacheViewerController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
-    $scope.results = demoResults;
-
-    $scope.caches = demoCaches;
-
-    $scope.defCache = $scope.caches.length > 0 ? $scope.caches[0] : null;
-
-    var sqlEditor = ace.edit('querySql');
-
-    sqlEditor.setOptions({
-        highlightActiveLine: false,
-        showPrintMargin: false,
-        showGutter: true,
-        theme: "ace/theme/chrome",
-        mode: "ace/mode/sql",
-        fontSize: 14
-    });
-
-    sqlEditor.setValue("select u.id from User u where u.name like 'aaaa';");
-
-    sqlEditor.selection.clearSelection()
-
-}]);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/caches-controller.js b/modules/web-control-center/nodejs/controllers/caches-controller.js
deleted file mode 100644
index 0c23e3b..0000000
--- a/modules/web-control-center/nodejs/controllers/caches-controller.js
+++ /dev/null
@@ -1,333 +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.
- */
-
-controlCenterModule.controller('cachesController', ['$scope', '$http', '$common', '$confirm', '$copy', '$table', function ($scope, $http, $common, $confirm, $copy, $table) {
-        $scope.joinTip = $common.joinTip;
-        $scope.getModel = $common.getModel;
-
-        $scope.tableNewItem = $table.tableNewItem;
-        $scope.tableNewItemActive = $table.tableNewItemActive;
-        $scope.tableEditing = $table.tableEditing;
-        $scope.tableStartEdit = $table.tableStartEdit;
-        $scope.tableRemove = $table.tableRemove;
-
-        $scope.tableSimpleSave = $table.tableSimpleSave;
-        $scope.tableSimpleSaveVisible = $table.tableSimpleSaveVisible;
-        $scope.tableSimpleUp = $table.tableSimpleUp;
-        $scope.tableSimpleDown = $table.tableSimpleDown;
-        $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible;
-
-        $scope.tablePairSave = $table.tablePairSave;
-        $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
-
-        $scope.atomicities = [
-            {value: 'ATOMIC', label: 'ATOMIC'},
-            {value: 'TRANSACTIONAL', label: 'TRANSACTIONAL'}
-        ];
-
-        $scope.modes = [
-            {value: 'PARTITIONED', label: 'PARTITIONED'},
-            {value: 'REPLICATED', label: 'REPLICATED'},
-            {value: 'LOCAL', label: 'LOCAL'}
-        ];
-
-        $scope.atomicWriteOrderModes = [
-            {value: 'CLOCK', label: 'CLOCK'},
-            {value: 'PRIMARY', label: 'PRIMARY'}
-        ];
-
-        $scope.memoryModes = [
-            {value: 'ONHEAP_TIERED', label: 'ONHEAP_TIERED'},
-            {value: 'OFFHEAP_TIERED', label: 'OFFHEAP_TIERED'},
-            {value: 'OFFHEAP_VALUES', label: 'OFFHEAP_VALUES'}
-        ];
-
-        $scope.evictionPolicies = [
-            {value: 'LRU', label: 'LRU'},
-            {value: 'RND', label: 'Random'},
-            {value: 'FIFO', label: 'FIFO'},
-            {value: 'SORTED', label: 'Sorted'},
-            {value: undefined, label: 'Not set'}
-        ];
-
-        $scope.rebalanceModes = [
-            {value: 'SYNC', label: 'SYNC'},
-            {value: 'ASYNC', label: 'ASYNC'},
-            {value: 'NONE', label: 'NONE'}
-        ];
-
-        $scope.cacheStoreFactories = [
-            {value: 'CacheJdbcPojoStoreFactory', label: 'JDBC POJO store factory'},
-            {value: 'CacheJdbcBlobStoreFactory', label: 'JDBC BLOB store factory'},
-            {value: 'CacheHibernateBlobStoreFactory', label: 'Hibernate BLOB store factory'},
-            {value: undefined, label: 'Not set'}
-        ];
-
-        $scope.cacheStoreJdbcDialects = [
-            {value: 'Oracle', label: 'Oracle'},
-            {value: 'DB2', label: 'IBM DB2'},
-            {value: 'SQLServer', label: 'Microsoft SQL Server'},
-            {value: 'MySQL', label: 'My SQL'},
-            {value: 'PostgreSQL', label: 'Postgre SQL'},
-            {value: 'H2', label: 'H2 database'}
-        ];
-
-        $scope.general = [];
-        $scope.advanced = [];
-
-        $http.get('/models/caches.json')
-            .success(function (data) {
-                $scope.screenTip = data.screenTip;
-                $scope.general = data.general;
-                $scope.advanced = data.advanced;
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        $scope.caches = [];
-
-        $scope.required = function (field) {
-            var model = $common.isDefined(field.path) ? field.path + '.' + field.model : field.model;
-
-            var backupItem = $scope.backupItem;
-
-            var memoryMode = backupItem.memoryMode;
-
-            var onHeapTired = memoryMode == 'ONHEAP_TIERED';
-            var offHeapTired = memoryMode == 'OFFHEAP_TIERED';
-
-            var offHeapMaxMemory = backupItem.offHeapMaxMemory;
-
-            if (model == 'offHeapMaxMemory' && offHeapTired)
-                return true;
-
-            if (model == 'evictionPolicy.kind' && onHeapTired)
-                return backupItem.swapEnabled || ($common.isDefined(offHeapMaxMemory) && offHeapMaxMemory >= 0);
-
-            return false;
-        };
-
-        $scope.tableSimpleValid = function (item, field, fx, index) {
-            var model = item[field.model];
-
-            if ($common.isDefined(model)) {
-                var idx = _.indexOf(model, fx);
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('SQL function such class name already exists!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        };
-
-        $scope.tablePairValid = function (item, field, keyCls, valCls, index) {
-            var model = item[field.model];
-
-            if ($common.isDefined(model)) {
-                var idx = _.findIndex(model, function (pair) {
-                    return pair.keyClass == keyCls
-                });
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('Indexed type with such key class already exists!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        };
-
-        // When landing on the page, get caches and show them.
-        $http.post('caches/list')
-            .success(function (data) {
-                $scope.spaces = data.spaces;
-                $scope.caches = data.caches;
-
-                var restoredItem = angular.fromJson(sessionStorage.cacheBackupItem);
-
-                if (restoredItem) {
-                    if (restoredItem._id) {
-                        var idx = _.findIndex($scope.caches, function (cache) {
-                            return cache._id == restoredItem._id;
-                        });
-
-                        if (idx >= 0) {
-                            $scope.selectedItem = $scope.caches[idx];
-                            $scope.backupItem = restoredItem;
-                        }
-                        else
-                            sessionStorage.removeItem('cacheBackupItem');
-                    }
-                    else
-                        $scope.backupItem = restoredItem;
-                }
-                else if ($scope.caches.length > 0)
-                    $scope.selectItem($scope.caches[0]);
-
-                $scope.$watch('backupItem', function (val) {
-                    if (val)
-                        sessionStorage.cacheBackupItem = angular.toJson(val);
-                }, true);
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        $scope.selectItem = function (item) {
-            $table.tableReset();
-
-            $scope.selectedItem = item;
-            $scope.backupItem = angular.copy(item);
-        };
-
-        // Add new cache.
-        $scope.createItem = function () {
-            $table.tableReset();
-
-            $scope.backupItem = {mode: 'PARTITIONED', atomicityMode: 'ATOMIC', readFromBackup: true, copyOnRead: true};
-            $scope.backupItem.space = $scope.spaces[0]._id;
-        };
-
-        // Check cache logical consistency.
-        function validate(item) {
-            var cacheStoreFactorySelected = item.cacheStoreFactory && item.cacheStoreFactory.kind;
-
-            if (cacheStoreFactorySelected && !(item.readThrough || item.writeThrough)) {
-                $common.showError('Store is configured but read/write through are not enabled!');
-
-                return false;
-            }
-
-            if ((item.readThrough || item.writeThrough) && !cacheStoreFactorySelected) {
-                $common.showError('Read / write through are enabled but store is not configured!');
-
-                return false;
-            }
-
-            if (item.writeBehindEnabled && !cacheStoreFactorySelected) {
-                $common.showError('Write behind enabled but store is not configured!');
-
-                return false;
-            }
-
-            return true;
-        }
-
-        // Save cache into database.
-        function save(item) {
-            $http.post('caches/save', item)
-                .success(function (_id) {
-                    var idx = _.findIndex($scope.caches, function (cache) {
-                        return cache._id == _id;
-                    });
-
-                    if (idx >= 0)
-                        angular.extend($scope.caches[idx], item);
-                    else {
-                        item._id = _id;
-
-                        $scope.caches.push(item);
-                    }
-
-                    $scope.selectItem(item);
-
-                    $common.showInfo('Cache "' + item.name + '" saved.');
-                })
-                .error(function (errMsg) {
-                    $common.showError(errMsg);
-                });
-        }
-
-        // Save cache.
-        $scope.saveItem = function () {
-            $table.tableReset();
-
-            var item = $scope.backupItem;
-
-            if (validate(item))
-                save(item);
-        };
-
-        // Save cache with new name.
-        $scope.saveItemAs = function () {
-            $table.tableReset();
-
-            if (validate($scope.backupItem))
-                $copy.show($scope.backupItem.name).then(function (newName) {
-                    var item = angular.copy($scope.backupItem);
-
-                    item._id = undefined;
-                    item.name = newName;
-
-                    save(item);
-                });
-        };
-
-        // Remove cache from db.
-        $scope.removeItem = function () {
-            $table.tableReset();
-
-            var selectedItem = $scope.selectedItem;
-
-            $confirm.show('Are you sure you want to remove cache: "' + selectedItem.name + '"?').then(
-                function () {
-                    var _id = selectedItem._id;
-
-                    $http.post('caches/remove', {_id: _id})
-                        .success(function () {
-                            $common.showInfo('Cache has been removed: ' + selectedItem.name);
-
-                            var caches = $scope.caches;
-
-                            var idx = _.findIndex(caches, function (cache) {
-                                return cache._id == _id;
-                            });
-
-                            if (idx >= 0) {
-                                caches.splice(idx, 1);
-
-                                if (caches.length > 0)
-                                    $scope.selectItem(caches[0]);
-                                else {
-                                    $scope.selectedItem = undefined;
-                                    $scope.backupItem = undefined;
-                                }
-                            }
-                        })
-                        .error(function (errMsg) {
-                            $common.showError(errMsg);
-                        });
-                }
-            );
-        };
-    }]
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/clusters-controller.js b/modules/web-control-center/nodejs/controllers/clusters-controller.js
deleted file mode 100644
index 1ec78a1..0000000
--- a/modules/web-control-center/nodejs/controllers/clusters-controller.js
+++ /dev/null
@@ -1,309 +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.
- */
-
-controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$confirm', '$copy', '$table', function ($scope, $http, $common, $confirm, $copy, $table) {
-        $scope.joinTip = $common.joinTip;
-        $scope.getModel = $common.getModel;
-
-        $scope.tableNewItem = $table.tableNewItem;
-        $scope.tableNewItemActive = $table.tableNewItemActive;
-        $scope.tableEditing = $table.tableEditing;
-        $scope.tableStartEdit = $table.tableStartEdit;
-        $scope.tableRemove = $table.tableRemove;
-
-        $scope.tableSimpleSave = $table.tableSimpleSave;
-        $scope.tableSimpleSaveVisible = $table.tableSimpleSaveVisible;
-        $scope.tableSimpleUp = $table.tableSimpleUp;
-        $scope.tableSimpleDown = $table.tableSimpleDown;
-        $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible;
-
-        $scope.templates = [
-            {
-                value: {discovery: {kind: 'Multicast', Vm: {addresses: ['127.0.0.1:47500..47510']}, Multicast: {}}},
-                label: 'multicast'
-            },
-            {value: {discovery: {kind: 'Vm', Vm: {addresses: ['127.0.0.1:47500..47510']}}}, label: 'local'}
-        ];
-
-        $scope.discoveries = [
-            {value: 'Vm', label: 'static IPs'},
-            {value: 'Multicast', label: 'multicast'},
-            {value: 'S3', label: 'AWS S3'},
-            {value: 'Cloud', label: 'apache jclouds'},
-            {value: 'GoogleStorage', label: 'google cloud storage'},
-            {value: 'Jdbc', label: 'JDBC'},
-            {value: 'SharedFs', label: 'shared filesystem'}
-        ];
-
-        $scope.swapSpaceSpis = [
-            {value: 'FileSwapSpaceSpi', label: 'File-based swap'},
-            {value: undefined, label: 'Not set'}
-        ];
-
-        $scope.events = [];
-
-        for (var eventGroupName in eventGroups) {
-            if (eventGroups.hasOwnProperty(eventGroupName)) {
-                $scope.events.push({value: eventGroupName, label: eventGroupName});
-            }
-        }
-
-        $scope.cacheModes = [
-            {value: 'LOCAL', label: 'LOCAL'},
-            {value: 'REPLICATED', label: 'REPLICATED'},
-            {value: 'PARTITIONED', label: 'PARTITIONED'}
-        ];
-
-        $scope.deploymentModes = [
-            {value: 'PRIVATE', label: 'PRIVATE'},
-            {value: 'ISOLATED', label: 'ISOLATED'},
-            {value: 'SHARED', label: 'SHARED'},
-            {value: 'CONTINUOUS', label: 'CONTINUOUS'}
-        ];
-
-        $scope.transactionConcurrency = [
-            {value: 'OPTIMISTIC', label: 'OPTIMISTIC'},
-            {value: 'PESSIMISTIC', label: 'PESSIMISTIC'}
-        ];
-
-        $scope.transactionIsolation = [
-            {value: 'READ_COMMITTED', label: 'READ_COMMITTED'},
-            {value: 'REPEATABLE_READ', label: 'REPEATABLE_READ'},
-            {value: 'SERIALIZABLE', label: 'SERIALIZABLE'}
-        ];
-
-        $scope.segmentationPolicy = [
-            {value: 'RESTART_JVM', label: 'RESTART_JVM'},
-            {value: 'STOP', label: 'STOP'},
-            {value: 'NOOP', label: 'NOOP'}
-        ];
-
-        $scope.marshallers = [
-            {value: 'OptimizedMarshaller', label: 'OptimizedMarshaller'},
-            {value: 'JdkMarshaller', label: 'JdkMarshaller'}
-        ];
-
-        $scope.tableSimpleValid = function (item, field, val, index) {
-            var model = $common.getModel(item, field)[field.model];
-
-            if ($common.isDefined(model)) {
-                var idx = _.indexOf(model, val);
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    var msg = 'Such IP address already exists!';
-
-                    if (field.model == 'regions')
-                        msg = 'Such region already exists!';
-                    if (field.model == 'zones')
-                        msg = 'Such zone already exists!';
-
-                    $common.showError(msg);
-
-                    return false;
-                }
-            }
-
-            return true;
-        };
-
-        $scope.clusters = [];
-
-        $http.get('/models/clusters.json')
-            .success(function (data) {
-                $scope.screenTip = data.screenTip;
-                $scope.templateTip = data.templateTip;
-
-                $scope.general = data.general;
-                $scope.advanced = data.advanced;
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        // When landing on the page, get clusters and show them.
-        $http.post('clusters/list')
-            .success(function (data) {
-                $scope.caches = data.caches;
-                $scope.spaces = data.spaces;
-                $scope.clusters = data.clusters;
-
-                var restoredItem = angular.fromJson(sessionStorage.clusterBackupItem);
-
-                if (restoredItem) {
-                    if (restoredItem._id) {
-                        var idx = _.findIndex($scope.clusters, function (cluster) {
-                            return cluster._id == restoredItem._id;
-                        });
-
-                        if (idx >= 0) {
-                            $scope.selectedItem = $scope.clusters[idx];
-                            $scope.backupItem = restoredItem;
-                        }
-                        else
-                            sessionStorage.removeItem('clusterBackupItem');
-                    }
-                    else
-                        $scope.backupItem = restoredItem;
-                }
-                else if ($scope.clusters.length > 0)
-                    $scope.selectItem($scope.clusters[0]);
-
-                $scope.$watch('backupItem', function (val) {
-                    if (val)
-                        sessionStorage.clusterBackupItem = angular.toJson(val);
-                }, true);
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        $scope.selectItem = function (item) {
-            $table.tableReset();
-
-            $scope.selectedItem = item;
-            $scope.backupItem = angular.copy(item);
-        };
-
-        // Add new cluster.
-        $scope.createItem = function () {
-            $table.tableReset();
-
-            $scope.backupItem = angular.copy($scope.create.template);
-            $scope.backupItem.space = $scope.spaces[0]._id;
-        };
-
-        $scope.indexOfCache = function (cacheId) {
-            return _.findIndex($scope.caches, function (cache) {
-                return cache.value == cacheId;
-            });
-        };
-
-        // Check cluster logical consistency.
-        function validate(item) {
-            if (!item.swapSpaceSpi || !item.swapSpaceSpi.kind && item.caches) {
-                for (var i = 0; i < item.caches.length; i++) {
-                    var idx = $scope.indexOfCache(item.caches[i]);
-
-                    if (idx >= 0) {
-                        var cache = $scope.caches[idx];
-
-                        if (cache.swapEnabled) {
-                            $common.showError('Swap space SPI is not configured, but cache "' + cache.label + '" configured to use swap!');
-
-                            return false;
-                        }
-                    }
-                }
-            }
-
-            return true;
-        }
-
-        // Save cluster in database.
-        function save(item) {
-            $http.post('clusters/save', item)
-                .success(function (_id) {
-                    var idx = _.findIndex($scope.clusters, function (cluster) {
-                        return cluster._id == _id;
-                    });
-
-                    if (idx >= 0)
-                        angular.extend($scope.clusters[idx], item);
-                    else {
-                        item._id = _id;
-
-                        $scope.clusters.push(item);
-                    }
-
-                    $scope.selectItem(item);
-
-                    $common.showInfo('Cluster "' + item.name + '" saved.');
-                })
-                .error(function (errMsg) {
-                    $common.showError(errMsg);
-                });
-        }
-
-        // Save cluster.
-        $scope.saveItem = function () {
-            $table.tableReset();
-
-            var item = $scope.backupItem;
-
-            if (validate(item))
-                save(item);
-        };
-
-        // Save cluster with new name.
-        $scope.saveItemAs = function () {
-            $table.tableReset();
-
-            if (validate($scope.backupItem))
-                $copy.show($scope.backupItem.name).then(function (newName) {
-                    var item = angular.copy($scope.backupItem);
-
-                    item._id = undefined;
-                    item.name = newName;
-
-                    save(item);
-                });
-        };
-
-        // Remove cluster from db.
-        $scope.removeItem = function () {
-            $table.tableReset();
-
-            var selectedItem = $scope.selectedItem;
-
-            $confirm.show('Are you sure you want to remove cluster: "' + selectedItem.name + '"?').then(
-                function () {
-                    var _id = selectedItem._id;
-
-                    $http.post('clusters/remove', {_id: _id})
-                        .success(function () {
-                            $common.showInfo('Cluster has been removed: ' + selectedItem.name);
-
-                            var clusters = $scope.clusters;
-
-                            var idx = _.findIndex(clusters, function (cluster) {
-                                return cluster._id == _id;
-                            });
-
-                            if (idx >= 0) {
-                                clusters.splice(idx, 1);
-
-                                if (clusters.length > 0)
-                                    $scope.selectItem(clusters[0]);
-                                else {
-                                    $scope.selectedItem = undefined;
-                                    $scope.backupItem = undefined;
-                                }
-                            }
-                        })
-                        .error(function (errMsg) {
-                            $common.showError(errMsg);
-                        });
-                }
-            );
-        };
-    }]
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/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
deleted file mode 100644
index 75af155..0000000
--- a/modules/web-control-center/nodejs/controllers/common-module.js
+++ /dev/null
@@ -1,422 +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.
- */
-
-var controlCenterModule = angular.module('ignite-web-control-center', ['smart-table', 'mgcrea.ngStrap', 'ui.ace', 'ngSanitize']);
-
-// Modal popup configuration.
-controlCenterModule.config(function ($modalProvider) {
-    angular.extend($modalProvider.defaults, {
-        html: true
-    });
-});
-
-// Tooltips configuration.
-controlCenterModule.config(function ($tooltipProvider) {
-    angular.extend($tooltipProvider.defaults, {
-        container: 'body',
-        placement: 'right',
-        html: 'true',
-        trigger: 'click hover'
-    });
-});
-
-// Comboboxes configuration.
-controlCenterModule.config(function ($selectProvider) {
-    angular.extend($selectProvider.defaults, {
-        maxLength: '1',
-        allText: 'Select All',
-        noneText: 'Clear All',
-        templateUrl: '/select',
-        iconCheckmark: 'fa fa-check',
-        caretHtml: '<span class="caret"></span>'
-    });
-});
-
-// Alerts configuration.
-controlCenterModule.config(function ($alertProvider) {
-    angular.extend($alertProvider.defaults, {
-        container: 'body',
-        placement: 'top-right',
-        duration: '5',
-        type: 'danger'
-    });
-});
-
-// Common functions to be used in controllers.
-controlCenterModule.service('$common', ['$alert', function ($alert) {
-    var msgModal = undefined;
-
-    function errorMessage(errMsg) {
-        return errMsg ? errMsg : 'Internal server error.';
-    }
-
-    function isDefined(v) {
-        return !(v === undefined || v === null);
-    }
-
-    return {
-        getModel: function (obj, field) {
-            var path = field.path;
-
-            if (!isDefined(path))
-                return obj;
-
-            path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
-            path = path.replace(/^\./, '');           // strip a leading dot
-
-            var segs = path.split('.');
-            var root = obj;
-
-            while (segs.length > 0) {
-                var pathStep = segs.shift();
-
-                if (typeof root[pathStep] === 'undefined')
-                    root[pathStep] = {};
-
-                root = root[pathStep];
-            }
-
-            return root;
-        },
-        joinTip: function (arr) {
-            if (!arr) {
-                return arr;
-            }
-
-            var lines = arr.map(function (line) {
-                var rtrimmed = line.replace(/\s+$/g, '');
-
-                if (rtrimmed.indexOf('>', this.length - 1) == -1) {
-                    rtrimmed = rtrimmed + '<br/>';
-                }
-
-                return rtrimmed;
-            });
-
-            return lines.join("");
-        },
-        isDefined: isDefined,
-        isNonEmpty: function (s) {
-            return isDefined(s) && s.trim().length > 0;
-        },
-        errorMessage: errorMessage,
-        showError: function (msg) {
-            if (msgModal)
-                msgModal.hide();
-
-            msgModal = $alert({title: errorMessage(msg)});
-        },
-        showInfo: function (msg) {
-            if (msgModal)
-                msgModal.hide();
-
-            msgModal = $alert({
-                type: 'success',
-                title: msg,
-                duration: 2
-            });
-        }
-    }
-}]);
-
-// Confirm popup service.
-controlCenterModule.service('$confirm', function ($modal, $rootScope, $q) {
-    var scope = $rootScope.$new();
-
-    var deferred;
-
-    scope.ok = function () {
-        deferred.resolve();
-
-        confirmModal.hide();
-    };
-
-    var confirmModal = $modal({templateUrl: '/confirm', scope: scope, placement: 'center', show: false});
-
-    var parentShow = confirmModal.show;
-
-    confirmModal.show = function (content) {
-        scope.content = content || 'Confirm deletion?';
-
-        deferred = $q.defer();
-
-        parentShow();
-
-        return deferred.promise;
-    };
-
-    return confirmModal;
-});
-
-// "Save as" popup service.
-controlCenterModule.service('$copy', function ($modal, $rootScope, $q) {
-    var scope = $rootScope.$new();
-
-    var deferred;
-
-    scope.ok = function (newName) {
-        deferred.resolve(newName);
-
-        copyModal.hide();
-    };
-
-    var copyModal = $modal({templateUrl: '/copy', scope: scope, placement: 'center', show: false});
-
-    var parentShow = copyModal.show;
-
-    copyModal.show = function (oldName) {
-        scope.newName = oldName + '(1)';
-
-        deferred = $q.defer();
-
-        parentShow();
-
-        return deferred.promise;
-    };
-
-    return copyModal;
-});
-
-// Tables support service.
-controlCenterModule.service('$table', ['$common', function ($common) {
-    function _swapSimpleItems(a, ix1, ix2) {
-        var tmp = a[ix1];
-
-        a[ix1] = a[ix2];
-        a[ix2] = tmp;
-    }
-
-    function _model(item, field) {
-        return $common.getModel(item, field);
-    }
-
-    var table = {name: 'none', editIndex: -1};
-
-    function _tableReset() {
-        table.name = 'none';
-        table.editIndex = -1;
-    }
-
-    function _tableState(name, editIndex) {
-        table.name = name;
-        table.editIndex = editIndex;
-    }
-
-    return {
-        tableState: function (name, editIndex) {
-            _tableState(name, editIndex);
-        },
-        tableReset: function () {
-            _tableReset();
-        },
-        tableNewItem: function (field) {
-            _tableState(field.model, -1);
-        },
-        tableNewItemActive: function (field) {
-            return table.name == field.model && table.editIndex < 0;
-        },
-        tableEditing: function (field, index) {
-            return table.name == field.model && table.editIndex == index;
-        },
-        tableStartEdit: function (item, field, index) {
-            _tableState(field.model, index);
-
-            return _model(item, field)[field.model][index];
-        },
-        tableRemove: function (item, field, index) {
-            _tableReset();
-
-            _model(item, field)[field.model].splice(index, 1);
-        },
-        tableSimpleSave: function (valueValid, item, field, newValue, index) {
-            if (valueValid(item, field, newValue, index)) {
-                _tableReset();
-
-                if (index < 0) {
-                    if (_model(item, field)[field.model])
-                        _model(item, field)[field.model].push(newValue);
-                    else
-                        _model(item, field)[field.model] = [newValue];
-                }
-                else
-                    _model(item, field)[field.model][index] = newValue;
-            }
-        },
-        tableSimpleSaveVisible: function (newValue) {
-            return $common.isNonEmpty(newValue);
-        },
-        tableSimpleUp: function (item, field, index) {
-            _tableReset();
-
-            _swapSimpleItems(_model(item, field)[field.model], index, index - 1);
-        },
-        tableSimpleDown: function (item, field, index) {
-            _tableReset();
-
-            _swapSimpleItems(_model(item, field)[field.model], index, index + 1);
-        },
-        tableSimpleDownVisible: function (item, field, index) {
-            return index < _model(item, field)[field.model].length - 1;
-        },
-        tablePairSave: function (pairValid, item, field, newKey, newValue, index) {
-            if (pairValid(item, field, newKey, newValue, index)) {
-                _tableReset();
-
-                var pair = {};
-
-                if (index < 0) {
-                    pair[field.keyName] = newKey;
-                    pair[field.valueName] = newValue;
-
-                    if (item[field.model])
-                        item[field.model].push(pair);
-                    else
-                        item[field.model] = [pair];
-                }
-                else {
-                    pair = item[field.model][index];
-
-                    pair[field.keyName] = newKey;
-                    pair[field.valueName] = newValue;
-                }
-            }
-        },
-        tablePairSaveVisible: function (newKey, newValue) {
-            return $common.isNonEmpty(newKey) && $common.isNonEmpty(newValue);
-        }
-    }
-}]);
-
-
-// Filter to decode name using map(value, label).
-controlCenterModule.filter('displayValue', function () {
-    return function (v, m, dflt) {
-        var i = _.findIndex(m, function (item) {
-            return item.value == v;
-        });
-
-        if (i >= 0) {
-            return m[i].label;
-        }
-
-        if (dflt) {
-            return dflt;
-        }
-
-        return 'Unknown value';
-    }
-});
-
-/**
- * Filter for replacing all occurrences of {@code org.apache.ignite.} with {@code o.a.i.},
- * {@code org.apache.ignite.internal.} with {@code o.a.i.i.},
- * {@code org.apache.ignite.internal.visor.} with {@code o.a.i.i.v.} and
- * {@code org.apache.ignite.scalar.} with {@code o.a.i.s.}.
- *
- * @param s String to replace in.
- * @return Replaces string.
- */
-controlCenterModule.filter('compact', function () {
-    return function (s) {
-        return s.replace("org.apache.ignite.internal.visor.", "o.a.i.i.v.").
-            replace("org.apache.ignite.internal.", "o.a.i.i.").
-            replace("org.apache.ignite.scalar.", "o.a.i.s.").
-            replace("org.apache.ignite.", "o.a.i.");
-    }
-});
-
-// Directive to enable validation for IP addresses.
-controlCenterModule.directive('ipaddress', function () {
-    const ip = '(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])';
-    const port = '([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])';
-    const portRange = '(:' + port + '(..' + port + ')?)?';
-    const host = '(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])';
-
-    return {
-        require: 'ngModel',
-        link: function (scope, elem, attrs, ctrl) {
-            ctrl.$validators.ipaddress = function (modelValue, viewValue) {
-                if (ctrl.$isEmpty(modelValue) || !attrs['ipaddress'])
-                    return true;
-
-                return viewValue.match(new RegExp('(^' + ip + portRange + '$)|(^' + host + portRange + '$)')) != null;
-            }
-        }
-    }
-});
-
-// Directive to enable validation to match specified value.
-controlCenterModule.directive('match', function ($parse) {
-    return {
-        require: 'ngModel',
-        link: function (scope, elem, attrs, ctrl) {
-            scope.$watch(function () {
-                return $parse(attrs.match)(scope) === ctrl.$modelValue;
-            }, function (currentValue) {
-                ctrl.$setValidity('mismatch', currentValue);
-            });
-        }
-    };
-});
-
-// Navigation bar controller.
-controlCenterModule.controller('activeLink', [
-    '$scope', function ($scope) {
-        $scope.isActive = function (path) {
-            return window.location.pathname.substr(0, path.length) == path;
-        };
-    }]);
-
-// Login popup controller.
-controlCenterModule.controller('auth', [
-    '$scope', '$modal', '$alert', '$http', '$window', '$common',
-    function ($scope, $modal, $alert, $http, $window, $common) {
-        $scope.errorMessage = $common.errorMessage;
-
-        $scope.action = 'login';
-
-        $scope.valid = false;
-
-        $scope.userDropdown = [{"text": "Profile", "href": "/profile"}];
-
-        if (!$scope.becomeUsed) {
-            if ($scope.user && $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, templateUrl: '/login', show: false});
-
-        $scope.login = function () {
-            // Show when some event occurs (use $promise property to ensure the template has been loaded)
-            authModal.$promise.then(authModal.show);
-        };
-
-        $scope.auth = function (action, user_info) {
-            $http.post('/' + action, user_info)
-                .success(function () {
-                    authModal.hide();
-
-                    $window.location = '/configuration/clusters';
-                })
-                .error(function (data) {
-                    $alert({placement: 'top', container: '#errors-container', title: $scope.errorMessage(data)});
-                });
-        };
-    }]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a335724/modules/web-control-center/nodejs/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/controllers/metadata-controller.js b/modules/web-control-center/nodejs/controllers/metadata-controller.js
deleted file mode 100644
index b62cde5..0000000
--- a/modules/web-control-center/nodejs/controllers/metadata-controller.js
+++ /dev/null
@@ -1,678 +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.
- */
-
-controlCenterModule.controller('metadataController', ['$scope', '$http', '$common', '$confirm', '$copy', '$table', function ($scope, $http, $common, $confirm, $copy, $table) {
-        $scope.joinTip = $common.joinTip;
-        $scope.getModel = $common.getModel;
-
-        $scope.tableNewItem = $table.tableNewItem;
-        $scope.tableNewItemActive = $table.tableNewItemActive;
-        $scope.tableEditing = $table.tableEditing;
-        $scope.tableStartEdit = $table.tableStartEdit;
-        $scope.tableRemove = $table.tableRemove;
-
-        $scope.tableSimpleSave = $table.tableSimpleSave;
-        $scope.tableSimpleSaveVisible = $table.tableSimpleSaveVisible;
-        $scope.tableSimpleUp = $table.tableSimpleUp;
-        $scope.tableSimpleDown = $table.tableSimpleDown;
-        $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible;
-
-        $scope.tablePairSave = $table.tablePairSave;
-        $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
-
-        $scope.templates = [
-            {value: {kind: 'query'}, label: 'query'},
-            {value: {kind: 'store'}, label: 'store'},
-            {value: {kind: 'both'}, label: 'both'}
-        ];
-
-        $scope.template = $scope.templates[0].value;
-
-        $scope.kinds = [
-            {value: 'query', label: 'query'},
-            {value: 'store', label: 'store'},
-            {value: 'both', label: 'both'}
-        ];
-
-        $scope.databases = [
-            {value: 'oracle', label: 'Oracle database'},
-            {value: 'db2', label: 'IBM DB2'},
-            {value: 'mssql', label: 'MS SQL Server'},
-            {value: 'postgre', label: 'PostgreSQL'},
-            {value: 'mysql', label: 'MySQL'},
-            {value: 'h2', label: 'H2 database'}
-        ];
-
-        $scope.jdbcTypes = [
-            {value: 'BIT', label: 'BIT'},
-            {value: 'BOOLEAN', label: 'BOOLEAN'},
-            {value: 'TINYINT', label: 'TINYINT'},
-            {value: 'SMALLINT', label: 'SMALLINT'},
-            {value: 'INTEGER', label: 'INTEGER'},
-            {value: 'BIGINT', label: 'BIGINT'},
-            {value: 'REAL', label: 'REAL'},
-            {value: 'FLOAT', label: 'FLOAT'},
-            {value: 'DOUBLE', label: 'DOUBLE'},
-            {value: 'NUMERIC', label: 'NUMERIC'},
-            {value: 'DECIMAL', label: 'DECIMAL'},
-            {value: 'CHAR', label: 'CHAR'},
-            {value: 'VARCHAR', label: 'VARCHAR'},
-            {value: 'LONGVARCHAR', label: 'LONGVARCHAR'},
-            {value: 'NCHAR', label: 'NCHAR'},
-            {value: 'NVARCHAR', label: 'NVARCHAR'},
-            {value: 'LONGNVARCHAR', label: 'LONGNVARCHAR'},
-            {value: 'DATE', label: 'DATE'},
-            {value: 'TIME', label: 'TIME'},
-            {value: 'TIMESTAMP', label: 'TIMESTAMP'}
-        ];
-
-        $scope.javaTypes = [
-            {value: 'boolean', label: 'boolean'},
-            {value: 'Boolean', label: 'Boolean'},
-            {value: 'byte', label: 'byte'},
-            {value: 'Byte', label: 'Byte'},
-            {value: 'short', label: 'short'},
-            {value: 'Short', label: 'Short'},
-            {value: 'int', label: 'int'},
-            {value: 'Integer', label: 'Integer'},
-            {value: 'long', label: 'long'},
-            {value: 'Long', label: 'Long'},
-            {value: 'float', label: 'float'},
-            {value: 'Float', label: 'Float'},
-            {value: 'double', label: 'double'},
-            {value: 'Double', label: 'Double'},
-            {value: 'BigDecimal', label: 'BigDecimal'},
-            {value: 'String', label: 'String'},
-            {value: 'Date', label: 'Date'},
-            {value: 'Time', label: 'Time'},
-            {value: 'Timestamp', label: 'Timestamp'}
-        ];
-
-        $scope.sortDirections = [
-            {value: 'ASC', label: 'ASC'},
-            {value: 'DESC', label: 'DESC'}
-        ];
-
-        $scope.data = {
-            curTableIdx: 0,
-            curFieldIdx: 0,
-            curKeyClass: '',
-            curValueClass: '',
-            curJavaName: '',
-            curJavaType: '',
-            tables: [
-                {schemaName: 'Schema1', use: true},
-                {
-                    schemaName: 'Schema1',
-                    use: true,
-                    tableName: 'Table1',
-                    keyClass: 'KeyClass1',
-                    valueClass: 'ValueClass1',
-                    fields: [
-                        {
-                            use: true,
-                            key: true,
-                            ak: true,
-                            dbName: 'name1',
-                            dbType: 'dbType1',
-                            javaName: 'javaName1',
-                            javaType: 'javaType1'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            dbName: 'name2',
-                            dbType: 'dbType2',
-                            javaName: 'javaName2',
-                            javaType: 'javaType2'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name3',
-                            dbType: 'dbType3',
-                            javaName: 'javaName3',
-                            javaType: 'javaType3'
-                        }
-                    ]
-                },
-                {schemaName: 'Schema2 with very long name', use: false},
-                {
-                    schemaName: 'Schema2',
-                    use: false,
-                    tableName: 'Table2',
-                    keyClass: 'KeyClass2',
-                    valueClass: 'ValueClass2',
-                    fields: [
-                        {
-                            use: true,
-                            key: true,
-                            ak: true,
-                            dbName: 'name4',
-                            dbType: 'dbType4',
-                            javaName: 'javaName4',
-                            javaType: 'javaType4'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            dbName: 'name5',
-                            dbType: 'dbType5',
-                            javaName: 'javaName5',
-                            javaType: 'javaType5'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name6',
-                            dbType: 'dbType6',
-                            javaName: 'javaName6',
-                            javaType: 'javaType6'
-                        }
-                    ]
-                },
-                {
-                    schemaName: 'Schema2',
-                    use: false,
-                    tableName: 'Table3',
-                    keyClass: 'KeyClass3',
-                    valueClass: 'ValueClass3',
-                    fields: [
-                        {
-                            use: true,
-                            key: true,
-                            ak: true,
-                            dbName: 'name7',
-                            dbType: 'dbType7',
-                            javaName: 'javaName7',
-                            javaType: 'javaType7'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            dbName: 'name8',
-                            dbType: 'dbType8',
-                            javaName: 'javaName8',
-                            javaType: 'javaType8'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name9',
-                            dbType: 'dbType9',
-                            javaName: 'javaName9',
-                            javaType: 'javaType9'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name10',
-                            dbType: 'dbType10',
-                            javaName: 'javaName10',
-                            javaType: 'javaType10'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name11',
-                            dbType: 'dbType11',
-                            javaName: 'javaName11',
-                            javaType: 'javaType11'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            dbName: 'name12',
-                            dbType: 'dbType12',
-                            javaName: 'javaName12',
-                            javaType: 'javaType12'
-                        }
-                    ]
-                }]
-        };
-
-        $scope.metadatas = [];
-
-        $http.get('/models/metadata.json')
-            .success(function (data) {
-                $scope.screenTip = data.screenTip;
-                $scope.templateTip = data.templateTip;
-                $scope.metadataManual = data.metadataManual;
-                $scope.metadataDb = data.metadataDb;
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        // When landing on the page, get metadatas and show them.
-        $http.post('metadata/list')
-            .success(function (data) {
-                $scope.spaces = data.spaces;
-                $scope.metadatas = data.metadatas;
-
-                var restoredItem = angular.fromJson(sessionStorage.metadataBackupItem);
-
-                if (restoredItem && restoredItem._id) {
-                    var idx = _.findIndex($scope.metadatas, function (metadata) {
-                        return metadata._id == restoredItem._id;
-                    });
-
-                    if (idx >= 0) {
-                        $scope.selectedItem = $scope.metadatas[idx];
-
-                        $scope.backupItem = restoredItem;
-                    }
-                    else
-                        sessionStorage.removeItem('metadataBackupItem');
-                }
-                else
-                    $scope.backupItem = restoredItem;
-
-                $scope.$watch('backupItem', function (val) {
-                    if (val)
-                        sessionStorage.metadataBackupItem = angular.toJson(val);
-                }, true);
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        $scope.selectItem = function (item) {
-            $table.tableReset();
-
-            $scope.selectedItem = item;
-            $scope.backupItem = angular.copy(item);
-        };
-
-        // Add new metadata.
-        $scope.createItem = function () {
-            $table.tableReset();
-
-            $scope.backupItem = angular.copy($scope.template);
-            $scope.backupItem.space = $scope.spaces[0]._id;
-        };
-
-        // Check cache type metadata logical consistency.
-        function validate(item) {
-            return true;
-        }
-
-        // Save cache type metadata into database.
-        function save(item) {
-            $http.post('metadata/save', item)
-                .success(function (_id) {
-                    $common.showInfo('Metadata "' + item.name + '" saved.');
-
-                    var idx = _.findIndex($scope.metadatas, function (metadata) {
-                        return metadata._id == _id;
-                    });
-
-                    if (idx >= 0)
-                        angular.extend($scope.metadatas[idx], item);
-                    else {
-                        item._id = _id;
-
-                        $scope.metadatas.push(item);
-                    }
-
-                    $scope.selectItem(item);
-
-                    $common.showInfo('Cache type metadata"' + item.name + '" saved.');
-                })
-                .error(function (errMsg) {
-                    $common.showError(errMsg);
-                });
-        }
-
-        // Save cache type metadata.
-        $scope.saveItem = function () {
-            $table.tableReset();
-
-            var item = $scope.backupItem;
-
-            if (validate(item))
-                save(item);
-        };
-
-        // Save cache type metadata with new name.
-        $scope.saveItemAs = function () {
-            $table.tableReset();
-
-            if (validate($scope.backupItem))
-                $copy.show($scope.backupItem.name).then(function (newName) {
-                    var item = angular.copy($scope.backupItem);
-
-                    item._id = undefined;
-                    item.name = newName;
-
-                    save(item);
-                });
-        };
-
-        $scope.removeItem = function () {
-            $table.tableReset();
-
-            var selectedItem = $scope.selectedItem;
-
-            $confirm.show('Are you sure you want to remove cache type metadata: "' + selectedItem.name + '"?').then(
-                function () {
-                    var _id = selectedItem._id;
-
-                    $http.post('metadata/remove', {_id: _id})
-                        .success(function () {
-                            $common.showInfo('Cache type metadata has been removed: ' + selectedItem.name);
-
-                            var metadatas = $scope.metadatas;
-
-                            var idx = _.findIndex(metadatas, function (metadata) {
-                                return metadata._id == _id;
-                            });
-
-                            if (idx >= 0) {
-                                metadatas.splice(idx, 1);
-
-                                if (metadatas.length > 0)
-                                    $scope.selectItem(metadatas[0]);
-                                else {
-                                    $scope.selectedItem = undefined;
-                                    $scope.backupItem = undefined;
-                                }
-                            }
-                        })
-                        .error(function (errMsg) {
-                            $common.showError(errMsg);
-                        });
-                });
-        };
-
-        $scope.tableSimpleValid = function (item, field, name, index) {
-            var model = item[field.model];
-
-            if ($common.isDefined(model)) {
-                var idx = _.indexOf(model, name);
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('Field with such name already exists!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        };
-
-        $scope.tablePairValid = function (item, field, name, clsName, index) {
-            var model = item[field.model];
-
-            if ($common.isDefined(model)) {
-                var idx = _.findIndex(model, function (pair) {
-                    return pair.name == name
-                });
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('Field with such name already exists!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        };
-
-        $scope.tableDbFieldSaveVisible = function (dbName, dbType, javaName, javaType) {
-            return $common.isNonEmpty(dbName) && $common.isDefined(dbType) &&
-                $common.isNonEmpty(javaName) && $common.isDefined(javaType);
-        };
-
-        $scope.tableDbFieldSave = function (field, newDbName, newDbType, newJavaName, newJavaType, index) {
-            var item = $scope.backupItem;
-
-            var model = item[field.model];
-
-            var newItem = {dbName: newDbName, dbType: newDbType, javaName: newJavaName, javaType: newJavaType};
-
-            if ($common.isDefined(model)) {
-                var idx = _.findIndex(model, function (dbMeta) {
-                    return dbMeta.dbName == newDbName
-                });
-
-                // Found duplicate.
-                if (idx >= 0 && index != idx) {
-                    $common.showError('DB field with such name already exists!');
-
-                    return;
-                }
-
-                if (index < 0) {
-                    if (model)
-                        model.push(newItem);
-                    else
-                        item[field.model] = [newItem];
-                }
-                else {
-                    var dbField = model[index];
-
-                    dbField.dbName = newDbName;
-                    dbField.dbType = newDbType;
-                    dbField.javaName = newJavaName;
-                    dbField.javaType = newJavaType;
-                }
-            }
-            else
-                item[field.model] = [newItem];
-
-            $table.tableReset();
-        };
-
-        $scope.tableGroupSaveVisible = function (group) {
-            return $common.isNonEmpty(group);
-        };
-
-        function tableGroupValid(groupName, index) {
-            var groups = $scope.backupItem.groups;
-
-            if ($common.isDefined(groups)) {
-                var idx = _.findIndex(groups, function (group) {
-                    return group.name == groupName;
-                });
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('Group with such name already exists!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        $scope.tableGroupSave = function (groupName, index) {
-            if (tableGroupValid(groupName, index)) {
-                $table.tableReset();
-
-                var item = $scope.backupItem;
-
-                if (index < 0) {
-                    var newGroup = {name: groupName};
-
-                    if (item.groups)
-                        item.groups.push(newGroup);
-                    else
-                        item.groups = [newGroup];
-                }
-                else
-                    item.groups[index].name = groupName;
-            }
-        };
-
-        $scope.tableGroupNewItem = function (groupIndex) {
-            var groupName = $scope.backupItem.groups[groupIndex].name;
-
-            return $table.tableNewItem({model: groupName});
-        };
-
-        $scope.tableGroupNewItemActive = function (groupIndex) {
-            var groupName = $scope.backupItem.groups[groupIndex].name;
-
-            return $table.tableNewItemActive({model: groupName});
-        };
-
-        $scope.tableGroupItemEditing = function (groupIndex, index) {
-            var groups = $scope.backupItem.groups;
-
-            if (groups)
-                return $table.tableEditing({model: groups[groupIndex].name}, index);
-
-            return false;
-        };
-
-        $scope.tableGroupItemStartEdit = function (groupIndex, index) {
-            var groups = $scope.backupItem.groups;
-
-            $table.tableState(groups[groupIndex].name, index);
-
-            return groups[groupIndex].fields[index];
-        };
-
-        $scope.tableGroupItemSaveVisible = function (fieldName, className) {
-            return $common.isNonEmpty(fieldName) && $common.isNonEmpty(className);
-        };
-
-        function tableGroupItemValid(fieldName, groupIndex, index) {
-            var groupItems = $scope.backupItem.groups[groupIndex].fields;
-
-            if ($common.isDefined(groupItems)) {
-                var idx = _.findIndex(groupItems, function (groupItem) {
-                    return groupItem.name == fieldName;
-                });
-
-                // Found itself.
-                if (index >= 0 && index == idx)
-                    return true;
-
-                // Found duplicate.
-                if (idx >= 0) {
-                    $common.showError('Field with such name already exists in group!');
-
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        $scope.tableGroupItemSave = function (fieldName, className, direction, groupIndex, index) {
-            if (tableGroupItemValid(fieldName, groupIndex, index)) {
-                $table.tableReset();
-
-                var group = $scope.backupItem.groups[groupIndex];
-
-                if (index < 0) {
-                    var newGroupItem = {name: fieldName, className: className, direction: direction};
-
-                    if (group.fields)
-                        group.fields.push(newGroupItem);
-                    else
-                        group.fields = [newGroupItem];
-                }
-                else {
-                    var groupItem = group.fields[index];
-
-                    groupItem.name = fieldName;
-                    groupItem.className = className;
-                    groupItem.direction = direction;
-                }
-            }
-        };
-
-        $scope.tableRemoveGroupItem = function (group, index) {
-            $table.tableReset();
-
-            group.fields.splice(index, 1);
-        };
-
-        $scope.selectSchema = function (idx) {
-            var data = $scope.data;
-            var tables = data.tables;
-            var schemaName = tables[idx].schemaName;
-            var use = tables[idx].use;
-
-            for (var i = idx + 1; i < tables.length; i++) {
-                var item = tables[i];
-
-                if (item.schemaName == schemaName && item.tableName)
-                    item.use = use;
-                else
-                    break;
-            }
-
-            data.curTableIdx = -1;
-            data.curFieldIdx = -1;
-        };
-
-        $scope.selectTable = function (idx) {
-            var data = $scope.data;
-
-            data.curTableIdx = idx;
-            data.curFieldIdx = -1;
-
-            if (idx >= 0) {
-                var tbl = data.tables[idx];
-
-                data.curKeyClass = tbl.keyClass;
-                data.curValueClass = tbl.valueClass;
-            }
-        };
-
-        $scope.selectField = function (idx) {
-            var data = $scope.data;
-
-            data.curFieldIdx = idx;
-
-            if (idx >= 0) {
-                var fld = data.tables[data.curTableIdx].fields[idx];
-
-                data.curJavaName = fld.javaName;
-                data.curJavaType = fld.javaType;
-            }
-        };
-    }]
-);
\ No newline at end of file