You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/03/30 21:11:59 UTC

ambari git commit: AMBARI-10284. Implement radio-buttons widget for config (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 804577346 -> 2b43a272c


AMBARI-10284. Implement radio-buttons widget for config (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b43a272
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b43a272
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b43a272

Branch: refs/heads/trunk
Commit: 2b43a272c2fed8e36565f2e6727cd1fd0760cab1
Parents: 8045773
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Mar 30 21:59:07 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Mar 30 22:11:55 2015 +0300

----------------------------------------------------------------------
 .../configs/widgets/radio_button_config.hbs     | 33 ++++++++++++++
 ambari-web/app/views.js                         |  1 +
 .../configs/service_config_layout_tab_view.js   | 11 ++++-
 .../widgets/radio_button_config_widget_view.js  | 48 ++++++++++++++++++++
 4 files changed, 92 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2b43a272/ambari-web/app/templates/common/configs/widgets/radio_button_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/widgets/radio_button_config.hbs b/ambari-web/app/templates/common/configs/widgets/radio_button_config.hbs
new file mode 100644
index 0000000..fd23429
--- /dev/null
+++ b/ambari-web/app/templates/common/configs/widgets/radio_button_config.hbs
@@ -0,0 +1,33 @@
+{{!
+* 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.
+}}
+
+{{#if view.isOriginalSCP}}
+  <p class="widget-config-label">
+    {{view.configLabel}}
+  </p>
+{{/if}}
+<div class="pull-left">
+  {{#each item in view.content}}
+    <label>
+      {{view Ember.RadioButton nameBinding="view.elementId" valueBinding="item.value" selectionBinding="view.config.value"}}
+      {{item.label}}
+    </label>
+  {{/each}}
+</div>
+{{view App.RestoreConfigView}}
+<div class="clearfix"></div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2b43a272/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 602f68a..c7b8824 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -60,6 +60,7 @@ require('views/common/configs/widgets/combo_config_widget_view');
 require('views/common/configs/widgets/number_config_widget_view');
 require('views/common/configs/widgets/password_config_widget_view');
 require('views/common/configs/widgets/list_config_widget_view');
+require('views/common/configs/widgets/radio_button_config_widget_view');
 require('views/common/configs/widgets/slider_config_widget_view');
 require('views/common/configs/widgets/string_config_widget_view');
 require('views/common/configs/widgets/time_interval_spinner_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/2b43a272/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
index e1fbb4e..d1b9121 100644
--- a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
+++ b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js
@@ -37,7 +37,16 @@ App.ServiceConfigLayoutTabView = Em.View.extend(App.ConfigOverridable, {
    * @type {object}
    */
   widgetTypeMap: {
-    slider: App.SliderConfigWidgetView
+    checkbox: App.CheckboxConfigWidgetView,
+    combo: App.ComboConfigWidgetView,
+    directory: App.DirectoryConfigWidgetView,
+    directories: App.DirectoryConfigWidgetView,
+    list: App.ListConfigWidgetView,
+    password: App.PasswordConfigWidgetView,
+    'radio-buttons': App.RadioButtonConfigWidgetView,
+    slider: App.SliderConfigWidgetView,
+    'time-interval-spinner': App.TimeIntervalSpinnerView,
+    toggle: App.ToggleConfigWidgetView
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/2b43a272/ambari-web/app/views/common/configs/widgets/radio_button_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/radio_button_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/radio_button_config_widget_view.js
new file mode 100644
index 0000000..604ff77
--- /dev/null
+++ b/ambari-web/app/views/common/configs/widgets/radio_button_config_widget_view.js
@@ -0,0 +1,48 @@
+/**
+ * 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.RadioButtonConfigWidgetView = App.ConfigWidgetView.extend({
+  templateName: require('templates/common/configs/widgets/radio_button_config'),
+  classNames: ['widget', 'radio-button-widget'],
+
+  /**
+   * Content for radio buttons has following structure:
+   *    .value {String} - radio value attribute
+   *    .label {String} - label to display along with radio button
+   *    .description {String} - description for specified value
+   * @type {Em.Object[]}
+   * @property content
+   */
+
+  didInsertElement: function() {
+    this.generateContent();
+  },
+
+  generateContent: function() {
+    this.set('content', this.get('config.stackConfigProperty.valueAttributes.entries').map(function(item, index, collection) {
+      return Em.Object.create({
+        value: item,
+        descripton: this.get('config.stackConfigProperty.valueAttributes.entry_descriptions.' + index),
+        label: this.get('config.stackConfigProperty.valueAttributes.entry_labels.' + index)
+      });
+    }, this));
+  }
+
+});