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/29 05:38:26 UTC

[05/11] incubator-ignite git commit: # ignite-843 Rename

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96522874/modules/web-control-center/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/controllers/caches-controller.js b/modules/web-control-center/src/main/js/controllers/caches-controller.js
deleted file mode 100644
index e995233..0000000
--- a/modules/web-control-center/src/main/js/controllers/caches-controller.js
+++ /dev/null
@@ -1,349 +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.javaBuildInTypes = $common.javaBuildInTypes;
-
-        $scope.tableReset = $table.tableReset;
-        $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.queryMetadata = [];
-        $scope.storeMetadata = [];
-
-        $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;
-
-                _.forEach(data.metadatas, function (meta) {
-                    var kind = meta.kind;
-
-                    if (kind == 'query' || kind == 'both')
-                        $scope.queryMetadata.push(meta);
-
-                    if (kind == 'store' || kind == 'both')
-                        $scope.storeMetadata.push(meta);
-                });
-
-                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.queryMetadata = [];
-            $scope.backupItem.spaceMetadata = [];
-            $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/96522874/modules/web-control-center/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/controllers/clusters-controller.js b/modules/web-control-center/src/main/js/controllers/clusters-controller.js
deleted file mode 100644
index 0b18868..0000000
--- a/modules/web-control-center/src/main/js/controllers/clusters-controller.js
+++ /dev/null
@@ -1,308 +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.tableReset = $table.tableReset;
-        $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.caches = [];
-            $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/96522874/modules/web-control-center/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/controllers/common-module.js b/modules/web-control-center/src/main/js/controllers/common-module.js
deleted file mode 100644
index df2ff19..0000000
--- a/modules/web-control-center/src/main/js/controllers/common-module.js
+++ /dev/null
@@ -1,484 +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
-            });
-        },
-        javaBuildInTypes: [
-            'Boolean', 'Byte', 'Date', 'Double', 'Float', 'Integer', 'Long', 'Short', 'String', 'Time', 'Timestamp', 'UUID'
-        ]
-    }
-}]);
-
-// 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);
-            });
-        }
-    };
-});
-
-// Directive to bind ENTER key press with some user action.
-controlCenterModule.directive('ngEnter', function() {
-    return function(scope, element, attrs) {
-        element.bind('keydown keypress', function(event) {
-            if (event.which === 13) {
-                scope.$apply(function() {
-                    scope.$eval(attrs.ngEnter);
-                });
-
-                event.preventDefault();
-            }
-        });
-    };
-});
-
-// Directive to bind ESC key press with some user action.
-controlCenterModule.directive('ngEscape', function() {
-    return function(scope, element, attrs) {
-        element.bind('keydown keyup', function(event) {
-            if (event.which === 27) {
-                scope.$apply(function() {
-                    scope.$eval(attrs.ngEscape);
-                });
-
-                event.preventDefault();
-            }
-        });
-    };
-});
-
-// Factory function to focus element.
-controlCenterModule.factory('focus', function ($timeout, $window) {
-    return function (id) {
-        // Timeout makes sure that is invoked after any other event has been triggered.
-        // E.g. click events that need to run before the focus or inputs elements that are
-        // in a disabled state but are enabled when those events are triggered.
-        $timeout(function () {
-            var element = $window.document.getElementById(id);
-
-            if (element)
-                element.focus();
-        });
-    };
-});
-
-// Directive to mark elements to focus.
-controlCenterModule.directive('eventFocus', function (focus) {
-    return function (scope, elem, attr) {
-        elem.on(attr.eventFocus, function () {
-            focus(attr.eventFocusId);
-        });
-
-        // Removes bound events in the element itself when the scope is destroyed
-        scope.$on('$destroy', function () {
-            element.off(attr.eventFocus);
-        });
-    };
-});
-
-// 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/96522874/modules/web-control-center/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/controllers/metadata-controller.js b/modules/web-control-center/src/main/js/controllers/metadata-controller.js
deleted file mode 100644
index c8fad8d..0000000
--- a/modules/web-control-center/src/main/js/controllers/metadata-controller.js
+++ /dev/null
@@ -1,709 +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.javaBuildInTypes = $common.javaBuildInTypes;
-
-        $scope.tableReset = $table.tableReset;
-        $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: false, label: 'ASC'},
-            {value: true, 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,
-                            databaseName: 'name1',
-                            databaseType: 'dbType1',
-                            javaName: 'javaName1',
-                            javaType: 'javaType1'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name2',
-                            databaseType: 'dbType2',
-                            javaName: 'javaName2',
-                            javaType: 'javaType2'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name3',
-                            databaseType: '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,
-                            databaseName: 'name4',
-                            databaseType: 'dbType4',
-                            javaName: 'javaName4',
-                            javaType: 'javaType4'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name5',
-                            databaseType: 'dbType5',
-                            javaName: 'javaName5',
-                            javaType: 'javaType5'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name6',
-                            databaseType: 'dbType6',
-                            javaName: 'javaName6',
-                            javaType: 'javaType6'
-                        }
-                    ]
-                },
-                {
-                    schemaName: 'Schema2',
-                    use: false,
-                    tableName: 'Table3',
-                    keyClass: 'KeyClass3',
-                    valueClass: 'ValueClass3',
-                    fields: [
-                        {
-                            use: true,
-                            key: true,
-                            ak: true,
-                            databaseName: 'name7',
-                            databaseType: 'dbType7',
-                            javaName: 'javaName7',
-                            javaType: 'javaType7'
-                        },
-                        {
-                            use: true,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name8',
-                            databaseType: 'dbType8',
-                            javaName: 'javaName8',
-                            javaType: 'javaType8'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name9',
-                            databaseType: 'dbType9',
-                            javaName: 'javaName9',
-                            javaType: 'javaType9'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name10',
-                            databaseType: 'dbType10',
-                            javaName: 'javaName10',
-                            javaType: 'javaType10'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name11',
-                            databaseType: 'dbType11',
-                            javaName: 'javaName11',
-                            javaType: 'javaType11'
-                        },
-                        {
-                            use: false,
-                            key: false,
-                            ak: false,
-                            databaseName: 'name12',
-                            databaseType: '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);
-            });
-
-        function selectFirstItem() {
-            if ($scope.metadatas.length > 0)
-                $scope.selectItem($scope.metadatas[0]);
-        }
-
-        function setSelectedAndBackupItem(sel, bak) {
-            $table.tableReset();
-
-            $scope.selectedItem = sel;
-            $scope.backupItem = bak;
-
-            $scope.panels.activePanel = [0];
-        }
-
-        // 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) {
-                    if (restoredItem._id) {
-                        var idx = _.findIndex($scope.metadatas, function (metadata) {
-                            return metadata._id == restoredItem._id;
-                        });
-
-                        if (idx >= 0)
-                            setSelectedAndBackupItem($scope.metadatas[idx], restoredItem);
-                        else {
-                            sessionStorage.removeItem('metadataBackupItem');
-
-                            selectFirstItem();
-                        }
-                    }
-                    else
-                        setSelectedAndBackupItem(undefined, restoredItem);
-                }
-                else
-                    selectFirstItem();
-
-                $scope.$watch('backupItem', function (val) {
-                    if (val)
-                        sessionStorage.metadataBackupItem = angular.toJson(val);
-                }, true);
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
-        $scope.selectItem = function (item) {
-            setSelectedAndBackupItem(item, 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 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 (databaseName, databaseType, javaName, javaType) {
-            return $common.isNonEmpty(databaseName) && $common.isDefined(databaseType) &&
-                $common.isNonEmpty(javaName) && $common.isDefined(javaType);
-        };
-
-        $scope.tableDbFieldSave = function (field, newDatabaseName, newDatabaseType, newJavaName, newJavaType, index) {
-            var item = $scope.backupItem;
-
-            var model = item[field.model];
-
-            var newItem = {databaseName: newDatabaseName, databaseType: newDatabaseType, javaName: newJavaName, javaType: newJavaType};
-
-            if ($common.isDefined(model)) {
-                var idx = _.findIndex(model, function (dbMeta) {
-                    return dbMeta.databaseName == newDatabaseName
-                });
-
-                // 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.databaseName = newDatabaseName;
-                    dbField.databaseType = newDatabaseType;
-                    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 groups = $scope.backupItem.groups;
-
-            if (groups) {
-                var group = groups[groupIndex];
-
-                if (group) {
-                    var groupName = group.name;
-
-                    return $table.tableNewItemActive({model: groupName});
-                }
-            }
-
-            return false;
-        };
-
-        $scope.tableGroupItemEditing = function (groupIndex, index) {
-            var groups = $scope.backupItem.groups;
-
-            if (groups) {
-                var group = groups[groupIndex];
-
-                if (group)
-                    return $table.tableEditing({model: group.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