You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2016/02/03 11:56:56 UTC
[31/50] ignite git commit: IGNITE-843 Implemented output of form
validation errors on save.
IGNITE-843 Implemented output of form validation errors on save.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/544164c0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/544164c0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/544164c0
Branch: refs/heads/ignite-843-rc3
Commit: 544164c04951b80b3942c4911c497a638b4f2ec5
Parents: 9cf1c03
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Feb 2 17:19:00 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Feb 2 17:19:00 2016 +0700
----------------------------------------------------------------------
.../form-field-java-class.jade | 31 +++++++++++++----
.../field/form-control-feedback.directive.js | 36 ++++++++++++++++++++
.../js/app/modules/Form/field/input/number.jade | 26 ++++++--------
.../src/main/js/app/modules/Form/index.js | 2 ++
.../states/configuration/clusters/atomic.jade | 6 +++-
.../configuration/clusters/deployment.jade | 7 +++-
.../main/js/controllers/clusters-controller.js | 20 +----------
.../src/main/js/views/base.jade | 16 +++++++++
.../src/main/js/views/templates/dropdown.jade | 16 +++++++++
9 files changed, 117 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/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 2f94234..3e5b1c4 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,8 +1,25 @@
+//-
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
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='"{{ label.name }}#{message}"'
+ bs-tooltip='"{{ label.name }} #{message}"'
+ ignite-error='#{error}'
+ ignite-error-message='{{ label.name }} #{message}'
)
div
@@ -29,8 +46,8 @@ div
)
span(ng-transclude)
- +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!')
+ +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/544164c0/modules/control-center-web/src/main/js/app/modules/Form/field/form-control-feedback.directive.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/field/form-control-feedback.directive.js b/modules/control-center-web/src/main/js/app/modules/Form/field/form-control-feedback.directive.js
new file mode 100644
index 0000000..ba3e7fe
--- /dev/null
+++ b/modules/control-center-web/src/main/js/app/modules/Form/field/form-control-feedback.directive.js
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default ['formControlFeedback', [() => {
+ const link = ($scope, $element, $attrs, [form]) => {
+ const name = $scope.name;
+ const err = $attrs.igniteError;
+ const msg = $attrs.igniteErrorMessage;
+
+ if (name && err && msg) {
+ form.$errorMessages = form.$errorMessages || {};
+ form.$errorMessages[name] = form.$errorMessages[name] || {};
+ form.$errorMessages[name][err] = msg;
+ }
+ };
+
+ return {
+ restrict: 'C',
+ link,
+ require: ['^form']
+ };
+}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/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 8b4c7df..1e77046 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
@@ -14,6 +14,14 @@
See the License for the specific language governing permissions and
limitations under the License.
+mixin feedback(error, message)
+ i.fa.fa-exclamation-triangle.form-control-feedback(
+ ng-show='field.$error.#{error}'
+ bs-tooltip='"#{message}"'
+ ignite-error='#{error}'
+ ignite-error-message='#{message}'
+ )
+
.input-tip
input.form-control(
id='{{ id }}'
@@ -28,20 +36,8 @@
data-ng-disabled='disabled || false'
)
- 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-init='form[name].$errorMessages.max = "Value is more than allowable maximum"'
- ng-show='field.$error.max'
- bs-tooltip='"Value is more than allowable maximum"'
- )
+ +feedback('min', 'Value is less than allowable minimum')
+ +feedback('max', 'Value is more than allowable maximum')
+ +feedback('number', 'Invalid value. Only numbers allowed')
- i.fa.fa-exclamation-triangle.form-control-feedback(
- 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/544164c0/modules/control-center-web/src/main/js/app/modules/Form/index.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/Form/index.js b/modules/control-center-web/src/main/js/app/modules/Form/index.js
index 2650e48..aac831d 100644
--- a/modules/control-center-web/src/main/js/app/modules/Form/index.js
+++ b/modules/control-center-web/src/main/js/app/modules/Form/index.js
@@ -49,6 +49,7 @@ import unique from './validator/unique.directive';
import igniteFormFieldInputAutofocus from './field/input/autofocus.directive';
import igniteFormFieldUp from './field/up.directive';
import igniteFormFieldDown from './field/down.directive';
+import igniteFormControlFeedback from './field/form-control-feedback.directive';
angular
.module('ignite-console.Form', [
@@ -82,6 +83,7 @@ angular
.directive(...igniteFormFieldInputAutofocus)
.directive(...igniteFormFieldUp)
.directive(...igniteFormFieldDown)
+.directive(...igniteFormControlFeedback)
// Generator of globally unique identifier.
.factory('IgniteFormGUID', [() => {
let guid = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
index 525c79c..d3ddc91 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
@@ -39,7 +39,11 @@ form.panel.panel-default(name='atomics' novalidate)
ignite-form-field-dropdown(
data-id='cacheMode'
data-name='cacheMode'
- data-options='cacheModes'
+ data-options='[\
+ {value: "LOCAL", label: "LOCAL"},\
+ {value: "REPLICATED", label: "REPLICATED"},\
+ {value: "PARTITIONED", label: "PARTITIONED"}\
+ ]'
data-ng-model='#{model}.cacheMode'
data-placeholder='PARTITIONED'
)
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/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 17ddcd9..74fdc32 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
@@ -51,7 +51,12 @@ form.panel.panel-default(name='#{form}' novalidate)
ignite-form-field-dropdown(
data-id='deploymentMode'
data-name='deploymentMode'
- data-options='deploymentModes'
+ data-options='[\
+ {value: "PRIVATE", label: "PRIVATE"},\
+ {value: "ISOLATED", label: "ISOLATED"}, \
+ {value: "SHARED", label: "SHARED"},\
+ {value: "CONTINUOUS", label: "CONTINUOUS"}\
+ ]'
data-ng-model='#{model}.deploymentMode'
data-placeholder='SHARED'
)
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/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 b224584..56a86d8 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
@@ -101,24 +101,6 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
sslConfiguration: {xml: '', java: '', allDefaults: true}
};
- $scope.cacheModes = $common.mkOptions(['LOCAL', 'REPLICATED', 'PARTITIONED']);
-
- $scope.deploymentModes = $common.mkOptions(['PRIVATE', 'ISOLATED', 'SHARED', 'CONTINUOUS']);
-
- $scope.transactionConcurrency = $common.mkOptions(['OPTIMISTIC', 'PESSIMISTIC']);
-
- $scope.transactionIsolation = $common.mkOptions(['READ_COMMITTED', 'REPEATABLE_READ', 'SERIALIZABLE']);
-
- $scope.segmentationPolicy = $common.mkOptions(['RESTART_JVM', 'STOP', 'NOOP']);
-
- $scope.marshallers = $common.mkOptions(['OptimizedMarshaller', 'JdkMarshaller', undefined]);
-
- $scope.sslKeyAlgorithms = ['SumX509', 'X509'];
-
- $scope.sslStoreType = ['JKS', 'PCKS11', 'PCKS12'];
-
- $scope.sslProtocols = ['TSL', 'SSL'];
-
$scope.toggleExpanded = function () {
$scope.ui.expanded = !$scope.ui.expanded;
@@ -377,7 +359,7 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
var msg = 'Invalid value';
try {
- msg = form[firstError.$name].$error[firstErrorKey][0].$errorMessages[firstErrorKey];
+ msg = form[firstError.$name].$errorMessages[actualError.$name][firstErrorKey];
}
catch(ignored) {
msg = 'Invalid value';
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/modules/control-center-web/src/main/js/views/base.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/base.jade b/modules/control-center-web/src/main/js/views/base.jade
index 1ba3a24..a910d1b 100644
--- a/modules/control-center-web/src/main/js/views/base.jade
+++ b/modules/control-center-web/src/main/js/views/base.jade
@@ -1,3 +1,19 @@
+//-
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
include includes/header
.container.body-container
http://git-wip-us.apache.org/repos/asf/ignite/blob/544164c0/modules/control-center-web/src/main/js/views/templates/dropdown.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/dropdown.jade b/modules/control-center-web/src/main/js/views/templates/dropdown.jade
index 6ebfe63..96cc43d 100644
--- a/modules/control-center-web/src/main/js/views/templates/dropdown.jade
+++ b/modules/control-center-web/src/main/js/views/templates/dropdown.jade
@@ -1,3 +1,19 @@
+//-
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
ul.dropdown-menu(tabindex='-1' role='menu' ng-show='content && content.length')
li(role='presentation' ui-sref-active='active' ng-class='{divider: item.divider, active: item.active, custom: item.custom}' ng-repeat='item in content')
a(role='menuitem' tabindex='-1' ui-sref='{{item.sref}}' ng-if='!item.divider && item.sref' ng-bind='item.text')