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 Show more informative error messages on save.
Date Mon, 01 Feb 2016 10:05:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 439fb31e2 -> f4fc002c4


IGNITE-843 Show more informative error messages on save.


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

Branch: refs/heads/ignite-843-rc2
Commit: f4fc002c4635eebafd7e7589cf453ae9d42196f6
Parents: 439fb31
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Mon Feb 1 17:05:31 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Mon Feb 1 17:05:31 2016 +0700

----------------------------------------------------------------------
 .../form-field-java-class.jade                  | 13 ++++++-----
 .../js/app/modules/Form/field/input/number.jade |  7 ++++--
 .../main/js/controllers/caches-controller.js    |  2 +-
 .../main/js/controllers/clusters-controller.js  | 24 +++++++++++++++-----
 .../src/main/js/controllers/common-module.js    |  1 +
 5 files changed, 32 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f4fc002c/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.jade
b/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.jade
index 58c60da..2f94234 100644
--- a/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.jade
+++ b/modules/control-center-web/src/main/js/app/directives/form-field-java-class/form-field-java-class.jade
@@ -1,7 +1,8 @@
 mixin feedback(error, message)
     i.fa.fa-exclamation-triangle.form-control-feedback(
+        ng-init='form[name].$errorMessages.#{error} = label.name + "#{message}"'
         ng-if='!form[name].$pristine && form[name].$error.#{error}'
-        bs-tooltip='"#{message}"'
+        bs-tooltip='"{{ label.name }}#{message}"'
     )
 
 div
@@ -28,8 +29,8 @@ div
     )
         span(ng-transclude)
 
-        +feedback('javaIdentifier', '{{ label.name }} is invalid!')
-        +feedback('required', '{{ label.name }} could not be empty!')
-        +feedback('javaKeywords', '{{ label.name }} could not contains reserved Java keyword!')
-        +feedback('javaBuiltInClass', '{{ label.name }} should not be the Java built-in class!')
-        +feedback('javaPackageSpecified', '{{ label.name }} does not have package specified!')
+        +feedback('javaIdentifier', ' is invalid Java identifier!')
+        +feedback('required', ' could not be empty!')
+        +feedback('javaKeywords', ' could not contains reserved Java keyword!')
+        +feedback('javaBuiltInClass', ' should not be the Java built-in class!')
+        +feedback('javaPackageSpecified', ' does not have package specified!')

http://git-wip-us.apache.org/repos/asf/ignite/blob/f4fc002c/modules/control-center-web/src/main/js/app/modules/Form/field/input/number.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/field/input/number.jade
b/modules/control-center-web/src/main/js/app/modules/Form/field/input/number.jade
index 58a2f16..8b4c7df 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/field/input/number.jade
+++ b/modules/control-center-web/src/main/js/app/modules/Form/field/input/number.jade
@@ -29,16 +29,19 @@
     )
 
     i.fa.fa-exclamation-triangle.form-control-feedback(
+        ng-init='form[name].$errorMessages.min = "Value is less than allowable minimum"'
         ng-show='field.$error.min'
         bs-tooltip='"Value is less than allowable minimum"'
     )
     i.fa.fa-exclamation-triangle.form-control-feedback(
-        ng-show='field.$error.max' 
+        ng-init='form[name].$errorMessages.max = "Value is more than allowable maximum"'
+        ng-show='field.$error.max'
         bs-tooltip='"Value is more than allowable maximum"'
     )
 
     i.fa.fa-exclamation-triangle.form-control-feedback(
-        ng-show='field.$error.number' 
+        ng-init='form[name].$errorMessages.number = "Invalid value. Only numbers allowed"'
+        ng-show='field.$error.number'
         bs-tooltip='"Invalid value. Only numbers allowed"'
     )
     span(ng-transclude='')

http://git-wip-us.apache.org/repos/asf/ignite/blob/f4fc002c/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 eadceac..1346bd8 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
@@ -563,7 +563,7 @@ consoleModule.controller('cachesController', [
 
                         if (_.findIndex(domains, $common.domainForStoreConfigured) < 0)
                             return showPopoverMessage($scope.ui, 'general', 'domains',
-                                'Cache with configured JDBC POJO store factory should be
associated with at least one domain model for cache store');
+                                'Cache with configured JDBC POJO store factory should be
associated with at least one domain model for cache store', 10000);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f4fc002c/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 69586f1..f3ae1e1 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
@@ -194,10 +194,12 @@ 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();
+                    var form = $scope.ui.inputForm;
+
+                    if (form.$pristine || (form.$valid && __original_value === JSON.stringify(val)))
+                        form.$setPristine();
+                    else
+                        form.$setDirty();
 
                     if (val) {
                         var clusterCaches = _.reduce($scope.caches, function(caches, cache){
@@ -365,7 +367,8 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
             if ($common.isEmptyString(item.name))
                 return showPopoverMessage($scope.ui, 'general', 'clusterName', 'Name should
not be empty');
 
-            var errors = $scope.ui.inputForm.$error;
+            var form = $scope.ui.inputForm;
+            var errors = form.$error;
             var errKeys = Object.keys(errors);
 
             if (errKeys && errKeys.length > 0) {
@@ -374,7 +377,16 @@ consoleModule.controller('clustersController', function ($http, $timeout,
$scope
                 var firstError = errors[firstErrorKey][0];
                 var actualError = firstError.$error[firstErrorKey][0];
 
-                return showPopoverMessage($scope.ui, firstError.$name, actualError.$name,
'Invalid value');
+                var msg = 'Invalid value';
+
+                try {
+                    msg = form[firstError.$name].$error[firstErrorKey][0].$errorMessages[firstErrorKey];
+                }
+                catch(ignored) {
+                    msg = 'Invalid value';
+                }
+
+                return showPopoverMessage($scope.ui, firstError.$name, actualError.$name,
msg);
             }
 
             var caches = _.filter(_.map($scope.caches, function (scopeCache) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f4fc002c/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 3e5cf07..0e37898 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
@@ -1012,6 +1012,7 @@ consoleModule.service('$common', [
                     ready: false,
                     expanded: false,
                     groups: [],
+                    errors: {},
                     addGroups: function (general, advanced) {
                         if (general)
                             $.merge(this.groups, general);


Mime
View raw message