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-2487 Fixed.
Date Mon, 01 Feb 2016 08:16:10 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 526241af1 -> 7e3cc27ae


IGNITE-2487 Fixed.


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

Branch: refs/heads/ignite-843-rc2
Commit: 7e3cc27aeda546558f37eb543775fb5ec16678c2
Parents: 526241a
Author: Dmitriyff <dmitriyff@gmail.com>
Authored: Mon Feb 1 15:16:14 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Mon Feb 1 15:16:14 2016 +0700

----------------------------------------------------------------------
 .../modules/Form/field/input/text.directive.js  | 35 ++++++++++++--------
 .../js/app/modules/Form/field/input/text.jade   | 16 ++++-----
 .../app/modules/Form/group/group.directive.js   | 30 ++++++++++-------
 .../modules/Form/validator/unique.directive.js  | 11 ++----
 .../states/configuration/clusters/binary.jade   |  2 +-
 .../configuration/clusters/deployment.jade      |  2 +-
 .../clusters/general/discovery/cloud.jade       |  6 ++--
 .../clusters/general/discovery/multicast.jade   |  4 +--
 .../clusters/general/discovery/vm.jade          |  4 +--
 .../states/configuration/clusters/ssl.jade      |  4 +--
 10 files changed, 61 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.directive.js
b/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.directive.js
index 65c744d..1cb8e92 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.directive.js
+++ b/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.directive.js
@@ -19,14 +19,13 @@ import template from './text.jade!';
 import './text.css!';
 
 export default ['igniteFormFieldInputText', ['IgniteFormGUID', (guid) => {
-    const link = (scope, el, attrs, [form, label]) => {
+    const link = (scope, el, attrs, [ngModel, form, label]) => {
         const {id, name} = scope;
-        const field = form[name];
 
-        scope.form = form;
-        scope.field = field;
         label.for = scope.id = id || guid();
 
+        scope.label = label;
+        scope.ngModel = ngModel;
         scope.$watch('required', (required) => {
             label.required = required || false;
         });
@@ -43,6 +42,24 @@ export default ['igniteFormFieldInputText', ['IgniteFormGUID', (guid) =>
{
 
         scope.$watch(() => form.$pristine, setAsDefault);
         scope.$watch('value', setAsDefault);
+
+        scope.ngChange = function() {
+            ngModel.$setViewValue(scope.value);
+
+            if (JSON.stringify(scope.value) !== JSON.stringify(form.$defaults[name]))
+                ngModel.$setDirty();
+            else
+                ngModel.$setPristine();
+
+            if (ngModel.$valid)
+                el.find('input').addClass('ng-valid').removeClass('ng-invalid');
+            else
+                el.find('input').removeClass('ng-valid').addClass('ng-invalid');
+        };
+
+        ngModel.$render = function() {
+            scope.value = ngModel.$modelValue;
+        };
     };
 
     return {
@@ -51,25 +68,17 @@ export default ['igniteFormFieldInputText', ['IgniteFormGUID', (guid)
=> {
             id: '@',
             name: '@',
             placeholder: '@',
-            unique: '=igniteUnique',
             required: '=ngRequired',
             disabled: '=ngDisabled',
 
-            value: '=ngModel',
             ngBlur: '&',
 
-            javaKeywords: '=',
-            javaIdentifier: '=',
-            javaPackageSpecified: '=',
-            javaBuiltInClass: '=',
-            javaPackageName: '=',
-
             autofocus: '=igniteFormFieldInputAutofocus'
         },
         link,
         template,
         replace: true,
         transclude: true,
-        require: ['^form', '?^igniteFormField']
+        require: ['ngModel', '^form', '?^igniteFormField']
     };
 }]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.jade
b/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.jade
index 5ce3c51..9bf6bff 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.jade
+++ b/modules/control-center-web/src/main/js/app/modules/Form/field/input/text.jade
@@ -17,23 +17,21 @@
 .input-tip
     input.form-control(
         id='{{ id }}'
-        name='{{ name }}' 
         placeholder='{{ placeholder }}' 
         type='text' 
 
         data-ng-model='value'
+        data-ng-blur='ngBlur()'
+        data-ng-change='ngChange()'
         data-ng-required='required || false'
         data-ng-disabled='disabled || false'
-        data-ng-blur='ngBlur()'
-
-        data-java-keywords='{{ javaKeywords }}'
-        data-java-identifier='{{ javaIdentifier }}'
-        data-java-package-specified='{{ javaPackageSpecified }}'
-        data-java-built-in-class='{{ javaBuiltInClass }}'
-        data-java-package-name='{{ javaPackageName }}'
 
-        data-ignite-unique='unique'
         data-ignite-form-field-input-autofocus='autofocus || false'
     )
 
+    i.fa.fa-exclamation-triangle.form-control-feedback(
+        ng-if='!ngModel.$pristine && ngModel.$error.required'
+        bs-tooltip='"{{ label.name }} could not be empty!"'
+    )
+
     span(ng-transclude='')

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/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 1195f27..f64e17a 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
@@ -20,25 +20,32 @@ import template from './group.jade!';
 export default ['igniteFormGroup', [() => {
     const controller = [function() { }];
 
-    const link = (scope, el, attrs, [form]) => {
-        const {name} = scope;
+    const link = (scope, el, attrs, [ngModelCtrl, ownFormCtrl, parentFormCtrl]) => {
+        const name = attrs.ngForm;
 
-        form.$defaults = form.$defaults || {};
-        form.$defaults[name] = _.cloneDeep(scope.value);
+        ngModelCtrl.$name = name;
+
+        parentFormCtrl.$addControl(ngModelCtrl);
+        parentFormCtrl.$removeControl(ownFormCtrl);
+
+        parentFormCtrl.$defaults = parentFormCtrl.$defaults || {};
+        parentFormCtrl.$defaults[name] = _.cloneDeep(scope.value);
 
         const setAsDefault = () => {
-            if (!form.$pristine) return;
+            if (!parentFormCtrl.$pristine) return;
 
-            form.$defaults = form.$defaults || {};
-            form.$defaults[name] = _.cloneDeep(scope.value);
+            parentFormCtrl.$defaults = parentFormCtrl.$defaults || {};
+            parentFormCtrl.$defaults[name] = _.cloneDeep(scope.value);
         };
 
         const setAsDirty = () => {
-            if (JSON.stringify(scope.value) !== JSON.stringify(form.$defaults[name]))
-                form.$setDirty();
+            if (JSON.stringify(scope.value) !== JSON.stringify(parentFormCtrl.$defaults[name]))
+                ngModelCtrl.$setDirty();
+            else
+                ngModelCtrl.$setPristine();
         };
 
-        scope.$watch(() => form.$pristine, setAsDefault);
+        scope.$watch(() => parentFormCtrl.$pristine, setAsDefault);
 
         scope.$watch('value', setAsDefault);
         scope.$watch('value', setAsDirty, true);
@@ -47,7 +54,6 @@ export default ['igniteFormGroup', [() => {
     return {
         restrict: 'E',
         scope: {
-            name: '@',
             value: '=ngModel'
         },
         bindToController: {
@@ -59,6 +65,6 @@ export default ['igniteFormGroup', [() => {
         controllerAs: 'group',
         replace: true,
         transclude: true,
-        require: ['^form', '?^igniteFormField']
+        require: ['ngModel', '?form', '^^form']
     };
 }]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/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 8074071..0d0488e 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,20 +20,15 @@ export default ['igniteUnique', ['$parse', ($parse) => {
         if (typeof attrs.igniteUnique === 'undefined' || !attrs.igniteUnique)
             return;
 
-        ngModel.$validators.igniteUnique = (value, old) => {
+        ngModel.$validators.igniteUnique = (value) => {
             let idx;
             const arr = $parse(attrs.igniteUnique)(scope);
 
             // Return true in case if array not exist, array empty, or value is unique.
-            if (!arr || !arr.length || !~(idx = 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;
+            return !!(_.isNumber(scope.$index) && scope.$index === idx);
         };
     };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/binary.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/binary.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/binary.jade
index 67ebcac..ccefd20 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/binary.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/binary.jade
@@ -51,7 +51,7 @@ form.panel.panel-default(name='binary' novalidate)
                             data-ng-model='#{model}.serializer'
                         )
                 .settings-row
-                    ignite-form-group(name='typeConfigurations' ng-model='#{types}')
+                    ignite-form-group(ng-form='typeConfigurations' ng-model='#{types}')
                         ignite-form-field-label
                             | Type configurations
                         ignite-form-group-tooltip

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/deployment.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/deployment.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/deployment.jade
index b22eae6..d563ee3 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/deployment.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/deployment.jade
@@ -93,7 +93,7 @@ form.panel.panel-default(name='#{form}' novalidate)
                             data-ng-disabled='!#{enabled}'
                         )
                 .settings-row
-                    ignite-form-group(ng-init='__ = {};' ng-model='#{exclude}' name='peerClassLoadingLocalClassPathExclude'
)
+                    ignite-form-group(ng-init='__ = {};' ng-model='#{exclude}' ng-form='peerClassLoadingLocalClassPathExclude'
)
                         ignite-form-field-label
                             | Local class path exclude
                         ignite-form-group-tooltip

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/cloud.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/cloud.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/cloud.jade
index 2088533..a7834cf 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/cloud.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/cloud.jade
@@ -17,7 +17,7 @@
 - var model = 'backupItem.discovery.Cloud';
 - var regions = model + '.regions';
 - var zones = model + '.zones';
-- var form = 'general'
+- var form = 'generalDiscoveryCloudRegions'
 
 div
     .details-row
@@ -70,7 +70,7 @@ div
                 data-ng-required='true'
             )
     .details-row(ng-if='true')
-        ignite-form-group(ng-init='__ = {};' ng-model='#{regions}' name='generalDiscoveryCloudRegions')
+        ignite-form-group(ng-init='__ = {};' ng-model='#{regions}' ng-form='generalDiscoveryCloudRegions')
             ignite-form-field-label
                 | Regions
             ignite-form-group-tooltip
@@ -153,7 +153,7 @@ div
             .group-content-empty(ng-if='!(#{regions}.length) && !__.add.length')
                 | Not defined
     .details-row(ng-if='true')
-         ignite-form-group(ng-init='__ = {};' ng-model='#{zones}' name='generalDiscoveryCloudZones')
+         ignite-form-group(ng-init='__ = {};' ng-model='#{zones}' ng-form='generalDiscoveryCloudZones')
             ignite-form-field-label
                 | Zones
             ignite-form-group-tooltip

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/multicast.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/multicast.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/multicast.jade
index 2068fe7..b227e14 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/multicast.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/multicast.jade
@@ -16,7 +16,7 @@
 
 - var model = 'backupItem.discovery.Multicast';
 - var addresses = model + '.addresses';
-- var form = 'general';
+- var form = 'discoveryMulticastAddresses';
 
 div
     .details-row
@@ -83,7 +83,7 @@ div
                 data-ng-model='#{model}.localAddress'
             )
     .details-row
-        ignite-form-group(ng-init='__ = {};' ng-model='#{addresses}' name='discoveryMulticastAddresses')
+        ignite-form-group(ng-init='__ = {};' ng-model='#{addresses}' ng-form='discoveryMulticastAddresses')
             ignite-form-field-label
                 | Addresses
             ignite-form-group-tooltip

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
index 766bc77..a484a83 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/general/discovery/vm.jade
@@ -16,10 +16,10 @@
 
 - var model = 'backupItem.discovery.Vm';
 - var addresses = model + '.addresses';
-- var form = 'general';
+- var form = 'discoveryVmAddresses';
 
 div
-    ignite-form-group(ng-init='__ = {};' ng-model='#{addresses}' name='discoveryVmAddresses')
+    ignite-form-group(ng-init='__ = {};' ng-model='#{addresses}' ng-form='discoveryVmAddresses')
         ignite-form-field-label
             | Addresses
         ignite-form-group-tooltip

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e3cc27a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/ssl.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/ssl.jade
b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/ssl.jade
index 3d2e6b9..15b27a9 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/ssl.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/ssl.jade
@@ -18,7 +18,7 @@
 - var enabled = 'backupItem.sslEnabled'
 - var model = cluster + '.sslContextFactory'
 - var trust = model + '.trustManagers'
-- var form = 'sslContextFactory'
+- var form = 'trustManagers'
 
 mixin feedback(field, error, message)
     i.fa.fa-exclamation-triangle.form-control-feedback(
@@ -111,7 +111,7 @@ form.panel.panel-default(name='#{form}' novalidate)
                         )
 
                 .settings-row
-                    ignite-form-group(ng-init='__ = {};' name='trustManagers' ng-model='#{trust}')
+                    ignite-form-group(ng-init='__ = {};' ng-form='trustManagers' ng-model='#{trust}')
                         ignite-form-field-label
                             | Trust managers
                         ignite-form-group-tooltip


Mime
View raw message