ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [32/50] [abbrv] ignite git commit: IGNITE-3250 Reworked object comparing from JSON stringify() to _.isEqual()
Date Mon, 20 Jun 2016 02:58:55 GMT
IGNITE-3250 Reworked object comparing from JSON stringify() to _.isEqual()


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

Branch: refs/heads/ignite-3262
Commit: 4dd0f4c8cd950ba67102bf41d27b52d3624ff6fb
Parents: 79270b1
Author: Dmitriyff <dmitriyff@gmail.com>
Authored: Fri Jun 10 14:40:34 2016 +0700
Committer: vsisko <vsisko@gridgain.com>
Committed: Fri Jun 10 14:40:34 2016 +0700

----------------------------------------------------------------------
 .../main/js/app/modules/form/field/input/datalist.directive.js | 6 +++---
 .../src/main/js/app/modules/form/field/input/text.directive.js | 6 +++---
 .../src/main/js/app/modules/form/group/group.directive.js      | 6 +++---
 .../web-console/src/main/js/controllers/caches-controller.js   | 6 +++---
 .../web-console/src/main/js/controllers/clusters-controller.js | 6 +++---
 .../web-console/src/main/js/controllers/domains-controller.js  | 6 +++---
 modules/web-console/src/main/js/controllers/igfs-controller.js | 6 +++---
 7 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/app/modules/form/field/input/datalist.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/modules/form/field/input/datalist.directive.js
b/modules/web-console/src/main/js/app/modules/form/field/input/datalist.directive.js
index 0cd9d69..ce67897 100644
--- a/modules/web-console/src/main/js/app/modules/form/field/input/datalist.directive.js
+++ b/modules/web-console/src/main/js/app/modules/form/field/input/datalist.directive.js
@@ -74,10 +74,10 @@ export default ['igniteFormFieldInputDatalist', ['IgniteFormGUID', '$table',
(gu
         scope.ngChange = () => {
             ngModel.$setViewValue(scope.value);
 
-            if (JSON.stringify(scope.value) !== JSON.stringify(form.$defaults[name]))
-                ngModel.$setDirty();
-            else
+            if (_.isEqual(scope.value, form.$defaults[name]))
                 ngModel.$setPristine();
+            else
+                ngModel.$setDirty();
 
             setTimeout(checkValid, 100); // Use setTimeout() workaround of problem of two
controllers.
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/app/modules/form/field/input/text.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/modules/form/field/input/text.directive.js
b/modules/web-console/src/main/js/app/modules/form/field/input/text.directive.js
index ba4407f..619a541 100644
--- a/modules/web-console/src/main/js/app/modules/form/field/input/text.directive.js
+++ b/modules/web-console/src/main/js/app/modules/form/field/input/text.directive.js
@@ -75,10 +75,10 @@ export default ['igniteFormFieldInputText', ['IgniteFormGUID', '$table',
(guid,
         scope.ngChange = () => {
             ngModel.$setViewValue(scope.value);
 
-            if (JSON.stringify(scope.value) !== JSON.stringify(form.$defaults[name]))
-                ngModel.$setDirty();
-            else
+            if (_.isEqual(scope.value, form.$defaults[name]))
                 ngModel.$setPristine();
+            else
+                ngModel.$setDirty();
 
             setTimeout(checkValid, 100); // Use setTimeout() workaround of problem of two
controllers.
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/app/modules/form/group/group.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/app/modules/form/group/group.directive.js b/modules/web-console/src/main/js/app/modules/form/group/group.directive.js
index 5039d6f..0971d44 100644
--- a/modules/web-console/src/main/js/app/modules/form/group/group.directive.js
+++ b/modules/web-console/src/main/js/app/modules/form/group/group.directive.js
@@ -50,10 +50,10 @@ export default ['igniteFormGroup', [() => {
         };
 
         const setAsDirty = () => {
-            if (JSON.stringify(scope.ngModel) !== JSON.stringify(parentFormCtrl.$defaults[name]))
-                ngModelCtrl.$setDirty();
-            else
+            if (_.isEqual(scope.ngModel, parentFormCtrl.$defaults[name]))
                 ngModelCtrl.$setPristine();
+            else
+                ngModelCtrl.$setDirty();
         };
 
         scope.$watch(() => parentFormCtrl.$pristine, setAsDefault);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/controllers/caches-controller.js b/modules/web-console/src/main/js/controllers/caches-controller.js
index 2d27164..e90461a 100644
--- a/modules/web-console/src/main/js/controllers/caches-controller.js
+++ b/modules/web-console/src/main/js/controllers/caches-controller.js
@@ -134,14 +134,14 @@ consoleModule.controller('cachesController', [
                 }
 
                 $scope.$watch('ui.inputForm.$valid', function(valid) {
-                    if (valid && __original_value === JSON.stringify($cleanup($scope.backupItem)))
+                    if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem)))
                         $scope.ui.inputForm.$dirty = false;
                 });
 
                 $scope.$watch('backupItem', function(val) {
                     const form = $scope.ui.inputForm;
 
-                    if (form.$pristine || (form.$valid && __original_value === JSON.stringify($cleanup(val))))
+                    if (form.$pristine || (form.$valid && _.isEqual(__original_value,
$cleanup(val))))
                         form.$setPristine();
                     else
                         form.$setDirty();
@@ -179,7 +179,7 @@ consoleModule.controller('cachesController', [
 
                 $scope.backupItem = angular.merge({}, blank, $scope.backupItem);
 
-                __original_value = JSON.stringify($cleanup($scope.backupItem));
+                __original_value = $cleanup($scope.backupItem);
 
                 if ($common.getQueryVariable('new'))
                     $state.go('base.configuration.caches');

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/controllers/clusters-controller.js b/modules/web-console/src/main/js/controllers/clusters-controller.js
index 7da00a5..65c5be1 100644
--- a/modules/web-console/src/main/js/controllers/clusters-controller.js
+++ b/modules/web-console/src/main/js/controllers/clusters-controller.js
@@ -246,14 +246,14 @@ consoleModule.controller('clustersController', [
                 }
 
                 $scope.$watch('ui.inputForm.$valid', function(valid) {
-                    if (valid && __original_value === JSON.stringify($cleanup($scope.backupItem)))
+                    if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem)))
                         $scope.ui.inputForm.$dirty = false;
                 });
 
                 $scope.$watch('backupItem', function(val) {
                     const form = $scope.ui.inputForm;
 
-                    if (form.$pristine || (form.$valid && __original_value === JSON.stringify($cleanup(val))))
+                    if (form.$pristine || (form.$valid && _.isEqual(__original_value,
$cleanup(val))))
                         form.$setPristine();
                     else
                         form.$setDirty();
@@ -297,7 +297,7 @@ consoleModule.controller('clustersController', [
 
                 $scope.backupItem = angular.merge({}, blank, $scope.backupItem);
 
-                __original_value = JSON.stringify($cleanup($scope.backupItem));
+                __original_value = $cleanup($scope.backupItem);
 
                 if ($common.getQueryVariable('new'))
                     $state.go('base.configuration.clusters');

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/controllers/domains-controller.js b/modules/web-console/src/main/js/controllers/domains-controller.js
index df7d8a9..ab7e7d8 100644
--- a/modules/web-console/src/main/js/controllers/domains-controller.js
+++ b/modules/web-console/src/main/js/controllers/domains-controller.js
@@ -1118,14 +1118,14 @@ consoleModule.controller('domainsController', [
                 }
 
                 $scope.$watch('ui.inputForm.$valid', function(valid) {
-                    if (valid && __original_value === JSON.stringify($cleanup($scope.backupItem)))
+                    if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem)))
                         $scope.ui.inputForm.$dirty = false;
                 });
 
                 $scope.$watch('backupItem', function(val) {
                     const form = $scope.ui.inputForm;
 
-                    if (form.$pristine || (form.$valid && __original_value === JSON.stringify($cleanup(val))))
+                    if (form.$pristine || (form.$valid && _.isEqual(__original_value,
$cleanup(val))))
                         form.$setPristine();
                     else
                         form.$setDirty();
@@ -1176,7 +1176,7 @@ consoleModule.controller('domainsController', [
 
                 $scope.backupItem = angular.merge({}, blank, $scope.backupItem);
 
-                __original_value = JSON.stringify($cleanup($scope.backupItem));
+                __original_value = $cleanup($scope.backupItem);
 
                 if ($common.isDefined($scope.backupItem) && !$common.isDefined($scope.backupItem.queryMetadata))
                     $scope.backupItem.queryMetadata = 'Configuration';

http://git-wip-us.apache.org/repos/asf/ignite/blob/4dd0f4c8/modules/web-console/src/main/js/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/controllers/igfs-controller.js b/modules/web-console/src/main/js/controllers/igfs-controller.js
index c6b3273..bb15e8b 100644
--- a/modules/web-console/src/main/js/controllers/igfs-controller.js
+++ b/modules/web-console/src/main/js/controllers/igfs-controller.js
@@ -184,14 +184,14 @@ consoleModule.controller('igfsController', [
                 }
 
                 $scope.$watch('ui.inputForm.$valid', function(valid) {
-                    if (valid && __original_value === JSON.stringify($cleanup($scope.backupItem)))
+                    if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem)))
                         $scope.ui.inputForm.$dirty = false;
                 });
 
                 $scope.$watch('backupItem', function(val) {
                     const form = $scope.ui.inputForm;
 
-                    if (form.$pristine || (form.$valid && __original_value === JSON.stringify($cleanup(val))))
+                    if (form.$pristine || (form.$valid && _.isEqual(__original_value,
$cleanup(val))))
                         form.$setPristine();
                     else
                         form.$setDirty();
@@ -231,7 +231,7 @@ consoleModule.controller('igfsController', [
 
                 $scope.backupItem = angular.merge({}, blank, $scope.backupItem);
 
-                __original_value = JSON.stringify($cleanup($scope.backupItem));
+                __original_value = $cleanup($scope.backupItem);
 
                 if ($common.getQueryVariable('new'))
                     $state.go('base.configuration.igfs');


Mime
View raw message