You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2017/01/23 20:32:13 UTC
[1/4] ambari git commit: AMBARI-18790. Implement lazy loading for
Service configs Advanced tab (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.5 44b1c059f -> 09312eae0
AMBARI-18790. Implement lazy loading for Service configs Advanced tab (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/40052006
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/40052006
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/40052006
Branch: refs/heads/branch-2.5
Commit: 4005200673725b9077b83bc7e11b6e8b845ff3fe
Parents: 44b1c05
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 23 22:24:07 2017 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 23 22:24:07 2017 +0200
----------------------------------------------------------------------
.../templates/common/configs/service_config.hbs | 20 +-----
ambari-web/app/views.js | 1 +
.../configs/config_category_container_view.js | 64 ++++++++++++++++++++
.../configs/service_configs_by_category_view.js | 42 ++++++-------
.../notification_configs_view_test.js | 6 +-
5 files changed, 92 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/40052006/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 b78fecf..420091c 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -134,15 +134,7 @@
<div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}>
{{#if tab.isAdvanced}}
{{#if tab.isRendered}}
- {{#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}}
+ {{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
{{else}}
{{view App.SpinnerView}}
{{/if}}
@@ -154,15 +146,7 @@
{{/each}}
</div>
{{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}}
+ {{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
{{/if}}
{{#if view.isAllConfigsHidden}}
<div class="alert alert-info col-sm-12">
http://git-wip-us.apache.org/repos/asf/ambari/blob/40052006/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 0dac227..c8b5a72 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -62,6 +62,7 @@ require('views/common/configs/service_config_container_view');
require('views/common/configs/service_configs_by_category_view');
require('views/common/configs/service_config_view');
require('views/common/configs/service_config_tab_view');
+require('views/common/configs/config_category_container_view');
require('views/common/configs/overriddenPropertyRow_view');
require('views/common/configs/overriddenProperty_view');
require('views/common/configs/compare_property_view');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40052006/ambari-web/app/views/common/configs/config_category_container_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_category_container_view.js b/ambari-web/app/views/common/configs/config_category_container_view.js
new file mode 100644
index 0000000..08cdb2c
--- /dev/null
+++ b/ambari-web/app/views/common/configs/config_category_container_view.js
@@ -0,0 +1,64 @@
+/**
+ * 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');
+
+var lazyLoading = require('utils/lazy_loading');
+
+App.ConfigCategoryContainerView = Em.ContainerView.extend({
+
+ lazyLoading: null,
+
+ categories: [],
+
+ didInsertElement: function () {
+ this.pushViews();
+ this._super();
+ },
+
+ willDestroyElement: function () {
+ if (this.get('lazyLoading')) {
+ lazyLoading.terminate(this.get('lazyLoading'))
+ }
+ this._super();
+ },
+
+ pushViews: function () {
+ var self = this;
+ var categoriesViews = [];
+ this.get('categories').forEach(function (category) {
+ var viewClass = category.isCustomView ? category.customView : App.ServiceConfigsByCategoryView;
+ categoriesViews.push(viewClass.create({
+ category: category,
+ canEdit: self.get("canEdit"),
+ service: self.get("service"),
+ serviceConfigs: self.get("serviceConfigs"),
+ supportsHostOverrides: self.get("supportsHostOverrides")
+ }));
+ });
+ this.set('lazyLoading', lazyLoading.run({
+ destination: self.get('childViews'),
+ source: categoriesViews,
+ initSize: 3,
+ chunkSize: 3,
+ delay: 200,
+ context: this
+ }));
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40052006/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index c38b672..d52b3e1 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -68,24 +68,24 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
var self = this;
// If `this.categoryConfigsAll` is a computed property then don't set it.
// some extended class like `App.NotificationsConfigsView` overrides `categoryConfigsAll` as computed property
- if ($.isArray(this.categoryConfigsAll)) {
- this.setCategoryConfigsAll();
- }
- this.setVisibleCategoryConfigs();
- var isCollapsed = this.calcIsCollapsed();
- this.set('category.isCollapsed', isCollapsed);
- if (isCollapsed) {
- this.$('.accordion-body').hide();
- }
- else {
- this.$('.accordion-body').show();
- }
- $('#serviceConfig').tooltip({
- selector: '[data-toggle=tooltip]',
- placement: 'top'
- });
- this.filteredCategoryConfigs();
Em.run.next(function () {
+ if ($.isArray(self.categoryConfigsAll)) {
+ self.setCategoryConfigsAll();
+ }
+ self.setVisibleCategoryConfigs();
+ var isCollapsed = self.calcIsCollapsed();
+ self.set('category.isCollapsed', isCollapsed);
+ if (isCollapsed) {
+ self.$('.accordion-body').hide();
+ }
+ else {
+ self.$('.accordion-body').show();
+ }
+ $('#serviceConfig').tooltip({
+ selector: '[data-toggle=tooltip]',
+ placement: 'top'
+ });
+ self.filteredCategoryConfigs();
self.updateReadOnlyFlags();
});
},
@@ -175,9 +175,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget'));
}, this).length > 0;
- return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.columns').someProperty('selected')) ||
+ return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.parentView.columns').someProperty('selected')) ||
hasFilteredAdvancedConfigs;
- }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.columns.@each.selected'),
+ }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.parentView.columns.@each.selected'),
/**
* Re-order the configs to list content displayType properties at last in the category
@@ -320,7 +320,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
collapseCategory: function () {
if (this.get('state') === 'destroyed') return;
$('.popover').remove();
- var filter = this.get('parentView.filter')
+ var filter = this.get('parentView.parentView.filter');
filter = filter? filter.toLowerCase() : filter; // filter can be undefined in some wizard
var filteredResult = this.get('categoryConfigs');
var isInitialRendering = !arguments.length || arguments[1] != 'categoryConfigs';
@@ -643,7 +643,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
var controller = (App.router.get('currentState.name') == 'configs')
? App.router.get('mainServiceInfoConfigsController')
: App.router.get('wizardStep7Controller');
- this.get('parentView').onClose();
+ this.get('parentView.parentView').onClose();
controller.set('filter', event.view.get('serviceConfigObj.name'));
}
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/40052006/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
index b970c89..681d346 100644
--- a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
+++ b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -32,8 +32,10 @@ function getView() {
categoryConfigs: [],
categoryConfigsAll: [],
parentView: Em.View.create({
- filter: '',
- columns: []
+ parentView: Em.View.create({
+ filter: '',
+ columns: []
+ })
})
});
}
[3/4] ambari git commit: AMBARI-18790. Implement lazy loading for
Service configs Advanced tab. Third patch. (akovalenko)
Posted by ak...@apache.org.
AMBARI-18790. Implement lazy loading for Service configs Advanced tab. Third patch. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4ba00325
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4ba00325
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4ba00325
Branch: refs/heads/branch-2.5
Commit: 4ba003257de9d5c89de3d503028a32210c43019f
Parents: bb9859d
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 23 22:27:27 2017 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 23 22:27:27 2017 +0200
----------------------------------------------------------------------
.../app/views/common/configs/service_configs_by_category_view.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4ba00325/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index d7c1f4d..7a5bcbe 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -78,6 +78,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
// If `this.categoryConfigsAll` is a computed property then don't set it.
// some extended class like `App.NotificationsConfigsView` overrides `categoryConfigsAll` as computed property
Em.run.next(function () {
+ if (self.get('state') !== 'inDOM') {
+ return;
+ }
if ($.isArray(self.categoryConfigsAll)) {
self.setCategoryConfigsAll();
}
[2/4] ambari git commit: AMBARI-18790. Implement lazy loading for
Service configs Advanced tab. Additional patch. (akovalenko)
Posted by ak...@apache.org.
AMBARI-18790. Implement lazy loading for Service configs Advanced tab. Additional patch. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb9859db
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb9859db
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb9859db
Branch: refs/heads/branch-2.5
Commit: bb9859db533be467e4845f743f3c8755f29dedb9
Parents: 4005200
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 23 22:26:40 2017 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 23 22:26:40 2017 +0200
----------------------------------------------------------------------
.../configs/service_configs_by_category_view.js | 17 +++++++++++++----
.../notification_configs_view_test.js | 8 +++-----
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9859db/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index d52b3e1..d7c1f4d 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -64,6 +64,15 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
*/
categoryConfigs: [],
+ /**
+ * Link to main configs view
+ * @type {Ember.View}
+ */
+ mainView: function () {
+ //todo: Get rid of this logic. Get data from controller instead.
+ return this.get('controller.name') === 'mainServiceInfoConfigsController' ? this.get('parentView.parentView') : this.get('parentView');
+ }.property('controller.name'),
+
didInsertElement: function () {
var self = this;
// If `this.categoryConfigsAll` is a computed property then don't set it.
@@ -175,9 +184,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget'));
}, this).length > 0;
- return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.parentView.columns').someProperty('selected')) ||
+ return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('mainView.columns').someProperty('selected')) ||
hasFilteredAdvancedConfigs;
- }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.parentView.columns.@each.selected'),
+ }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'mainView.columns.@each.selected'),
/**
* Re-order the configs to list content displayType properties at last in the category
@@ -320,7 +329,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
collapseCategory: function () {
if (this.get('state') === 'destroyed') return;
$('.popover').remove();
- var filter = this.get('parentView.parentView.filter');
+ var filter = this.get('mainView.filter');
filter = filter? filter.toLowerCase() : filter; // filter can be undefined in some wizard
var filteredResult = this.get('categoryConfigs');
var isInitialRendering = !arguments.length || arguments[1] != 'categoryConfigs';
@@ -643,7 +652,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
var controller = (App.router.get('currentState.name') == 'configs')
? App.router.get('mainServiceInfoConfigsController')
: App.router.get('wizardStep7Controller');
- this.get('parentView.parentView').onClose();
+ this.get('mainView').onClose();
controller.set('filter', event.view.get('serviceConfigObj.name'));
}
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9859db/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
index 681d346..46be186 100644
--- a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
+++ b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -31,11 +31,9 @@ function getView() {
serviceConfigs: [],
categoryConfigs: [],
categoryConfigsAll: [],
- parentView: Em.View.create({
- parentView: Em.View.create({
- filter: '',
- columns: []
- })
+ mainView: Em.View.create({
+ filter: '',
+ columns: []
})
});
}
[4/4] ambari git commit: AMBARI-19633. accordion classname missed on
configs page (akovalenko)
Posted by ak...@apache.org.
AMBARI-19633. accordion classname missed on configs page (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/09312eae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/09312eae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/09312eae
Branch: refs/heads/branch-2.5
Commit: 09312eae0750f412b8a1c44fa8b91d9d4a1462e3
Parents: 4ba0032
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Jan 23 22:28:27 2017 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Jan 23 22:28:27 2017 +0200
----------------------------------------------------------------------
.../app/views/common/configs/config_category_container_view.js | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/09312eae/ambari-web/app/views/common/configs/config_category_container_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_category_container_view.js b/ambari-web/app/views/common/configs/config_category_container_view.js
index 08cdb2c..7f89030 100644
--- a/ambari-web/app/views/common/configs/config_category_container_view.js
+++ b/ambari-web/app/views/common/configs/config_category_container_view.js
@@ -26,6 +26,8 @@ App.ConfigCategoryContainerView = Em.ContainerView.extend({
categories: [],
+ classNames: ['accordion'],
+
didInsertElement: function () {
this.pushViews();
this._super();