Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 58451d8a6 -> 3d81a6a45


AMBARI-6289. Unable to manage config groups in Add Service Wizard 
(alexantonenko)


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

Branch: refs/heads/branch-1.6.1
Commit: 3d81a6a454de46eca41ca2f5138b57406f7802fc
Parents: 58451d8
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Thu Jun 26 21:17:19 2014 +0300
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Thu Jun 26 21:17:19 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/main/service/info/configs.js |  3 +++
 .../service/manage_config_groups_controller.js   |  5 ++++-
 ambari-web/app/controllers/wizard.js             | 19 +++++++++++++++++--
 ambari-web/app/routes/add_service_routes.js      |  2 +-
 ambari-web/app/utils/ajax/ajax.js                |  2 +-
 ambari-web/app/utils/config.js                   |  2 +-
 ambari-web/app/views/main/service/add_view.js    |  3 +++
 7 files changed, 30 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/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 6e2fcfc..5d583e8 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -1950,6 +1950,9 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend({
     var displayName = serviceData.get('displayName');
     App.router.get('manageConfigGroupsController').set('isInstaller', 
!!controller);
     App.router.get('manageConfigGroupsController').set('serviceName', 
serviceName);
+    if (controller) {
+      App.router.get('manageConfigGroupsController').set('isAddService', 
controller.get('content.controllerName') == 'addServiceController');
+    }
     return App.ModalPopup.show({
       header: 
Em.I18n.t('services.service.config_groups_popup.header').format(displayName),
       bodyClass: App.MainServiceManageConfigGroupView.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js 
b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index 9ff6a13..2849adb 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -28,6 +28,8 @@ App.ManageConfigGroupsController = Em.Controller.extend({
 
   isInstaller: false,
 
+  isAddService: false,
+
   serviceName: null,
 
   configGroups: [],
@@ -57,7 +59,8 @@ App.ManageConfigGroupsController = Em.Controller.extend({
   loadHosts: function() {
     this.set('isLoaded', false);
     if (this.get('isInstaller')) {
-      this.set('clusterHosts', 
App.router.get('installerController').get('allHosts'));
+      var allHosts = this.get('isAddService') ? 
App.router.get('addServiceController').get('allHosts') : 
App.router.get('installerController').get('allHosts');
+      this.set('clusterHosts', allHosts);
       this.loadConfigGroups(this.get('serviceName'));
     } else {
       this.loadHostsFromServer();

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js 
b/ambari-web/app/controllers/wizard.js
index b9aa10c..e3bf94d 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -65,18 +65,32 @@ App.WizardController = 
Em.Controller.extend(App.LocalStorage, {
 
     for (var hostName in dbHosts) {
       hostComponents = [];
+      var disksOverallCapacity = 0;
+      var diskFree = 0;
       dbHosts[hostName].hostComponents.forEach(function (componentName) {
         hostComponents.push(Em.Object.create({
           componentName: componentName,
           displayName: App.format.role(componentName)
         }));
       });
+      dbHosts[hostName].disk_info.forEach(function (disk) {
+        disksOverallCapacity += parseFloat(disk.size);
+        diskFree += parseFloat(disk.available);
+      });
 
       hosts.push(Em.Object.create({
+        id: hostName,
         hostName: hostName,
+        publicHostName: hostName,
         diskInfo: dbHosts[hostName].disk_info,
+        diskTotal: disksOverallCapacity / (1024 * 1024),
+        diskFree: diskFree / (1024 * 1024),
+        disksMounted: dbHosts[hostName].disk_info.length,
         cpu: dbHosts[hostName].cpu,
         memory: dbHosts[hostName].memory,
+        osType: dbHosts[hostName].osType ? dbHosts[hostName].osType: 0,
+        osArch: dbHosts[hostName].osArch ? dbHosts[hostName].osArch : 0,
+        ip: dbHosts[hostName].ip ? dbHosts[hostName].ip: 0,
         hostComponents: hostComponents
       }))
     }
@@ -866,11 +880,12 @@ App.WizardController = 
Em.Controller.extend(App.LocalStorage, {
   /**
    * save Config groups
    * @param stepController
+   * @param isAddService
    */
-  saveServiceConfigGroups: function (stepController) {
+  saveServiceConfigGroups: function (stepController, isAddService) {
     var serviceConfigGroups = [],
       isForUpdate = false,
-      hosts = this.getDBProperty('hosts');
+      hosts = isAddService ? 
App.router.get('addServiceController').getDBProperty('hosts') : 
this.getDBProperty('hosts');
     stepController.get('stepConfigs').forEach(function (service) {
       // mark group of installed service
       if (service.get('selected') === false) isForUpdate = true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js 
b/ambari-web/app/routes/add_service_routes.js
index 0a5a545..b292e77 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -208,7 +208,7 @@ module.exports = App.WizardRoute.extend({
       var wizardStep7Controller = router.get('wizardStep7Controller');
       addServiceController.saveServiceConfigProperties(wizardStep7Controller);
       if (App.supports.hostOverrides) {
-        addServiceController.saveServiceConfigGroups(wizardStep7Controller);
+        addServiceController.saveServiceConfigGroups(wizardStep7Controller, 
true);
       }
       router.transitionTo('step5');
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js 
b/ambari-web/app/utils/ajax/ajax.js
index 82054a2..fe352ce 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2075,7 +2075,7 @@ var urls = {
     'mock': ''
   },
   'hosts.confirmed': {
-    'real': 
'/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,host_components/HostRoles/state&minimal_response=true',
+    'real': 
'/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/os_type,Hosts/os_arch,Hosts/ip,host_components/HostRoles/state&minimal_response=true',
     'mock': ''
   },
   'host_components.all': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 5304eda..90ad76b 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1130,7 +1130,7 @@ App.config = Em.Object.create({
     var installerController = App.router.get('installerController');
     var step7Controller = App.router.get('wizardStep7Controller');
     if (App.supports.hostOverridesInstaller) {
-      installerController.saveServiceConfigGroups(step7Controller);
+      installerController.saveServiceConfigGroups(step7Controller, 
step7Controller.get('content.controllerName') == 'addServiceController');
       App.clusterStatus.setClusterStatus({
         localdb: App.db.data
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d81a6a4/ambari-web/app/views/main/service/add_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/add_view.js 
b/ambari-web/app/views/main/service/add_view.js
index 4cb4800..032ca5c 100644
--- a/ambari-web/app/views/main/service/add_view.js
+++ b/ambari-web/app/views/main/service/add_view.js
@@ -83,6 +83,9 @@ App.AddServiceView = Em.View.extend({
         cpu: item.Hosts.cpu_count,
         memory: item.Hosts.total_mem,
         disk_info: item.Hosts.disk_info,
+        osType: item.Hosts.os_type,
+        osArch: item.Hosts.os_arch,
+        ip: item.Hosts.ip,
         bootStatus: "REGISTERED",
         isInstalled: true,
         hostComponents: item.host_components,

Reply via email to