Repository: ambari Updated Branches: refs/heads/trunk abe7eb50f -> 9a9b8ccba
AMBARI-16269. Show background op window when Interactive query is enabled/disabled. (Andrii Babiichuk and Jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a9b8ccb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a9b8ccb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a9b8ccb Branch: refs/heads/trunk Commit: 9a9b8ccba51d709d02b0670ac974068d3353baaa Parents: abe7eb5 Author: Jaimin Jetly <[email protected]> Authored: Fri May 6 11:58:31 2016 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Fri May 6 11:58:31 2016 -0700 ---------------------------------------------------------------------- .../app/mixins/common/configs/configs_saver.js | 12 +++++ .../configs/component_actions_by_configs.js | 57 +++++++++++++++----- 2 files changed, 56 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9a9b8ccb/ambari-web/app/mixins/common/configs/configs_saver.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js index 1f81ef1..8d2869c 100644 --- a/ambari-web/app/mixins/common/configs/configs_saver.js +++ b/ambari-web/app/mixins/common/configs/configs_saver.js @@ -714,15 +714,24 @@ App.ConfigsSaverMixin = Em.Mixin.create({ header: header, primary: Em.I18n.t('ok'), secondary: null, + isBackgroundPopupToBeShown: false, + onPrimary: function () { this.hide(); if (!flag) { self.completeSave(); } + this.showBackgroundPopup(); }, onClose: function () { this.hide(); self.completeSave(); + this.showBackgroundPopup(); + }, + showBackgroundPopup: function() { + if (this.get('isBackgroundPopupToBeShown')) { + App.router.get('backgroundOperationsController').showPopup(); + } }, disablePrimary: true, bodyClass: Ember.View.extend({ @@ -824,6 +833,7 @@ App.ConfigsSaverMixin = Em.Mixin.create({ this.set('isLoaded', true); }, didInsertElement: function () { + var context = this; var dfd = App.ajax.send({ name: 'components.filter_by_status', sender: this, @@ -838,6 +848,8 @@ App.ConfigsSaverMixin = Em.Mixin.create({ dfd.done(function() { if (doConfigActions && self.doConfigActions) { self.doConfigActions.bind(self)(); + var isBackgroundPopupToBeShown = self.isComponentActionsPresent.bind(self)(); + context.set('parentView.isBackgroundPopupToBeShown',isBackgroundPopupToBeShown); } if (flag) { self.loadStep(); http://git-wip-us.apache.org/repos/asf/ambari/blob/9a9b8ccb/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js index 080fff1..93cac29 100644 --- a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js +++ b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js @@ -34,25 +34,61 @@ App.ComponentActionsByConfigs = Em.Mixin.create({ doConfigActions: function() { var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName')).get('configs'); var configActionComponents = serviceConfigs.filterProperty('configActionComponent'); - this.doComponentDeleteActions(configActionComponents); this.doComponentAddActions(configActionComponents); }, /** - * Do component Delete actions as inferred from value of service config - * @param configActionComponents Object[] + * Method informs if any component will be added/deleted on saving configurations + * @return {boolean} + * @public + * @method isComponentActionsPresent + */ + isComponentActionsPresent: function() { + var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName')).get('configs'); + var configActionComponents = serviceConfigs.filterProperty('configActionComponent'); + return !!(this.getComponentsToDelete(configActionComponents).length + this.getComponentsToAdd(configActionComponents).length); + }, + + /** + * Get Component that will be deleted on saving configurations + * @param configActionComponents {Object} + * @return {boolean} * @private - * @method {configActionComponents} + * @method getComponentsToDelete */ - doComponentDeleteActions: function(configActionComponents) { - var self = this; - var componentsToDelete = configActionComponents.filterProperty('configActionComponent.action', 'delete').map(function(item){ + getComponentsToDelete: function(configActionComponents) { + return configActionComponents.filterProperty('configActionComponent.action', 'delete').map(function(item){ return item.configActionComponent; }).filter(function(_componentToDelete){ return App.HostComponent.find().filterProperty('componentName',_componentToDelete.componentName).someProperty('hostName', _componentToDelete.hostName); }, this); + }, + + /** + * Get Component that will be added on saving configurations + * @param configActionComponents {Object} + * @return {boolean} + * @private + * @method getComponentsToDelete + */ + getComponentsToAdd: function(configActionComponents) { + return configActionComponents.filterProperty('configActionComponent.action', 'add').map(function(item){ + return item.configActionComponent; + }).filter(function(_componentToAdd){ + return !App.HostComponent.find().filterProperty('componentName',_componentToAdd.componentName).someProperty('hostName', _componentToAdd.hostName); + }, this); + }, + /** + * Do component Delete actions as inferred from value of service config + * @param configActionComponents Object[] + * @private + * @method {configActionComponents} + */ + doComponentDeleteActions: function(configActionComponents) { + var self = this; + var componentsToDelete = this.getComponentsToDelete(configActionComponents); if (componentsToDelete.length) { componentsToDelete.forEach(function(_componentToDelete){ var displayName = App.StackServiceComponent.find().findProperty('componentName', _componentToDelete.componentName).get('displayName'); @@ -78,12 +114,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({ */ doComponentAddActions: function(configActionComponents) { var self = this; - var componentsToAdd = configActionComponents.filterProperty('configActionComponent.action', 'add').map(function(item){ - return item.configActionComponent; - }).filter(function(_componentToAdd){ - return !App.HostComponent.find().filterProperty('componentName',_componentToAdd.componentName).someProperty('hostName', _componentToAdd.hostName); - }, this); - + var componentsToAdd = this.getComponentsToAdd(configActionComponents); var dependentComponents = []; if (componentsToAdd.length) { componentsToAdd.forEach(function(_component) {
