You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/03/16 19:45:02 UTC
ambari git commit: AMBARI-10087 Refactor existing configs to support
tabs of configs with Advanced tab. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk c61c920bc -> e813af2fe
AMBARI-10087 Refactor existing configs to support tabs of configs with Advanced tab. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e813af2f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e813af2f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e813af2f
Branch: refs/heads/trunk
Commit: e813af2fe942fba96627f54744d9ee758d328830
Parents: c61c920
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Mon Mar 16 19:35:05 2015 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Mon Mar 16 20:43:32 2015 +0200
----------------------------------------------------------------------
.../templates/common/configs/service_config.hbs | 46 ++++++++++++----
.../common/configs/service_config_wizard.hbs | 32 +++++++++--
.../views/common/configs/service_config_view.js | 56 +++++++++++++++++++-
3 files changed, 120 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e813af2f/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index fa1d006..120a985 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -83,15 +83,43 @@
{{/if}}
{{#if versionLoaded}}
- {{#each category in selectedService.configCategories}}
- <div class="accordion">
- {{#if category.isCustomView}}
- {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
- {{else}}
- {{view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
- {{/if}}
- </div>
- {{/each}}
+ {{#if view.supportsConfigLayout}}
+ <ul class="nav nav-tabs">
+ {{#each tab in view.tabs}}
+ <li {{bindAttr class="tab.isActive:active" }}><a href="#" {{bindAttr data-target="tab.className"}} data-toggle="tab">{{tab.displayName}}</a></li>
+ {{/each}}
+ </ul>
+
+ {{#each tab in view.tabs}}
+ <div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}>
+ {{#if tab.isAdvanced}}
+ {{#each category in selectedService.configCategories}}
+ <div class="accordion">
+ {{#if category.isCustomView}}
+ {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
+ {{else}}
+ {{view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
+ {{/if}}
+ </div>
+ {{/each}}
+ {{else}}
+ {{!
+ @TODO Fancy Config view goes here
+ }}
+ {{/if}}
+ </div>
+ {{/each}}
+ {{else}}
+ {{#each category in selectedService.configCategories}}
+ <div class="accordion">
+ {{#if category.isCustomView}}
+ {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
+ {{else}}
+ {{view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
+ {{/if}}
+ </div>
+ {{/each}}
+ {{/if}}
{{else}}
<div class="spinner"></div>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e813af2f/ambari-web/app/templates/common/configs/service_config_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_wizard.hbs b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
index 3b4cb5b..576c548 100644
--- a/ambari-web/app/templates/common/configs/service_config_wizard.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
@@ -48,8 +48,32 @@
</div>
{{/if}}
-<div class="accordion">
- {{#each catView in view.serviceConfigsByCategoryView.childViews}}
- {{view catView}}
+{{#if view.supportsConfigLayout}}
+ <ul class="nav nav-tabs">
+ {{#each tab in view.tabs}}
+ <li {{bindAttr class="tab.isActive:active" }}><a href="#" {{bindAttr data-target="tab.className"}} data-toggle="tab">{{tab.displayName}}</a></li>
+ {{/each}}
+ </ul>
+
+ {{#each tab in view.tabs}}
+ <div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}>
+ {{#if tab.isAdvanced}}
+ <div class="accordion">
+ {{#each catView in view.serviceConfigsByCategoryView.childViews}}
+ {{view catView}}
+ {{/each}}
+ </div>
+ {{else}}
+ {{!
+ @TODO Fancy Config view goes here
+ }}
+ {{/if}}
+ </div>
{{/each}}
-</div>
+{{else}}
+ <div class="accordion">
+ {{#each catView in view.serviceConfigsByCategoryView.childViews}}
+ {{view catView}}
+ {{/each}}
+ </div>
+{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e813af2f/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index d97ef6d..ec11fe5 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -36,6 +36,18 @@ App.ServiceConfigView = Em.View.extend({
return false;
}
}.property('controller.name', 'controller.selectedService'),
+
+ /**
+ * Check for layout config supports.
+ * @returns {Boolean}
+ */
+ supportsConfigLayout: function() {
+ var supportedControllers = ['wizardStep7Controller', 'mainServiceInfoConfigsController'];
+ var unSupportedServices = ['MISC'];
+
+ return supportedControllers.contains(this.get('controllerName')) || !unSupportedServices.contains(this.get('controller.selectedService.serviceName'));
+ }.property('controller.name', 'controller.selectedService'),
+
showConfigHistoryFeature: false,
toggleRestartMessageView: function () {
this.$('.service-body').toggle('blind', 200);
@@ -71,5 +83,47 @@ App.ServiceConfigView = Em.View.extend({
}.observes(
'App.router.mainServiceInfoConfigsController.selectedConfigGroup.name',
'App.router.wizardStep7Controller.selectedConfigGroup.name'
- )
+ ),
+
+ // TODO remove workaround for `Advanced` tab after Tab model implementation
+ /**
+ * Create `Advanced` tab which is not related to fancy tab section.
+ * This tab contains properties without widgets.
+ *
+ * @returns {Ember.Object}
+ */
+ getAdvancedTab: function() {
+ var tabId = 'advanced-' + this.get('controller.selectedService.serviceName').toLowerCase() + '-tab';
+ return this.createTabObject(Em.Object.create({
+ id: tabId,
+ name: Em.I18n.t('common.advanced')
+ }));
+ },
+
+ /**
+ * @param {Ember.Object} model
+ * @returns {Ember.Object}
+ */
+ createTabObject: function(model) {
+ return Em.Object.create({
+ id: model.get('id'),
+ displayName: model.get('name'),
+ tabClassName: '.' + model.get('id'),
+ isAdvanced: model.get('name') == Em.I18n.t('common.advanced')
+ });
+ },
+
+ /**
+ * Object that used for Twitter Bootstrap tabs markup.
+ *
+ * @returns {Ember.A}
+ */
+ tabs: function() {
+ var tabs = Em.A([]);
+ // filter Tab models by service name and create object here
+ tabs.pushObject(this.getAdvancedTab());
+ // make first tab active
+ tabs.get('firstObject').set('isActive', true);
+ return tabs;
+ }.property('controller.selectedService.serviceName')
});