AMBARI-10934. Show unit if available for raw value textfield (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7492c33d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7492c33d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7492c33d Branch: refs/heads/trunk Commit: 7492c33dd232650e11f155b5d87739dc4ad8038e Parents: 0dbb705 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Tue May 5 18:27:14 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Tue May 5 18:27:14 2015 +0300 ---------------------------------------------------------------------- .../configs/widgets/plain_config_text_field.hbs | 22 ++++++++++++++++++++ .../configs/widgets/plain_config_text_field.js | 9 +++++--- ambari-web/app/views/common/controls_view.js | 4 +++- 3 files changed, 31 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7492c33d/ambari-web/app/templates/common/configs/widgets/plain_config_text_field.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/widgets/plain_config_text_field.hbs b/ambari-web/app/templates/common/configs/widgets/plain_config_text_field.hbs new file mode 100644 index 0000000..b2e47ca --- /dev/null +++ b/ambari-web/app/templates/common/configs/widgets/plain_config_text_field.hbs @@ -0,0 +1,22 @@ +{{! +* 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. +}} + +<div class="input-append"> + {{view Em.TextField valueBinding="view.value" class="span9" placeholderBinding="view.placeholder"}} + <span {{bindAttr class=":add-on view.unit::hidden"}}>{{view.unit}}</span> +</div> http://git-wip-us.apache.org/repos/asf/ambari/blob/7492c33d/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js index a3707bd..8b2b911 100644 --- a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js +++ b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js @@ -24,11 +24,14 @@ var App = require('app'); require('views/common/controls_view'); -App.PlainConfigTextField = Ember.TextField.extend(App.SupportsDependentConfigs, { - +App.PlainConfigTextField = Ember.View.extend(App.SupportsDependentConfigs, { + templateName: require('templates/common/configs/widgets/plain_config_text_field'), valueBinding: 'serviceConfig.value', - classNames: ['span10'], + classNames: ['span10', 'widget-config-plain-text-field'], placeholderBinding: 'serviceConfig.defaultValue', + unit: function() { + return Em.getWithDefault(this, 'serviceConfig.stackConfigProperty.valueAttributes.unit', false); + }.property('serviceConfig.stackConfigProperty.valueAttributes.unit'), focusOut: function () { this.sendRequestRorDependentConfigs(this.get('serviceConfig')); http://git-wip-us.apache.org/repos/asf/ambari/blob/7492c33d/ambari-web/app/views/common/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js index 641445a..1fb4cf8 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -177,7 +177,9 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp //Set editDone false for all current category config text field parameter focusIn: function () { if (!this.get('serviceConfig.isOverridden') && !this.get('serviceConfig.isComparison')) { - this.get("parentView.categoryConfigsAll").setEach("editDone", false); + if (this.get('parentView.categoryConfigsAll')) { + this.get("parentView.categoryConfigsAll").setEach("editDone", false); + } } },