You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/05/22 16:37:29 UTC
ambari git commit: AMBARI-11341. Configs: when defining an override
for a property,
it goes into "Edit" mode and cannot switch back to the normal mode
(onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk f9977c269 -> a2dcc044c
AMBARI-11341. Configs: when defining an override for a property, it goes into "Edit" mode and cannot switch back to the normal mode (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a2dcc044
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a2dcc044
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a2dcc044
Branch: refs/heads/trunk
Commit: a2dcc044c70459295e258cb8f084290bcc8bc6f8
Parents: f9977c2
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri May 22 17:34:14 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri May 22 17:34:14 2015 +0300
----------------------------------------------------------------------
.../configs/widgets/config_widget_view.js | 11 ++-
.../widgets/time_interval_spinner_view_test.js | 93 ++++++++++++++++++++
2 files changed, 103 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a2dcc044/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 1d7e80d..a9f2b35 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -101,6 +101,15 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
isOriginalSCPBinding: 'config.isOriginalSCP',
/**
+ * Check if property validation failed for overridden property in case when its value is equal to parent
+ * config property.
+ * @type {boolean}
+ */
+ isOverrideEqualityError: function() {
+ return this.get('config.parentSCP') && this.get('config.parentSCP.value') == this.get('config.value');
+ }.property('config.isValid'),
+
+ /**
* Alias to <code>config.isComparison</code>
* Should be used in the templates
* Don't use original <code>config.isComparison</code> in the widget-templates!!!
@@ -384,7 +393,7 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
* @returns {boolean}
*/
isValueCompatibleWithWidget: function() {
- return this.get('config.isValid');
+ return (this.get('isOverrideEqualityError') && !this.get('config.isValid')) || this.get('config.isValid');
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/a2dcc044/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
index 682a717..37269a8 100644
--- a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
@@ -294,4 +294,97 @@ describe('App.TimeIntervalSpinnerView', function () {
});
});
+ describe('#showAsTextBox', function() {
+ Em.A([
+ {
+ config: App.ServiceConfigProperty.create({
+ value: "600",
+ isValid: true,
+ stackConfigProperty: Em.Object.create({
+ widget: {
+ units: [
+ { unit: "hours,minutes" }
+ ]
+ },
+ valueAttributes: {type: "int", maximum: "86400", minimum: "600", unit: "seconds"}
+ })
+ }),
+ m: 'original config with valid value should be shown as widget',
+ e: false
+ },
+ {
+ config: App.ServiceConfigProperty.create({
+ value: "test",
+ isValid: true,
+ stackConfigProperty: Em.Object.create({
+ widget: {
+ units: [
+ { unit: "hours,minutes" }
+ ]
+ },
+ valueAttributes: {type: "int", maximum: "86400", minimum: "600", unit: "seconds"}
+ })
+ }),
+ m: 'original config with invalid value should be shown as textbox',
+ e: true
+ },
+ {
+ config: App.ServiceConfigProperty.create({
+ value: "600",
+ isValid: true,
+ stackConfigProperty: Em.Object.create({
+ widget: {
+ units: [
+ { unit: "hours,minutes" }
+ ]
+ },
+ valueAttributes: {type: "int", maximum: "86400", minimum: "600", unit: "seconds"}
+ }),
+ parentSCP: Em.Object.create({ value: "600" })
+ }),
+ m: 'overriden config have same value as original and values of both configs are valid, widget should be shown',
+ e: false
+ },
+ {
+ config: App.ServiceConfigProperty.create({
+ value: "test",
+ isValid: true,
+ stackConfigProperty: Em.Object.create({
+ widget: {
+ units: [
+ { unit: "hours,minutes" }
+ ]
+ },
+ valueAttributes: {type: "int", maximum: "86400", minimum: "600", unit: "seconds"}
+ }),
+ parentSCP: Em.Object.create({ value: "test" })
+ }),
+ m: 'overriden config have same value as original and values of both configs are NOT valid, textbox should be shown',
+ e: true
+ },
+ {
+ config: App.ServiceConfigProperty.create({
+ value: "test",
+ isValid: true,
+ stackConfigProperty: Em.Object.create({
+ widget: {
+ units: [
+ { unit: "hours,minutes" }
+ ]
+ },
+ valueAttributes: {type: "int", maximum: "86400", minimum: "600", unit: "seconds"}
+ }),
+ parentSCP: Em.Object.create({ value: "500" })
+ }),
+ m: 'overriden config have different value as original and values of override NOT valid, textbox should be shown',
+ e: true
+ }
+ ]).forEach(function (test) {
+ it(test.m, function() {
+ view.set('config', test.config);
+ view.didInsertElement();
+ expect(view.get('config.showAsTextBox')).to.eql(test.e);
+ });
+ });
+ });
});