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

ambari git commit: AMBARI-10218. Move configGroups logic to separated mixin from utils/config (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 2ae23688c -> 8cdd1f550


AMBARI-10218. Move configGroups logic to separated mixin from utils/config (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 8cdd1f5504c265ec93b8d67d196446b284f74e5f
Parents: 2ae2368
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Mar 26 17:35:12 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Mar 26 17:35:12 2015 +0200

----------------------------------------------------------------------
 .../controllers/main/host/configs_service.js    |   4 +-
 .../controllers/main/service/info/configs.js    |  13 +-
 .../app/controllers/wizard/step8_controller.js  |   5 +-
 .../main/service/configs/config_overridable.js  | 399 ++++++++++++++++++-
 ambari-web/app/utils/config.js                  | 339 ----------------
 .../main/host/configs_service_test.js           |  17 +-
 .../test/controllers/wizard/step8_test.js       |   6 +-
 7 files changed, 420 insertions(+), 363 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/app/controllers/main/host/configs_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/configs_service.js b/ambari-web/app/controllers/main/host/configs_service.js
index 9c3c700..9afb309 100644
--- a/ambari-web/app/controllers/main/host/configs_service.js
+++ b/ambari-web/app/controllers/main/host/configs_service.js
@@ -17,7 +17,7 @@
 
 var App = require('app');
 
-App.MainHostServiceConfigsController = App.MainServiceInfoConfigsController.extend({
+App.MainHostServiceConfigsController = App.MainServiceInfoConfigsController.extend(App.ConfigOverridable, {
   name: 'mainHostServiceConfigsController',
   host: null,
   isHostsConfigsPage: true,
@@ -70,7 +70,7 @@ App.MainHostServiceConfigsController = App.MainServiceInfoConfigsController.exte
    */
   switchHostGroup: function () {
     var self = this;
-    App.config.launchSwitchConfigGroupOfHostDialog(this.get('selectedConfigGroup'), this.get('configGroups'), this.get('host.hostName'), function (newGroup) {
+    this.launchSwitchConfigGroupOfHostDialog(this.get('selectedConfigGroup'), this.get('configGroups'), this.get('host.hostName'), function (newGroup) {
       self.set('selectedConfigGroup', newGroup);
     });
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 4fb538f..b126798 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -21,7 +21,7 @@ require('controllers/wizard/slave_component_groups_controller');
 var batchUtils = require('utils/batch_scheduled_requests');
 var lazyLoading = require('utils/lazy_loading');
 
-App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, {
+App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ConfigOverridable, {
   name: 'mainServiceInfoConfigsController',
   isHostsConfigsPage: false,
   forceTransition: false,
@@ -2668,6 +2668,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
   },
 
   manageConfigurationGroups: function (controller) {
+    var configsController = this;
     var serviceData = (controller && controller.get('selectedService')) || this.get('content');
     var serviceName = serviceData.get('serviceName');
     var displayName = serviceData.get('displayName');
@@ -2695,7 +2696,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
             if (controller.get('selectedService.selected') === false && modifiedConfigGroups.toDelete.length > 0) {
               controller.setGroupsToDelete(modifiedConfigGroups.toDelete);
             }
-            App.config.persistWizardStep7ConfigGroups();
+            configsController.persistConfigGroups();
             this.updateConfigGroupOnServicePage();
           }
           this.hide();
@@ -2712,18 +2713,18 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
           if (!deleteQueriesRun && deleteQueriesCounter > 0) {
             deleteQueriesRun = true;
             modifiedConfigGroups.toClearHosts.forEach(function (cg) {
-              App.config.clearConfigurationGroupHosts(cg, finishFunction, finishFunction);
+              configsController.clearConfigurationGroupHosts(cg, finishFunction, finishFunction);
             }, this);
             modifiedConfigGroups.toDelete.forEach(function (cg) {
-              App.config.deleteConfigGroup(cg, finishFunction, finishFunction);
+              configsController.deleteConfigGroup(cg, finishFunction, finishFunction);
             }, this);
           } else if (!createQueriesRun && deleteQueriesCounter < 1) {
             createQueriesRun = true;
             modifiedConfigGroups.toSetHosts.forEach(function (cg) {
-              App.config.updateConfigurationGroup(cg, finishFunction, finishFunction);
+              configsController.updateConfigurationGroup(cg, finishFunction, finishFunction);
             }, this);
             modifiedConfigGroups.toCreate.forEach(function (cg) {
-              App.config.postNewConfigurationGroup(cg, finishFunction);
+              configsController.postNewConfigurationGroup(cg, finishFunction);
             }, this);
           }
         };

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index ed26710..b2fc1f2 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -19,7 +19,7 @@
 var App = require('app');
 var stringUtils = require('utils/string_utils');
 
-App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wizardDeployProgressControllerMixin, {
+App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wizardDeployProgressControllerMixin, App.ConfigOverridable, {
 
   name: 'wizardStep8Controller',
 
@@ -1679,8 +1679,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
    * @method removeInstalledServicesConfigurationGroups
    */
   removeInstalledServicesConfigurationGroups: function (groupsToDelete) {
+    var self = this;
     groupsToDelete.forEach(function (item) {
-      App.config.deleteConfigGroup(Em.Object.create(item));
+      self.deleteConfigGroup(Em.Object.create(item));
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/app/mixins/main/service/configs/config_overridable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/config_overridable.js b/ambari-web/app/mixins/main/service/configs/config_overridable.js
index 7454a7f..0b3ead7 100644
--- a/ambari-web/app/mixins/main/service/configs/config_overridable.js
+++ b/ambari-web/app/mixins/main/service/configs/config_overridable.js
@@ -18,6 +18,11 @@
 
 var App = require('app');
 
+/**
+ * Mixin with methods for config groups and overrides processing
+ * Used in the installer step7, service configs page and others
+ * @type {Em.Mixin}
+ */
 App.ConfigOverridable = Em.Mixin.create({
 
   /**
@@ -26,9 +31,9 @@ App.ConfigOverridable = Em.Mixin.create({
    */
   createOverrideProperty: function (event) {
     var serviceConfigProperty = event.contexts[0];
-    var serviceConfigController = this.get('controller');
+    var serviceConfigController = this.get('isView') ? this.get('controller') : this;
     var selectedConfigGroup = serviceConfigController.get('selectedConfigGroup');
-    var isInstaller = (this.get('controller.name') === 'wizardStep7Controller');
+    var isInstaller = this.get('controller.name') === 'wizardStep7Controller';
     var configGroups = (isInstaller) ? serviceConfigController.get('selectedService.configGroups') : serviceConfigController.get('configGroups');
 
     //user property is added, and it has not been saved, not allow override
@@ -42,18 +47,400 @@ App.ConfigOverridable = Em.Mixin.create({
     }
     if (selectedConfigGroup.get('isDefault')) {
       // Launch dialog to pick/create Config-group
-      App.config.launchConfigGroupSelectionCreationDialog(this.get('service.serviceName'),
-        configGroups, serviceConfigProperty, function (selectedGroupInPopup) {
+      this.launchConfigGroupSelectionCreationDialog(
+        this.get('service.serviceName'),
+        configGroups,
+        serviceConfigProperty,
+        function (selectedGroupInPopup) {
           console.log("launchConfigGroupSelectionCreationDialog(): Selected/Created:", selectedGroupInPopup);
           if (selectedGroupInPopup) {
             serviceConfigController.set('overrideToAdd', serviceConfigProperty);
             serviceConfigController.set('selectedConfigGroup', selectedGroupInPopup);
           }
-        }, isInstaller);
+        },
+        isInstaller
+      );
     }
     else {
       serviceConfigController.addOverrideProperty(serviceConfigProperty, selectedConfigGroup);
     }
+  },
+
+  /**
+   * Open popup with list of config groups
+   * User may select existing group or create a new one
+   * @param {string} serviceId service name like 'HDFS', 'HBASE' etc
+   * @param {App.ConfigGroup[]} configGroups
+   * @param {App.ConfigProperty} configProperty
+   * @param {Function} callback function called after config group is selected (or new one is created)
+   * @param {Boolean} isInstaller determines if user is currently on the installer
+   * @return {App.ModalPopup}
+   * @method launchConfigGroupSelectionCreationDialog
+   */
+  launchConfigGroupSelectionCreationDialog: function (serviceId, configGroups, configProperty, callback, isInstaller) {
+    var self = this;
+    var availableConfigGroups = configGroups.slice();
+    // delete Config Groups, that already have selected property overridden
+    var alreadyOverriddenGroups = [];
+    if (configProperty.get('overrides')) {
+      alreadyOverriddenGroups = configProperty.get('overrides').mapProperty('group.name');
+    }
+    var result = [];
+    availableConfigGroups.forEach(function (group) {
+      if (!group.get('isDefault') && (!alreadyOverriddenGroups.length || !alreadyOverriddenGroups.contains(group.name))) {
+        result.push(group);
+      }
+    }, this);
+    availableConfigGroups = result;
+    var selectedConfigGroup = availableConfigGroups && availableConfigGroups.length > 0 ?
+      availableConfigGroups[0] : null;
+    var serviceName = App.format.role(serviceId);
+
+    return App.ModalPopup.show({
+      classNames: ['sixty-percent-width-modal'],
+      header: Em.I18n.t('config.group.selection.dialog.title').format(serviceName),
+      subTitle: Em.I18n.t('config.group.selection.dialog.subtitle').format(serviceName),
+      selectExistingGroupLabel: Em.I18n.t('config.group.selection.dialog.option.select').format(serviceName),
+      noGroups: Em.I18n.t('config.group.selection.dialog.no.groups').format(serviceName),
+      createNewGroupLabel: Em.I18n.t('config.group.selection.dialog.option.create').format(serviceName),
+      createNewGroupDescription: Em.I18n.t('config.group.selection.dialog.option.create.msg').format(serviceName),
+      warningMessage: '&nbsp;',
+      isWarning: false,
+      optionSelectConfigGroup: true,
+      optionCreateConfigGroup: function () {
+        return !this.get('optionSelectConfigGroup');
+      }.property('optionSelectConfigGroup'),
+      hasExistedGroups: function () {
+        return !!this.get('availableConfigGroups').length;
+      }.property('availableConfigGroups'),
+      availableConfigGroups: availableConfigGroups,
+      selectedConfigGroup: selectedConfigGroup,
+      newConfigGroupName: '',
+      disablePrimary: function () {
+        return !(this.get('optionSelectConfigGroup') || (this.get('newConfigGroupName').trim().length > 0 && !this.get('isWarning')));
+      }.property('newConfigGroupName', 'optionSelectConfigGroup', 'warningMessage'),
+      onPrimary: function () {
+        if (this.get('optionSelectConfigGroup')) {
+          var selectedConfigGroup = this.get('selectedConfigGroup');
+          this.hide();
+          callback(selectedConfigGroup);
+        } else {
+          var newConfigGroupName = this.get('newConfigGroupName').trim();
+          var newConfigGroup = App.ConfigGroup.create({
+            id: null,
+            name: newConfigGroupName,
+            description: Em.I18n.t('config.group.description.default').format(new Date().toDateString()),
+            isDefault: false,
+            parentConfigGroup: null,
+            service: (isInstaller) ? Em.Object.create({id: serviceId}) : App.Service.find().findProperty('serviceName', serviceId),
+            hosts: [],
+            configSiteTags: [],
+            properties: []
+          });
+          if (!isInstaller) {
+            self.postNewConfigurationGroup(newConfigGroup);
+          }
+          if (newConfigGroup) {
+            newConfigGroup.set('parentConfigGroup', configGroups.findProperty('isDefault'));
+            configGroups.pushObject(newConfigGroup);
+            if (isInstaller) {
+              self.persistConfigGroups();
+            } else {
+              self.saveGroupConfirmationPopup(newConfigGroupName);
+            }
+            this.hide();
+            callback(newConfigGroup);
+          }
+        }
+      },
+      onSecondary: function () {
+        this.hide();
+        callback(null);
+      },
+      doSelectConfigGroup: function (event) {
+        var configGroup = event.context;
+        console.log(configGroup);
+        this.set('selectedConfigGroup', configGroup);
+      },
+      validate: function () {
+        var msg = '&nbsp;';
+        var isWarning = false;
+        var optionSelect = this.get('optionSelectConfigGroup');
+        if (!optionSelect) {
+          var nn = this.get('newConfigGroupName');
+          if (nn && configGroups.mapProperty('name').contains(nn.trim())) {
+            msg = Em.I18n.t("config.group.selection.dialog.err.name.exists");
+            isWarning = true;
+          }
+        }
+        this.set('warningMessage', msg);
+        this.set('isWarning', isWarning);
+      }.observes('newConfigGroupName', 'optionSelectConfigGroup'),
+      bodyClass: Em.View.extend({
+        templateName: require('templates/common/configs/selectCreateConfigGroup'),
+        controllerBinding: 'App.router.mainServiceInfoConfigsController',
+        selectConfigGroupRadioButton: Em.Checkbox.extend({
+          tagName: 'input',
+          attributeBindings: ['type', 'checked', 'disabled'],
+          checked: function () {
+            return this.get('parentView.parentView.optionSelectConfigGroup');
+          }.property('parentView.parentView.optionSelectConfigGroup'),
+          type: 'radio',
+          disabled: false,
+          click: function () {
+            this.set('parentView.parentView.optionSelectConfigGroup', true);
+          },
+          didInsertElement: function () {
+            if (!this.get('parentView.parentView.hasExistedGroups')) {
+              this.set('disabled', true);
+              this.set('parentView.parentView.optionSelectConfigGroup', false);
+            }
+          }
+        }),
+        createConfigGroupRadioButton: Em.Checkbox.extend({
+          tagName: 'input',
+          attributeBindings: ['type', 'checked'],
+          checked: function () {
+            return !this.get('parentView.parentView.optionSelectConfigGroup');
+          }.property('parentView.parentView.optionSelectConfigGroup'),
+          type: 'radio',
+          click: function () {
+            this.set('parentView.parentView.optionSelectConfigGroup', false);
+          }
+        })
+      })
+    });
+  },
+
+  /**
+   * Persist config groups created in step7 wizard controller
+   * @method persistConfigGroups
+   */
+  persistConfigGroups: function () {
+    var installerController = App.router.get('installerController');
+    var step7Controller = App.router.get('wizardStep7Controller');
+    installerController.saveServiceConfigGroups(step7Controller, step7Controller.get('content.controllerName') == 'addServiceController');
+    App.clusterStatus.setClusterStatus({
+      localdb: App.db.data
+    });
+  },
+
+  /**
+   * Create a new config-group for a service.
+   *
+   * @param {App.ConfigGroup} newConfigGroupData config group to post to server
+   * @param {Function} callback Callback function for Success or Error handling
+   * @return {App.ConfigGroup} Returns the created config-group
+   * @method postNewConfigurationGroup
+   */
+  postNewConfigurationGroup: function (newConfigGroupData, callback) {
+    var dataHosts = [];
+    newConfigGroupData.get('hosts').forEach(function (_host) {
+      dataHosts.push({
+        host_name: _host
+      });
+    }, this);
+    var sendData = {
+      name: 'config_groups.create',
+      data: {
+        'group_name': newConfigGroupData.get('name'),
+        'service_id': newConfigGroupData.get('service.id'),
+        'description': newConfigGroupData.get('description'),
+        'hosts': dataHosts
+      },
+      success: 'successFunction',
+      error: 'errorFunction',
+      successFunction: function (response) {
+        newConfigGroupData.set('id', response.resources[0].ConfigGroup.id);
+        if (callback) {
+          callback();
+        }
+      },
+      errorFunction: function (xhr, text, errorThrown) {
+        if (callback) {
+          callback(xhr, text, errorThrown);
+        }
+        console.error('Error in creating new Config Group');
+      }
+    };
+    sendData.sender = sendData;
+    App.ajax.send(sendData);
+    return newConfigGroupData;
+  },
+
+  /**
+   * PUTs the new configuration-group on the server.
+   * Changes possible here are the name, description and
+   * host memberships of the configuration-group.
+   *
+   * @param {App.ConfigGroup} configGroup Configuration group to update
+   * @param {Function} successCallback
+   * @param {Function} errorCallback
+   * @return {$.ajax}
+   * @method updateConfigurationGroup
+   */
+  updateConfigurationGroup: function (configGroup, successCallback, errorCallback) {
+    var putConfigGroup = {
+      ConfigGroup: {
+        group_name: configGroup.get('name'),
+        description: configGroup.get('description'),
+        tag: configGroup.get('service.id'),
+        hosts: configGroup.get('hosts').map(function (h) {
+          return {
+            host_name: h
+          };
+        }),
+        desired_configs: configGroup.get('configSiteTags').map(function (cst) {
+          return {
+            type: cst.get('site'),
+            tag: cst.get('tag')
+          };
+        })
+      }
+    };
+
+    var sendData = {
+      name: 'config_groups.update',
+      data: {
+        id: configGroup.get('id'),
+        data: putConfigGroup
+      },
+      success: 'successFunction',
+      error: 'errorFunction',
+      successFunction: function () {
+        if (successCallback) {
+          successCallback();
+        }
+      },
+      errorFunction: function (xhr, text, errorThrown) {
+        if (errorCallback) {
+          errorCallback(xhr, text, errorThrown);
+        }
+      }
+    };
+    sendData.sender = sendData;
+    return App.ajax.send(sendData);
+  },
+
+  /**
+   * launch dialog where can be assigned another group to host
+   * @param {App.ConfigGroup} selectedGroup
+   * @param {App.ConfigGroup[]} configGroups
+   * @param {String} hostName
+   * @param {Function} callback
+   * @return {App.ModalPopup}
+   * @method launchSwitchConfigGroupOfHostDialog
+   */
+  launchSwitchConfigGroupOfHostDialog: function (selectedGroup, configGroups, hostName, callback) {
+    var self = this;
+    return App.ModalPopup.show({
+      header: Em.I18n.t('config.group.host.switch.dialog.title'),
+      configGroups: configGroups,
+      selectedConfigGroup: selectedGroup,
+      disablePrimary: function () {
+        return !(this.get('selectedConfigGroup.name') !== selectedGroup.get('name'));
+      }.property('selectedConfigGroup'),
+      onPrimary: function () {
+        var newGroup = this.get('selectedConfigGroup');
+        if (selectedGroup.get('isDefault')) {
+          selectedGroup.set('hosts.length', selectedGroup.get('hosts.length') - 1);
+        } else {
+          selectedGroup.get('hosts').removeObject(hostName);
+        }
+        if (!selectedGroup.get('isDefault')) {
+          self.updateConfigurationGroup(selectedGroup, Em.K, Em.K);
+        }
+
+        if (newGroup.get('isDefault')) {
+          newGroup.set('hosts.length', newGroup.get('hosts.length') + 1);
+        } else {
+          newGroup.get('hosts').pushObject(hostName);
+        }
+        callback(newGroup);
+        if (!newGroup.get('isDefault')) {
+          self.updateConfigurationGroup(newGroup, Em.K, Em.K);
+        }
+        this.hide();
+      },
+      bodyClass: Em.View.extend({
+        templateName: require('templates/utils/config_launch_switch_config_group_of_host')
+      })
+    });
+  },
+
+  /**
+   * Update config group's hosts list (clear it)
+   * Save updated config group on server
+   * @param {App.ConfigGroup} configGroup
+   * @param {Function} successCallback
+   * @param {Function} errorCallback
+   * @method clearConfigurationGroupHosts
+   */
+  clearConfigurationGroupHosts: function (configGroup, successCallback, errorCallback) {
+    configGroup = jQuery.extend({}, configGroup);
+    configGroup.set('hosts', []);
+    this.updateConfigurationGroup(configGroup, successCallback, errorCallback);
+  },
+
+  /**
+   * Do request to delete config group
+   * @param {App.ConfigGroup} configGroup
+   * @param {Function} successCallback
+   * @param {Function} errorCallback
+   * @return {$.ajax}
+   * @method deleteConfigGroup
+   */
+  deleteConfigGroup: function (configGroup, successCallback, errorCallback) {
+    var sendData = {
+      name: 'common.delete.config_group',
+      sender: this,
+      data: {
+        id: configGroup.get('id')
+      },
+      success: 'successFunction',
+      error: 'errorFunction',
+      successFunction: function () {
+        if (successCallback) {
+          successCallback();
+        }
+      },
+      errorFunction: function (xhr, text, errorThrown) {
+        if (errorCallback) {
+          errorCallback(xhr, text, errorThrown);
+        }
+      }
+    };
+    sendData.sender = sendData;
+    return App.ajax.send(sendData);
+  },
+
+  /**
+   * Launches a dialog where an existing config-group can be selected, or a new
+   * one can be created. This is different than the config-group management
+   * dialog where host membership can be managed.
+   *
+   * The callback will be passed the created/selected config-group in the form
+   * of {id:2, name:'New hardware group'}. In the case of dialog being cancelled,
+   * the callback is provided <code>null</code>
+   *
+   * @param {String} groupName
+   *  is closed, cancelled or OK is pressed.
+   * @return {App.ModalPopup}
+   * @method saveGroupConfirmationPopup
+   */
+  saveGroupConfirmationPopup: function (groupName) {
+    return App.ModalPopup.show({
+      header: Em.I18n.t('config.group.save.confirmation.header'),
+      secondary: Em.I18n.t('config.group.save.confirmation.manage.button'),
+      groupName: groupName,
+      bodyClass: Em.View.extend({
+        templateName: require('templates/common/configs/saveConfigGroup')
+      }),
+      onSecondary: function () {
+        App.router.get('mainServiceInfoConfigsController').manageConfigurationGroups();
+        this.hide();
+      }
+    });
   }
 
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 68ed021..2b6769c 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1409,43 +1409,6 @@ App.config = Em.Object.create({
   },
 
   /**
-   * Launches a dialog where an existing config-group can be selected, or a new
-   * one can be created. This is different than the config-group management
-   * dialog where host membership can be managed.
-   *
-   * The callback will be passed the created/selected config-group in the form
-   * of {id:2, name:'New hardware group'}. In the case of dialog being cancelled,
-   * the callback is provided <code>null</code>
-   *
-   * @param {String} groupName
-   *  is closed, cancelled or OK is pressed.
-   */
-
-  saveGroupConfirmationPopup: function (groupName) {
-    App.ModalPopup.show({
-      header: Em.I18n.t('config.group.save.confirmation.header'),
-      secondary: Em.I18n.t('config.group.save.confirmation.manage.button'),
-      groupName: groupName,
-      bodyClass: Ember.View.extend({
-        templateName: require('templates/common/configs/saveConfigGroup')
-      }),
-      onSecondary: function () {
-        App.router.get('mainServiceInfoConfigsController').manageConfigurationGroups();
-        this.hide();
-      }
-    });
-  },
-
-  //Persist config groups created in step7 wizard controller
-  persistWizardStep7ConfigGroups: function () {
-    var installerController = App.router.get('installerController');
-    var step7Controller = App.router.get('wizardStep7Controller');
-    installerController.saveServiceConfigGroups(step7Controller, step7Controller.get('content.controllerName') == 'addServiceController');
-    App.clusterStatus.setClusterStatus({
-      localdb: App.db.data
-    });
-  },
-  /**
    * exclude configs that depends on services which are uninstalled
    * if config doesn't have serviceName or dependent service is installed then
    * config not excluded
@@ -1456,309 +1419,7 @@ App.config = Em.Object.create({
     });
   },
 
-  launchConfigGroupSelectionCreationDialog: function (serviceId, configGroups, configProperty, callback, isInstaller) {
-    var self = this;
-    var availableConfigGroups = configGroups.slice();
-    // delete Config Groups, that already have selected property overridden
-    var alreadyOverriddenGroups = [];
-    if (configProperty.get('overrides')) {
-      alreadyOverriddenGroups = configProperty.get('overrides').mapProperty('group.name');
-    }
-    var result = [];
-    availableConfigGroups.forEach(function (group) {
-      if (!group.get('isDefault') && (!alreadyOverriddenGroups.length || !alreadyOverriddenGroups.contains(group.name))) {
-        result.push(group);
-      }
-    }, this);
-    availableConfigGroups = result;
-    var selectedConfigGroup = availableConfigGroups && availableConfigGroups.length > 0 ?
-      availableConfigGroups[0] : null;
-    var serviceName = App.format.role(serviceId);
-    App.ModalPopup.show({
-      classNames: ['sixty-percent-width-modal'],
-      header: Em.I18n.t('config.group.selection.dialog.title').format(serviceName),
-      subTitle: Em.I18n.t('config.group.selection.dialog.subtitle').format(serviceName),
-      selectExistingGroupLabel: Em.I18n.t('config.group.selection.dialog.option.select').format(serviceName),
-      noGroups: Em.I18n.t('config.group.selection.dialog.no.groups').format(serviceName),
-      createNewGroupLabel: Em.I18n.t('config.group.selection.dialog.option.create').format(serviceName),
-      createNewGroupDescription: Em.I18n.t('config.group.selection.dialog.option.create.msg').format(serviceName),
-      warningMessage: '&nbsp;',
-      isWarning: false,
-      optionSelectConfigGroup: true,
-      optionCreateConfigGroup: function () {
-        return !this.get('optionSelectConfigGroup');
-      }.property('optionSelectConfigGroup'),
-      hasExistedGroups: function () {
-        return !!this.get('availableConfigGroups').length;
-      }.property('availableConfigGroups'),
-      availableConfigGroups: availableConfigGroups,
-      selectedConfigGroup: selectedConfigGroup,
-      newConfigGroupName: '',
-      disablePrimary: function () {
-        return !(this.get('optionSelectConfigGroup') || (this.get('newConfigGroupName').trim().length > 0 && !this.get('isWarning')));
-      }.property('newConfigGroupName', 'optionSelectConfigGroup', 'warningMessage'),
-      onPrimary: function () {
-        if (this.get('optionSelectConfigGroup')) {
-          var selectedConfigGroup = this.get('selectedConfigGroup');
-          this.hide();
-          callback(selectedConfigGroup);
-        } else {
-          var newConfigGroupName = this.get('newConfigGroupName').trim();
-          var newConfigGroup = App.ConfigGroup.create({
-            id: null,
-            name: newConfigGroupName,
-            description: Em.I18n.t('config.group.description.default').format(new Date().toDateString()),
-            isDefault: false,
-            parentConfigGroup: null,
-            service: (isInstaller) ? Em.Object.create({id: serviceId}) : App.Service.find().findProperty('serviceName', serviceId),
-            hosts: [],
-            configSiteTags: [],
-            properties: []
-          });
-          if (!isInstaller) {
-            self.postNewConfigurationGroup(newConfigGroup);
-          }
-          if (newConfigGroup) {
-            newConfigGroup.set('parentConfigGroup', configGroups.findProperty('isDefault'));
-            configGroups.pushObject(newConfigGroup);
-            if (isInstaller) {
-              self.persistWizardStep7ConfigGroups();
-            } else {
-              self.saveGroupConfirmationPopup(newConfigGroupName);
-            }
-            this.hide();
-            callback(newConfigGroup);
-          }
-        }
-      },
-      onSecondary: function () {
-        this.hide();
-        callback(null);
-      },
-      doSelectConfigGroup: function (event) {
-        var configGroup = event.context;
-        console.log(configGroup);
-        this.set('selectedConfigGroup', configGroup);
-      },
-      validate: function () {
-        var msg = '&nbsp;';
-        var isWarning = false;
-        var optionSelect = this.get('optionSelectConfigGroup');
-        if (!optionSelect) {
-          var nn = this.get('newConfigGroupName');
-          if (nn && configGroups.mapProperty('name').contains(nn.trim())) {
-            msg = Em.I18n.t("config.group.selection.dialog.err.name.exists");
-            isWarning = true;
-          }
-        }
-        this.set('warningMessage', msg);
-        this.set('isWarning', isWarning);
-      }.observes('newConfigGroupName', 'optionSelectConfigGroup'),
-      bodyClass: Ember.View.extend({
-        templateName: require('templates/common/configs/selectCreateConfigGroup'),
-        controllerBinding: 'App.router.mainServiceInfoConfigsController',
-        selectConfigGroupRadioButton: Ember.Checkbox.extend({
-          tagName: 'input',
-          attributeBindings: ['type', 'checked', 'disabled'],
-          checked: function () {
-            return this.get('parentView.parentView.optionSelectConfigGroup');
-          }.property('parentView.parentView.optionSelectConfigGroup'),
-          type: 'radio',
-          disabled: false,
-          click: function () {
-            this.set('parentView.parentView.optionSelectConfigGroup', true);
-          },
-          didInsertElement: function () {
-            if (!this.get('parentView.parentView.hasExistedGroups')) {
-              this.set('disabled', true);
-              this.set('parentView.parentView.optionSelectConfigGroup', false);
-            }
-          }
-        }),
-        createConfigGroupRadioButton: Ember.Checkbox.extend({
-          tagName: 'input',
-          attributeBindings: ['type', 'checked'],
-          checked: function () {
-            return !this.get('parentView.parentView.optionSelectConfigGroup');
-          }.property('parentView.parentView.optionSelectConfigGroup'),
-          type: 'radio',
-          click: function () {
-            this.set('parentView.parentView.optionSelectConfigGroup', false);
-          }
-        })
-      })
-    });
-  },
-  /**
-   * launch dialog where can be assigned another group to host
-   * @param selectedGroup
-   * @param configGroups
-   * @param hostName
-   * @param callback
-   */
-  launchSwitchConfigGroupOfHostDialog: function (selectedGroup, configGroups, hostName, callback) {
-    var self = this;
-    App.ModalPopup.show({
-      header: Em.I18n.t('config.group.host.switch.dialog.title'),
-      configGroups: configGroups,
-      selectedConfigGroup: selectedGroup,
-      disablePrimary: function () {
-        return !(this.get('selectedConfigGroup.name') !== selectedGroup.get('name'));
-      }.property('selectedConfigGroup'),
-      onPrimary: function () {
-        var newGroup = this.get('selectedConfigGroup');
-        if (selectedGroup.get('isDefault')) {
-          selectedGroup.set('hosts.length', selectedGroup.get('hosts.length') - 1)
-        } else {
-          selectedGroup.get('hosts').removeObject(hostName);
-        }
-        if (!selectedGroup.get('isDefault')) {
-          self.updateConfigurationGroup(selectedGroup, function () {
-          }, Em.K);
-        }
-
-        if (newGroup.get('isDefault')) {
-          newGroup.set('hosts.length', newGroup.get('hosts.length') + 1)
-        } else {
-          newGroup.get('hosts').pushObject(hostName);
-        }
-        callback(newGroup);
-        if (!newGroup.get('isDefault')) {
-          self.updateConfigurationGroup(newGroup, function () {
-          }, Em.K);
-        }
-        this.hide();
-      },
-      bodyClass: Ember.View.extend({
-        templateName: require('templates/utils/config_launch_switch_config_group_of_host')
-      })
-    });
-  },
-  /**
-   * Create a new config-group for a service.
-   *
-   * @param newConfigGroupData   config group to post to server
-   * @param callback    Callback function for Success or Error handling
-   * @return  Returns the created config-group
-   */
-  postNewConfigurationGroup: function (newConfigGroupData, callback) {
-    var dataHosts = [];
-    newConfigGroupData.get('hosts').forEach(function (_host) {
-      dataHosts.push({
-        host_name: _host
-      });
-    }, this);
-    var sendData = {
-      name: 'config_groups.create',
-      data: {
-        'group_name': newConfigGroupData.get('name'),
-        'service_id': newConfigGroupData.get('service.id'),
-        'description': newConfigGroupData.get('description'),
-        'hosts': dataHosts
-      },
-      success: 'successFunction',
-      error: 'errorFunction',
-      successFunction: function (response) {
-        newConfigGroupData.set('id', response.resources[0].ConfigGroup.id);
-        if (callback) {
-          callback();
-        }
-      },
-      errorFunction: function (xhr, text, errorThrown) {
-        if (callback) {
-          callback(xhr, text, errorThrown);
-        }
-        console.error('Error in creating new Config Group');
-      }
-    };
-    sendData.sender = sendData;
-    App.ajax.send(sendData);
-    return newConfigGroupData;
-  },
-
-  /**
-   * PUTs the new configuration-group on the server.
-   * Changes possible here are the name, description and
-   * host memberships of the configuration-group.
-   *
-   * @param {App.ConfigGroup} configGroup Configuration group to update
-   * @param {Function} successCallback
-   * @param {Function} errorCallback
-   */
-  updateConfigurationGroup: function (configGroup, successCallback, errorCallback) {
-    var putConfigGroup = {
-      ConfigGroup: {
-        group_name: configGroup.get('name'),
-        description: configGroup.get('description'),
-        tag: configGroup.get('service.id'),
-        hosts: [],
-        desired_configs: []
-      }
-    };
-    configGroup.get('hosts').forEach(function (h) {
-      putConfigGroup.ConfigGroup.hosts.push({
-        host_name: h
-      });
-    });
-    configGroup.get('configSiteTags').forEach(function (cst) {
-      putConfigGroup.ConfigGroup.desired_configs.push({
-        type: cst.get('site'),
-        tag: cst.get('tag')
-      });
-    });
 
-    var sendData = {
-      name: 'config_groups.update',
-      data: {
-        id: configGroup.get('id'),
-        data: putConfigGroup
-      },
-      success: 'successFunction',
-      error: 'errorFunction',
-      successFunction: function () {
-        if (successCallback) {
-          successCallback();
-        }
-      },
-      errorFunction: function (xhr, text, errorThrown) {
-        if (errorCallback) {
-          errorCallback(xhr, text, errorThrown);
-        }
-      }
-    };
-    sendData.sender = sendData;
-    App.ajax.send(sendData);
-  },
-
-  clearConfigurationGroupHosts: function (configGroup, successCallback, errorCallback) {
-    configGroup = jQuery.extend({}, configGroup);
-    configGroup.set('hosts', []);
-    this.updateConfigurationGroup(configGroup, successCallback, errorCallback);
-  },
-
-  deleteConfigGroup: function (configGroup, successCallback, errorCallback) {
-    var sendData = {
-      name: 'common.delete.config_group',
-      sender: this,
-      data: {
-        id: configGroup.get('id')
-      },
-      success: 'successFunction',
-      error: 'errorFunction',
-      successFunction: function () {
-        if (successCallback) {
-          successCallback();
-        }
-      },
-      errorFunction: function (xhr, text, errorThrown) {
-        if (errorCallback) {
-          errorCallback(xhr, text, errorThrown);
-        }
-      }
-    };
-    sendData.sender = sendData;
-    App.ajax.send(sendData);
-  },
 
   /**
    * Gets all the configuration-groups for the given service.

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/test/controllers/main/host/configs_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/configs_service_test.js b/ambari-web/test/controllers/main/host/configs_service_test.js
index a014e51..02b5b6b 100644
--- a/ambari-web/test/controllers/main/host/configs_service_test.js
+++ b/ambari-web/test/controllers/main/host/configs_service_test.js
@@ -126,17 +126,24 @@ describe('App.MainHostServiceConfigsController', function () {
 	});
 
 	describe("#switchHostGroup()", function () {
+
+    beforeEach(function() {
+      sinon.stub(controller, 'launchSwitchConfigGroupOfHostDialog', Em.K);
+      sinon.stub(controller, 'onConfigGroupChange', Em.K);
+    });
+
+    afterEach(function () {
+      controller.launchSwitchConfigGroupOfHostDialog.restore();
+      controller.onConfigGroupChange.restore();
+    });
+
 		it("should call launchSwitchConfigGroupOfHostDialog", function () {
-			sinon.stub(App.config, 'launchSwitchConfigGroupOfHostDialog', Em.K);
-			sinon.stub(controller, 'onConfigGroupChange', Em.K);
 			controller.set('selectedConfigGroup', {});
 			controller.set('configGroups', []);
 			controller.set('host', {hostName: 'host1'});
 			controller.switchHostGroup();
 
-			expect(App.config.launchSwitchConfigGroupOfHostDialog.calledWith({}, [], 'host1')).to.be.true;
-			App.config.launchSwitchConfigGroupOfHostDialog.restore();
-			controller.onConfigGroupChange.restore();
+			expect(controller.launchSwitchConfigGroupOfHostDialog.calledWith({}, [], 'host1')).to.be.true;
 		});
 	});
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8cdd1f55/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 87ff0db..470bc86 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -988,15 +988,15 @@ describe('App.WizardStep8Controller', function () {
 
   describe('#removeInstalledServicesConfigurationGroups', function() {
     beforeEach(function() {
-      sinon.stub(App.config, 'deleteConfigGroup', Em.K);
+      sinon.stub(installerStep8Controller, 'deleteConfigGroup', Em.K);
     });
     afterEach(function() {
-      App.config.deleteConfigGroup.restore();
+      installerStep8Controller.deleteConfigGroup.restore();
     });
     it('should call App.config.deleteConfigGroup for each received group', function() {
       var groups = [{}, {}, {}];
       installerStep8Controller.removeInstalledServicesConfigurationGroups(groups);
-      expect(App.config.deleteConfigGroup.callCount).to.equal(groups.length);
+      expect(installerStep8Controller.deleteConfigGroup.callCount).to.equal(groups.length);
     });
   });