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 WIP fixed dirty check for tables.
Date Fri, 29 Jan 2016 10:36:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 746fb3d68 -> b5060a3a4


IGNITE-843 WIP fixed dirty check for tables.


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

Branch: refs/heads/ignite-843-rc2
Commit: b5060a3a4ed3aad482dcc8c8a908db6a900e09ee
Parents: 746fb3d
Author: Dmitriyff <dmitriyff@gmail.com>
Authored: Fri Jan 29 17:36:27 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Fri Jan 29 17:36:27 2016 +0700

----------------------------------------------------------------------
 .../main/js/app/modules/Form/group/group.directive.js  |  7 +++++++
 .../js/app/modules/Form/validator/unique.directive.js  | 13 +++++++++++--
 .../src/main/js/controllers/clusters-controller.js     |  2 ++
 3 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b5060a3a/modules/control-center-web/src/main/js/app/modules/Form/group/group.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/group/group.directive.js
b/modules/control-center-web/src/main/js/app/modules/Form/group/group.directive.js
index 56b6c94..629f224 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/group/group.directive.js
+++ b/modules/control-center-web/src/main/js/app/modules/Form/group/group.directive.js
@@ -33,8 +33,15 @@ export default ['igniteFormGroup', [() => {
             form.$defaults[name] = _.cloneDeep(scope.value);
         };
 
+        const setAsDirty = () => {
+            if (JSON.stringify(scope.value) !== JSON.stringify(form.$defaults[name]))
+                form.$setDirty();
+        };
+
         scope.$watch(() => form.$pristine, setAsDefault);
+        
         scope.$watch('value', setAsDefault);
+        scope.$watch('value', setAsDirty, true);
     };
 
     return {

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5060a3a/modules/control-center-web/src/main/js/app/modules/Form/validator/unique.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/validator/unique.directive.js
b/modules/control-center-web/src/main/js/app/modules/Form/validator/unique.directive.js
index 1ddbb79..77c9e62 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/validator/unique.directive.js
+++ b/modules/control-center-web/src/main/js/app/modules/Form/validator/unique.directive.js
@@ -20,11 +20,20 @@ export default ['igniteUnique', ['$parse', ($parse) => {
         if (typeof attrs.igniteUnique === 'undefined' || !attrs.igniteUnique)
             return;
 
-        ngModel.$validators.igniteUnique = (value) => {
+        ngModel.$validators.igniteUnique = (value, old) => {
+            let idx;
             const arr = $parse(attrs.igniteUnique)(scope);
 
             // Return true in case if array not exist, array empty, or value is unique.
-            return !arr || !arr.length || !~arr.indexOf(value);
+            if (!arr || !arr.length || !~(idx = arr.indexOf(value))) {
+                return true;
+            }
+            
+            if (typeof scope.$index === 'number' && scope.$index === idx) {
+                return true;
+            }
+
+            return false;
         };
     };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5060a3a/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 3344a26..be87644 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
@@ -186,6 +186,8 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
                 $scope.$watch('backupItem', function (val) {
                     if (__original_value === JSON.stringify(val))
                         $scope.ui.inputForm.$setPristine();
+                    else 
+                        $scope.ui.inputForm.$setDirty();
 
                     if (val) {
                         var clusterCaches = _.reduce($scope.caches, function(caches, cache){


Mime
View raw message