ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [1/2] ignite git commit: GNITE-843 Fixed clone for cluster and caches.
Date Thu, 14 Jan 2016 10:55:46 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 66cdf00be -> 39956dbe9


GNITE-843 Fixed clone for cluster and caches.


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

Branch: refs/heads/ignite-843-rc2
Commit: eb2d9ea48c156ddc032b9c456e4f6d58f80f63ec
Parents: 66cdf00
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Thu Jan 14 17:46:50 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Thu Jan 14 17:46:50 2016 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    | 27 ++++++++++++++------
 .../main/js/controllers/clusters-controller.js  | 19 ++++++++------
 .../src/main/js/controllers/common-module.js    | 24 +++++++++++------
 .../src/main/js/controllers/igfs-controller.js  |  2 +-
 .../main/js/controllers/metadata-controller.js  | 12 ++++++---
 .../src/main/js/public/stylesheets/style.scss   |  2 +-
 .../main/js/views/configuration/metadata.jade   |  6 ++---
 7 files changed, 59 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 2dbd5e1..50ebf1b 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -297,9 +297,7 @@ consoleModule.controller('cachesController', [
                 $scope.spaces = data.spaces;
 
                 data.caches.forEach(function (cache) {
-                    Object.defineProperty(cache, 'label', {
-                        get: _cacheLbl
-                    });
+                    Object.defineProperty(cache, 'label', { get: _cacheLbl });
                 });
 
                 $scope.caches = data.caches;
@@ -461,7 +459,7 @@ consoleModule.controller('cachesController', [
         };
 
         function prepareNewItem(id) {
-            return {
+            var newItem =  {
                 space: $scope.spaces[0]._id,
                 cacheMode: 'PARTITIONED',
                 atomicityMode: 'ATOMIC',
@@ -471,9 +469,12 @@ consoleModule.controller('cachesController', [
                     ? [id]
                     : _.map($scope.clusters, function (cluster) { return cluster.value; }),
                 metadatas: id && _.find($scope.metadatas, {value: id}) ? [id] : [],
-                cacheStoreFactory: {CacheJdbcBlobStoreFactory: {connectVia: 'DataSource'}},
-                get label() { return angular.bind(this, _cacheLbl)(); }
+                cacheStoreFactory: {CacheJdbcBlobStoreFactory: {connectVia: 'DataSource'}}
             };
+
+            Object.defineProperty(newItem, 'label', { get: _cacheLbl });
+
+            return newItem;
         }
 
         // Add new cache.
@@ -644,16 +645,26 @@ consoleModule.controller('cachesController', [
             }
         };
 
+        function _cacheNames() {
+            return _.map($scope.caches, function (cache) {
+                return cache.name;
+            });
+        }
+
         // Save cache with new name.
         $scope.cloneItem = function () {
             if ($scope.tableReset(true)) {
                 if (validate($scope.backupItem))
-                    $clone.confirm($scope.backupItem.name).then(function (newName) {
+                    $clone.confirm($scope.backupItem.name, _cacheNames()).then(function (newName)
{
                         var item = angular.copy($scope.backupItem);
 
-                        item._id = undefined;
+                        delete item._id;
+                        delete item.demo;
+
                         item.name = newName;
 
+                        Object.defineProperty(item, 'label', { get: _cacheLbl });
+
                         save(item);
                     });
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 10607ad..28fca27 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -244,9 +244,7 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
                 $scope.spaces = data.spaces;
 
                 data.clusters.forEach(function (cluster) {
-                    Object.defineProperty(cluster, 'label', {
-                        get: _clusterLbl
-                    });
+                    Object.defineProperty(cluster, 'label', { get: _clusterLbl });
                 });
 
                 $scope.clusters = data.clusters;
@@ -438,9 +436,7 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
             newItem.igfss = id && _.find($scope.igfss, {value: id}) ? [id] : [];
             newItem.space = $scope.spaces[0]._id;
 
-            Object.defineProperty(newItem, 'label', {
-                get: _clusterLbl
-            });
+            Object.defineProperty(newItem, 'label', { get: _clusterLbl });
 
             return newItem;
         }
@@ -710,15 +706,22 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
             }
         };
 
+        function _clusterNames() {
+            return _.map($scope.clusters, function (cluster) {
+                return cluster.name;
+            });
+        }
+
         // Copy cluster with new name.
         $scope.cloneItem = function () {
             if ($scope.tableReset(true)) {
                 if (validate($scope.backupItem))
-                    $clone.confirm($scope.backupItem.name).then(function (newName) {
+                    $clone.confirm($scope.backupItem.name, _clusterNames()).then(function
(newName) {
                         var item = angular.copy($scope.backupItem);
 
-                        item._id = undefined;
+                        delete item._id;
                         item.name = newName;
+                        Object.defineProperty(item, 'label', { get: _clusterLbl });
 
                         save(item);
                     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 3180335..c823bd2 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -1196,22 +1196,30 @@ consoleModule.service('$clone', function ($modal, $rootScope, $q)
{
     scope.ok = function (newName) {
         deferred.resolve(newName);
 
-        copyModal.hide();
+        cloneModal.hide();
     };
 
-    var copyModal = $modal({templateUrl: '/templates/clone.html', scope: scope, placement:
'center', show: false});
+    var cloneModal = $modal({templateUrl: '/templates/clone.html', scope: scope, placement:
'center', show: false});
 
-    copyModal.confirm = function (oldName) {
-        scope.newName = oldName + '(1)';
+    cloneModal.confirm = function (oldName, names) {
+        var num = 1;
+
+        scope.newName = oldName + '(' + num.toString() + ')';
+
+        while(_.includes(names, scope.newName)) {
+            num++;
+
+            scope.newName = oldName + '(' + num.toString() + ')';
+        }
 
         deferred = $q.defer();
 
-        copyModal.show();
+        cloneModal.show();
 
         return deferred.promise;
     };
 
-    return copyModal;
+    return cloneModal;
 });
 
 // Tables support service.
@@ -1834,7 +1842,7 @@ consoleModule.directive('onEscape', function () {
 consoleModule.directive('retainSelection', function ($timeout) {
     var promise;
 
-    return function (scope, elem, attr) {
+    return function (scope, elem) {
         elem.on('keydown', function (evt) {
             var key = evt.which;
             var ctrlDown = evt.ctrlKey || evt.metaKey;
@@ -2228,7 +2236,7 @@ consoleModule.controller('notebooks', ['$scope', '$modal', '$state',
'$http', '$
 
                 $state.go('base.sql', {id: id});
             })
-            .error(function (message, state) {
+            .error(function (message) {
                 $common.showError(message);
             });
     };

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/igfs-controller.js b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
index 436def7..ed23308 100644
--- a/modules/control-center-web/src/main/js/controllers/igfs-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/igfs-controller.js
@@ -382,7 +382,7 @@ consoleModule.controller('igfsController', [
                         $clone.confirm($scope.backupItem.name).then(function (newName) {
                             var item = angular.copy($scope.backupItem);
 
-                            item._id = undefined;
+                            delete item._id;
                             item.name = newName;
 
                             save(item);

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index f4963a8..1c80eec 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -32,7 +32,7 @@ consoleModule.controller('metadataController', function ($filter, $http,
$timeou
         $scope.ui.generateCaches = true;
         $scope.ui.generatedCachesClusters = [];
 
-        $scope.removeDemoDropdown = [{ 'text': 'Remove generated demo metadata', 'click':
'removeDemoItems()'}];
+        $scope.removeDemoDropdown = [{ 'text': 'Remove generated demo data', 'click': 'removeDemoItems()'}];
 
         function restoreSelection() {
             var lastSelectedMetadata = angular.fromJson(sessionStorage.lastSelectedMetadata);
@@ -1172,14 +1172,20 @@ consoleModule.controller('metadataController', function ($filter,
$http, $timeou
             }
         };
 
+        function _metadataNames() {
+            return _.map($scope.metadatas, function (meta) {
+                return meta.valueType;
+            });
+        }
+
         // Save cache type metadata with new name.
         $scope.cloneItem = function () {
             if ($scope.tableReset(true)) {
                 if (validate($scope.backupItem))
-                    $clone.confirm($scope.backupItem.valueType).then(function (newName) {
+                    $clone.confirm($scope.backupItem.valueType, _metadataNames()).then(function
(newName) {
                         var item = angular.copy($scope.backupItem);
 
-                        item._id = undefined;
+                        delete item._id;
                         item.valueType = newName;
 
                         save(item);

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
index 36827cb..3a50acd 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
@@ -435,7 +435,7 @@ h1, h2, h3, h4, h5, h6 {
     margin-bottom: 0;
 }
 
-button, a.btn {
+button, a.btn, i.btn {
     margin-right: 5px;
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2d9ea4/modules/control-center-web/src/main/js/views/configuration/metadata.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata.jade b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
index b518f52..0b7c3dc 100644
--- a/modules/control-center-web/src/main/js/views/configuration/metadata.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/metadata.jade
@@ -67,14 +67,12 @@ include ../includes/controls
                     button.btn.btn-primary(id='new-item' ng-click='createItem()') Add metadata
                 .panel-tip-container(bs-tooltip='' data-title='Load metadata from database'
data-placement='bottom')
                     button.btn.btn-primary(ng-click='showLoadMetadataModal(false)') Load
from database
+                +save-remove-buttons('metadata')
                 .btn-group.panel-tip-container(bs-tooltip='' data-title='Load metadata from
demo database' data-placement='bottom')
-                    button.btn.btn-info(ng-click='showLoadMetadataModal(true)') Load from
demo database
+                    button.btn.btn-info(ng-click='showLoadMetadataModal(true)') Demo
                         button.btn.dropdown-toggle.btn-info(id='remove-demo-dropdown' ng-if='hasDemoItems()'
data-toggle='dropdown' data-container='body' bs-dropdown='removeDemoDropdown' data-placement='bottom-right')
                             span.caret
-                +save-remove-buttons('metadata')
                 hr
             form.form-horizontal(name='ui.inputForm' ng-show='backupItem && tableVisibleRow((displayedRows
| metadatasValidation:ui.showValid:true), selectedItem)' novalidate unsaved-warning-form)
                 .panel-group(bs-collapse ng-model='panels.activePanels' data-allow-multiple='true')
                     +groups('metadata', 'backupItem')
-                .section
-                    +save-remove-buttons('metadata')


Mime
View raw message