Jelajahi Sumber

AMBARI-11405. Hitting Return key should save value on property edit textbox

Srimanth Gunturi 10 tahun lalu
induk
melakukan
57579be4f8

+ 1 - 1
ambari-web/app/templates/common/configs/widgets/plain_config_text_field.hbs

@@ -17,6 +17,6 @@
 }}
 
 <div class="input-append">
-  {{view Em.TextField valueBinding="view.value" class="span9" placeholderBinding="view.placeholder" disabledBinding="view.disabled"}}
+  {{view App.ConfigTextField valueBinding="view.value" class="span9" placeholderBinding="view.placeholder" disabledBinding="view.disabled"}}
   <span {{bindAttr class=":add-on view.unit::hidden"}}>{{view.displayUnit}}</span>
 </div>

+ 1 - 0
ambari-web/app/views.js

@@ -53,6 +53,7 @@ require('views/common/configs/compare_property_view');
 require('views/common/configs/config_history_flow');
 require('views/common/configs/selectable_popup_body_view');
 require('views/common/configs/custom_category_views/notification_configs_view');
+require('views/common/configs/widgets/config_text_field');
 require('views/common/configs/widgets/plain_config_text_field');
 require('views/common/configs/widgets/config_widget_view');
 require('views/common/configs/widgets/checkbox_config_widget_view');

+ 25 - 0
ambari-web/app/views/common/configs/widgets/config_text_field.js

@@ -0,0 +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.
+ */
+
+var App = require('app');
+
+App.ConfigTextField = Ember.TextField.extend({
+  insertNewline: function() {
+    this.get('parentView').trigger('insertNewline');
+  }
+});

+ 4 - 0
ambari-web/app/views/common/configs/widgets/plain_config_text_field.js

@@ -46,6 +46,10 @@ App.PlainConfigTextField = Ember.View.extend(App.SupportsDependentConfigs, {
     this.sendRequestRorDependentConfigs(this.get('serviceConfig'));
   },
 
+  insertNewline: function() {
+    this.get('parentView').trigger('toggleWidgetView');
+  },
+
   didInsertElement: function() {
     this._super();
     this.set('serviceConfig.displayType', Em.getWithDefault(this, 'serviceConfig.stackConfigProperty.valueAttributes.type', 'string'));