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

[03/11] ignite git commit: IGNITE-2370 Minor fix for validation message.

IGNITE-2370 Minor fix for validation message.


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

Branch: refs/heads/ignite-843-rc3
Commit: 7ecefe176f98ccae9394c7ba7590e09d45e69937
Parents: 362b7dd
Author: vsisko <vs...@gridgain.com>
Authored: Fri Jan 22 16:03:53 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jan 22 16:03:53 2016 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  8 +-
 .../main/js/controllers/clusters-controller.js  |  2 +-
 .../src/main/js/controllers/common-module.js    | 77 ++++++++++++--------
 3 files changed, 52 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7ecefe17/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 c7a7249..8ddea36 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
@@ -467,16 +467,16 @@ consoleModule.controller('cachesController', [
 
                 caches.push($scope.backupItem);
 
-                checkRes = $common.checkCachesDataSources(caches);
+                checkRes = $common.checkCachesDataSources(caches, $scope.backupItem);
 
                 return !checkRes.checked;
             });
 
             if (!checkRes.checked) {
-                return showPopoverMessage($scope.panels, 'store', checkRes.secondCache.cacheStoreFactory.kind === 'CacheJdbcPojoStoreFactory' ? 'dialect' : 'database',
-                    'Found caches "' + checkRes.firstCache.name + '" and "' + checkRes.secondCache.name + '" in cluster "' + failCluster.label + '" ' +
+                return showPopoverMessage($scope.panels, 'store', checkRes.firstCache.cacheStoreFactory.kind === 'CacheJdbcPojoStoreFactory' ? 'dialect' : 'database',
+                    'Found cache "' + checkRes.secondCache.name + '" in cluster "' + failCluster.label + '" ' +
                     'with the same data source bean name "' + checkRes.firstCache.cacheStoreFactory[checkRes.firstCache.cacheStoreFactory.kind].dataSourceBean +
-                    '" and different configured databases: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in "' + checkRes.firstCache.name + '" and "' +
+                    '" and different database: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in current cache and "' +
                     $common.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000);
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ecefe17/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 8106ecc..5abef5c 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
@@ -468,7 +468,7 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
                 return showPopoverMessage($scope.panels, 'general', 'caches',
                     'Found caches "' + checkRes.firstCache.name + '" and "' + checkRes.secondCache.name + '" ' +
                     'with the same data source bean name "' + checkRes.firstCache.cacheStoreFactory[checkRes.firstCache.cacheStoreFactory.kind].dataSourceBean +
-                    '" and different configured databases: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in "' + checkRes.firstCache.name + '" and "' +
+                    '" and different databases: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in "' + checkRes.firstCache.name + '" and "' +
                     $common.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000);
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7ecefe17/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 32f72cb..57d96ae 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
@@ -702,6 +702,30 @@ consoleModule.service('$common', [
             return !isEmpty;
         }
 
+        var DS_CHECK_SUCCESS = { checked: true };
+
+        function compareDataSources(firstCache, secondCache) {
+            var firstDs = extractDataSource(firstCache);
+            var secondDs = extractDataSource(secondCache);
+
+            if (firstDs && secondDs) {
+                var firstDB = firstDs.dialect || firstDs.database;
+                var secondDB = secondDs.dialect || secondDs.database;
+
+                if (firstDs.dataSourceBean === secondDs.dataSourceBean && firstDB !== secondDB) {
+                    return {
+                        checked: false,
+                        firstCache: firstCache,
+                        firstDB: firstDB,
+                        secondCache: secondCache,
+                        secondDB: secondDB
+                    };
+                }
+            }
+
+            return DS_CHECK_SUCCESS;
+        }
+
         return {
             getModel: getModel,
             joinTip: function (arr) {
@@ -1027,42 +1051,35 @@ consoleModule.service('$common', [
 
                 return found ? found.label : undefined;
             },
-            checkCachesDataSources: function (caches) {
-                var res = { checked: true };
-
-                res.checked = !isDefined(_.find(caches, function (curCache, curIx) {
-                    return _.find(caches, function (checkCache, checkIx) {
-                        if (checkIx < curIx) {
-                            var curDs = extractDataSource(curCache);
-                            var checkDs = extractDataSource(checkCache);
-
-                            if (curDs && checkDs) {
-                                var curDB = curDs.dialect || curDs.database;
-                                var checkDB = checkDs.dialect || checkDs.database;
-
-                                if (curDs.dataSourceBean === checkDs.dataSourceBean && curDB !== checkDB) {
-                                    res = {
-                                        checked: false,
-                                        firstCache: checkCache,
-                                        firstDB: checkDB,
-                                        secondCache: curCache,
-                                        secondDB: curDB
-                                    };
-
-                                    return true;
-                                }
-                            }
+            checkCachesDataSources: function (caches, checkCacheExt) {
+                var res = DS_CHECK_SUCCESS;
+
+                _.find(caches, function (curCache, curIx) {
+                    if (isDefined(checkCacheExt)) {
+                        if (!isDefined(checkCacheExt._id) || checkCacheExt.id != curCache._id) {
+                            res = compareDataSources(checkCacheExt, curCache);
+
+                            return !res.checked;
                         }
 
                         return false;
-                    });
-                }));
+                    }
+                    else {
+                        return _.find(caches, function (checkCache, checkIx) {
+                            if (checkIx < curIx) {
+                                res = compareDataSources(checkCache, curCache);
+
+                                return !res.checked;
+                            }
+
+                            return false;
+                        });
+                    }
+                });
 
                 return res;
             },
             autoCacheStoreConfiguration: function (cache, domains) {
-                var change;
-
                 var cacheStoreFactory = isDefined(cache.cacheStoreFactory) &&
                     isDefined(cache.cacheStoreFactory.kind);
 
@@ -1126,7 +1143,7 @@ consoleModule.service('$unsavedChangesGuard', function ($rootScope) {
                 window.onbeforeunload = null;
             });
 
-            var unbind = $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
+            var unbind = $rootScope.$on('$stateChangeStart', function(event) {
                 if ($scope.ui && $scope.ui.isDirty()) {
                     if (!confirm('You have unsaved changes.\n\nAre you sure you want to discard them?')) {
                         event.preventDefault();