Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B5802188BE for ; Mon, 1 Feb 2016 10:05:27 +0000 (UTC) Received: (qmail 74859 invoked by uid 500); 1 Feb 2016 10:05:27 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 74824 invoked by uid 500); 1 Feb 2016 10:05:27 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 74815 invoked by uid 99); 1 Feb 2016 10:05:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 10:05:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7874FDFE61; Mon, 1 Feb 2016 10:05:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akuznetsov@apache.org To: commits@ignite.apache.org Message-Id: <93061ccdd909488c8dd6c34661f60b10@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-843 Show more informative error messages on save. Date: Mon, 1 Feb 2016 10:05:27 +0000 (UTC) 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 Authored: Mon Feb 1 17:05:31 2016 +0700 Committer: Alexey Kuznetsov 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);