ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Fixed dirty/pristine state logic.
Date Fri, 11 Sep 2015 15:30:17 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 fdfbc6dfd -> 9872e8107


IGNITE-843 Fixed dirty/pristine state logic.


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

Branch: refs/heads/ignite-843
Commit: 9872e81078a9a0e656c7a04c1b5563e2dd4ae548
Parents: fdfbc6d
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Sep 11 22:30:12 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Sep 11 22:30:12 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/caches-controller.js     | 13 +++++++------
 .../src/main/js/controllers/clusters-controller.js   |  9 +++++----
 .../src/main/js/controllers/common-module.js         |  8 ++++----
 .../src/main/js/controllers/metadata-controller.js   | 15 +++++++--------
 4 files changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9872e810/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 44b077d..012b3cf 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
@@ -267,9 +267,9 @@ controlCenterModule.controller('cachesController', [
                     else
                         selectFirstItem();
 
-                    $scope.$watch('backupItem', function (val, old) {
+                    $scope.$watch('backupItem', function (val) {
                         if (val) {
-                            var metas = cacheMetadatas();
+                            var metas = cacheMetadatas(val);
                             var varName = 'cache';
 
                             $scope.preview.general.xml = $generatorXml.cacheMetadatas(metas,
$generatorXml.cacheGeneral(val)).asString();
@@ -357,7 +357,7 @@ controlCenterModule.controller('cachesController', [
                     else
                         $scope.backupItem = undefined;
 
-                    $scope.ui.markPristine();
+                    $scope.ui.markPristine(2);
                 }
 
                 $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
@@ -453,7 +453,7 @@ controlCenterModule.controller('cachesController', [
             function save(item) {
                 $http.post('caches/save', item)
                     .success(function (_id) {
-                        $scope.ui.markPristine();
+                        $scope.ui.markPristine(0);
 
                         var idx = _.findIndex($scope.caches, function (cache) {
                             return cache._id == _id;
@@ -468,6 +468,7 @@ controlCenterModule.controller('cachesController', [
                         }
 
                         $scope.selectItem(item);
+                        $scope.ui.markPristine(0);
 
                         $common.showInfo('Cache "' + item.name + '" saved.');
                     })
@@ -509,7 +510,7 @@ controlCenterModule.controller('cachesController', [
 
                 $confirm.show('Are you sure you want to remove cache: "' + selectedItem.name
+ '"?').then(
                     function () {
-                        $scope.ui.markPristine();
+                        $scope.ui.markPristine(0);
 
                         var _id = selectedItem._id;
 
@@ -545,7 +546,7 @@ controlCenterModule.controller('cachesController', [
 
                 $confirm.show('Are you sure you want to remove all caches?').then(
                     function () {
-                        $scope.ui.markPristine();
+                        $scope.ui.markPristine(0);
 
                         $http.post('caches/remove/all')
                             .success(function () {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9872e810/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 1ad15f9..48f8a0d 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
@@ -277,7 +277,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
                 else
                     $scope.backupItem = undefined;
 
-                $scope.ui.markPristine();
+                $scope.ui.markPristine(2);
             }
 
             $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
@@ -372,7 +372,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
         function save(item) {
             $http.post('clusters/save', item)
                 .success(function (_id) {
-                    $scope.ui.markPristine();
+                    $scope.ui.markPristine(0);
 
                     var idx = _.findIndex($scope.clusters, function (cluster) {
                         return cluster._id == _id;
@@ -387,6 +387,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
                     }
 
                     $scope.selectItem(item);
+                    $scope.ui.markPristine(0);
 
                     $common.showInfo('Cluster "' + item.name + '" saved.');
                 })
@@ -428,7 +429,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
 
             $confirm.show('Are you sure you want to remove cluster: "' + selectedItem.name
+ '"?').then(
                 function () {
-                    $scope.ui.markPristine();
+                    $scope.ui.markPristine(0);
 
                     var _id = selectedItem._id;
 
@@ -464,7 +465,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
 
             $confirm.show('Are you sure you want to remove all clusters?').then(
                 function () {
-                    $scope.ui.markPristine();
+                    $scope.ui.markPristine(0);
 
                     $http.post('clusters/remove/all')
                         .success(function () {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9872e810/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 430c78e..296f7e3 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
@@ -753,10 +753,10 @@ controlCenterModule.service('$common', [
                     }
                 }
             },
-            formUI: function (dirtyCnt) {
+            formUI: function (initialDirtyCnt) {
                 return {
                     expanded: false,
-                    dirty: dirtyCnt,
+                    dirty: initialDirtyCnt,
                     isDirty: function () {
                         return this.dirty < 0;
                     },
@@ -770,7 +770,7 @@ controlCenterModule.service('$common', [
                                 markPristine(this.inputForm);
                         }
                     },
-                    markPristine: function () {
+                    markPristine: function (dirtyCnt) {
                         this.dirty = dirtyCnt;
 
                         if (isDefined(this.inputForm))
@@ -819,7 +819,7 @@ controlCenterModule.service('$confirm', function ($modal, $rootScope,
$q) {
     return confirmModal;
 });
 
-// Confirm by step popup service.
+// Service for confirm or skip several steps.
 controlCenterModule.service('$stepConfirm', function ($timeout, $modal, $rootScope, $q) {
     var scope = $rootScope.$new();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9872e810/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 5912c21..d351fc1 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
@@ -662,7 +662,7 @@ controlCenterModule.controller('metadataController', [
                     else
                         $scope.backupItem = undefined;
 
-                    $scope.ui.markPristine();
+                    $scope.ui.markPristine(1);
                 }
 
                 $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
@@ -755,7 +755,7 @@ controlCenterModule.controller('metadataController', [
 
                 $http.post('metadata/save', item)
                     .success(function (_id) {
-                        $scope.ui.markPristine();
+                        $scope.ui.markPristine(0);
 
                         var idx = _.findIndex($scope.metadatas, function (metadata) {
                             return metadata._id == _id;
@@ -770,6 +770,7 @@ controlCenterModule.controller('metadataController', [
                         }
 
                         $scope.selectItem(item);
+                        $scope.ui.markPristine(0);
 
                         if (!quiet)
                             $common.showInfo('Cache type metadata"' + item.name + '" saved.');
@@ -816,7 +817,7 @@ controlCenterModule.controller('metadataController', [
 
                         $http.post('metadata/remove', {_id: _id})
                             .success(function () {
-                                $scope.ui.markPristine();
+                                $scope.ui.markPristine(0);
 
                                 $common.showInfo('Cache type metadata has been removed: '
+ selectedItem.name);
 
@@ -831,10 +832,8 @@ controlCenterModule.controller('metadataController', [
 
                                     if (metadatas.length > 0)
                                         $scope.selectItem(metadatas[0]);
-                                    else {
-                                        $scope.selectedItem = undefined;
-                                        $scope.backupItem = undefined;
-                                    }
+                                    else
+                                        $scope.selectItem(undefined, undefined);
                                 }
                             })
                             .error(function (errMsg) {
@@ -849,7 +848,7 @@ controlCenterModule.controller('metadataController', [
 
                 $confirm.show('Are you sure you want to remove all metadata?').then(
                     function () {
-                        $scope.ui.markPristine();
+                        $scope.ui.markPristine(0);
 
                         $http.post('metadata/remove/all')
                             .success(function () {


Mime
View raw message