浏览代码

AMBARI-1145. Cluster Management refactoring. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431859 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 年之前
父节点
当前提交
a219509ebc
共有 33 个文件被更改,包括 248 次插入518 次删除
  1. 2 2
      ambari-web/app/controllers/global/cluster_controller.js
  2. 26 130
      ambari-web/app/controllers/main/host.js
  3. 1 1
      ambari-web/app/controllers/main/host/add_controller.js
  4. 5 5
      ambari-web/app/controllers/main/host/details.js
  5. 2 2
      ambari-web/app/controllers/main/service/add_controller.js
  6. 5 5
      ambari-web/app/controllers/main/service/info/configs.js
  7. 11 6
      ambari-web/app/controllers/main/service/item.js
  8. 1 2
      ambari-web/app/controllers/wizard/step10_controller.js
  9. 1 1
      ambari-web/app/controllers/wizard/step5_controller.js
  10. 2 5
      ambari-web/app/mappers/hosts_mapper.js
  11. 7 47
      ambari-web/app/mappers/service_mapper.js
  12. 0 16
      ambari-web/app/mappers/status_mapper.js
  13. 7 8
      ambari-web/app/messages.js
  14. 0 1
      ambari-web/app/models.js
  15. 0 103
      ambari-web/app/models/component.js
  16. 1 2
      ambari-web/app/models/host.js
  17. 7 4
      ambari-web/app/models/host_component.js
  18. 9 10
      ambari-web/app/models/service.js
  19. 9 0
      ambari-web/app/styles/application.less
  20. 1 1
      ambari-web/app/templates/main/service/info/summary.hbs
  21. 1 1
      ambari-web/app/templates/main/service/info/summary/ganglia.hbs
  22. 1 1
      ambari-web/app/templates/main/service/info/summary/oozie.hbs
  23. 1 1
      ambari-web/app/templates/main/service/item.hbs
  24. 23 29
      ambari-web/app/templates/wizard/step2.hbs
  25. 55 0
      ambari-web/app/utils/component.js
  26. 4 4
      ambari-web/app/views/common/quick_view_link_view.js
  27. 1 1
      ambari-web/app/views/main/dashboard/service/hbase.js
  28. 1 1
      ambari-web/app/views/main/dashboard/service/hdfs.js
  29. 1 1
      ambari-web/app/views/main/dashboard/service/mapreduce.js
  30. 16 40
      ambari-web/app/views/main/host.js
  31. 8 8
      ambari-web/app/views/main/host/summary.js
  32. 7 7
      ambari-web/app/views/main/service/info/summary.js
  33. 32 73
      ambari-web/app/views/wizard/step2_view.js

+ 2 - 2
ambari-web/app/controllers/global/cluster_controller.js

@@ -94,7 +94,7 @@ App.ClusterController = Em.Controller.extend({
       var svcs = App.Service.find();
       var gangliaSvc = svcs.findProperty("serviceName", "GANGLIA");
       if (gangliaSvc) {
-        var svcComponents = gangliaSvc.get('components');
+        var svcComponents = gangliaSvc.get('hostComponents');
         if (svcComponents) {
           var gangliaSvcComponent = svcComponents.findProperty("componentName", "GANGLIA_SERVER");
           if (gangliaSvcComponent) {
@@ -128,7 +128,7 @@ App.ClusterController = Em.Controller.extend({
       var svcs = App.Service.find();
       var nagiosSvc = svcs.findProperty("serviceName", "NAGIOS");
       if (nagiosSvc) {
-        var svcComponents = nagiosSvc.get('components');
+        var svcComponents = nagiosSvc.get('hostComponents');
         if (svcComponents) {
           var nagiosSvcComponent = svcComponents.findProperty("componentName", "NAGIOS_SERVER");
           if (nagiosSvcComponent) {

+ 26 - 130
ambari-web/app/controllers/main/host.js

@@ -18,161 +18,51 @@
 
 var App = require('app');
 var validator = require('utils/validator');
+var componentHelper = require('utils/component');
 
 App.MainHostController = Em.ArrayController.extend({
   name:'mainHostController',
-  content:[],
+  content: App.Host.find(),
   comeWithFilter: false,
-  fullContent:App.Host.find(),
-  clusters:App.Cluster.find(),
 
   isAdmin: function(){
-    return App.db.getUser().admin;
+    return App.router.getUser().admin;
   }.property('App.router.loginController.loginName'),
+
+  /**
+   * Components which will be shown in component filter
+   */
   componentsForFilter:function() {
-    var components = App.Component.find();
-    var ret = new Array();
-    if (!components) {
-      return ret;
-    }
-    components.forEach(function(item) {
-      var o = Ember.Object.create({
-        id: item.get('id'),
-        isMaster: item.get('isMaster'),
-        isSlave: item.get('isSlave'),
-        displayName: item.get('displayName'),
-        componentName: item.get('componentName'),
-        checkedForHostFilter: item.get('checkedForHostFilter')
-      });
-      ret.push(o);
-    });
-    return ret;
+    var installedComponents = componentHelper.getInstalledComponents();
+    installedComponents.setEach('checkedForHostFilter', false);
+    return installedComponents;
   }.property(),
 
-  totalBinding:'fullContent.length',
-  filters:{components:[]},
-  isDisabled:true,
-
-  checkRemoved:function (host_id) {
-    var hosts = this.get('content');
-    var selectedHosts = hosts.filterProperty('id', host_id);
-    this.get('fullContent').removeObjects(selectedHosts);
-  },
-
   masterComponents:function () {
-    var components = [];
-    this.get('componentsForFilter').forEach(function (component) {
-      if (component.get('isMaster')) {
-        components.push(component);
-      }
-    });
-    return components;
+    return this.get('componentsForFilter').filterProperty('isMaster', true);
   }.property('componentsForFilter'),
 
   slaveComponents:function () {
-    var components = [];
-    this.get('componentsForFilter').forEach(function (component) {
-      if (component.get('isSlave')) {
-        components.push(component);
-      }
-    });
-    return components;
+    return this.get('componentsForFilter').filterProperty('isSlave', true);
   }.property('componentsForFilter'),
 
   clientComponents: function() {
-    var components = [];
-    this.get('componentsForFilter').forEach(function(component) {
-      if (!component.get('isMaster') && !component.get('isSlave')) {
-        components.push(component);
-      }
-    });
-    return components;
+    return this.get('componentsForFilter').filterProperty('isClient', true);
   }.property('componentsForFilter'),
 
-  backgroundOperationsCount:function () {
-    return 5;
-  }.property(),
-
-  checkedComponentsIds:function () {
-    var checked = [];
-    this.get('componentsForFilter').forEach(function (comp) {
-      if (comp.get('checkedForHostFilter'))
-        checked.push(comp.get('id'));
-    });
-
-    return checked;
-  },
-
+  /**
+   * Filter hosts by componentName of <code>component</code>
+   * @param component App.HostComponent
+   */
   filterByComponent:function (component) {
-    var id = component.get('id');
-    /*this.get('componentsForFilter').setEach('isChecked', false);
-    component.set('isChecked', true);*/
+    var id = component.get('componentName');
+
     this.get('componentsForFilter').setEach('checkedForHostFilter', false);
     this.get('componentsForFilter').filterProperty('id', id).setEach('checkedForHostFilter', true);
-    //component.set('checkedForHostFilter', true);
-    this.set('filters.components', [component.get('id')]);
-    console.log(this.get('filters.components').objectAt(0));
-    this.set('comeWithFilter', true);
-  },
-
-
-  applyHostFilters:function (items) {
-
-    var field = 'hostName'; // make this function universal
-    var value = this.get('hostFilter' + field);
-
-    var itemsToDelete = [];
-    if (value) {
-      items.forEach(function (host, index) {
-        if (host) {
-          var fieldValue = host.get(field);
-          if (fieldValue) {
-            if (fieldValue.indexOf(value) == -1) {
-              itemsToDelete.push(host);
-            }
-          }
-        }
-      });
-    }
 
-    if (itemsToDelete.length) {
-      itemsToDelete.forEach(function (hostToDelete) {
-        var index = items.indexOf(hostToDelete);
-        items.removeAt(index);
-      })
-    }
-
-    return items;
+    this.set('comeWithFilter', true);
   },
 
-  changeContent:function () {
-    var items = [];
-    var filters = this.get('filters.components');
-    this.get('fullContent').forEach(function (item) {
-      if (filters.length) {
-        var inFilters = false;
-        item.get('components').forEach(function (component) {
-          if (filters.indexOf(component.get('id')) != -1) {
-            inFilters = true;
-          }
-        });
-
-
-        if (inFilters) {
-          items.push(item);
-        }
-      }
-      else {
-        items.push(item);
-      }
-    });
-
-    items = this.applyHostFilters(items);
-    this.set('total', items.length);
-
-    this.replace(0, this.get('length'), items);
-  }.observes('total'),
-
   decommissionButtonPopup:function () {
     var self = this;
     App.ModalPopup.show({
@@ -212,6 +102,12 @@ App.MainHostController = Em.ArrayController.extend({
       console.log('Removing:  ' + _hostInfo.hostName);
     });
     this.get('fullContent').removeObjects(selectedHosts);
+  },
+
+  checkRemoved:function (host_id) {
+    var hosts = this.get('content');
+    var selectedHosts = hosts.filterProperty('id', host_id);
+    this.get('fullContent').removeObjects(selectedHosts);
   }
 
 });

+ 1 - 1
ambari-web/app/controllers/main/host/add_controller.js

@@ -156,7 +156,7 @@ App.AddHostController = App.WizardController.extend({
     var masterComponentHosts = App.db.getMasterComponentHosts();
     if (!masterComponentHosts) {
       masterComponentHosts = [];
-      App.Component.find().filterProperty('isMaster', true).forEach(function (item) {
+      App.HostComponent.find().filterProperty('isMaster', true).forEach(function (item) {
         masterComponentHosts.push({
           component: item.get('componentName'),
           hostName: item.get('host.hostName'),

+ 5 - 5
ambari-web/app/controllers/main/host/details.js

@@ -97,9 +97,9 @@ App.MainHostDetailsController = Em.Controller.extend({
           console.log('Send request for STARTING successfully');
 
           if (App.testMode) {
-            component.set('workStatus', App.Component.Status.starting);
+            component.set('workStatus', App.HostComponentStatus.starting);
             setTimeout(function(){
-              component.set('workStatus', App.Component.Status.started);
+              component.set('workStatus', App.HostComponentStatus.started);
             },10000);
           } else {
             App.router.get('clusterController').loadUpdatedStatusDelayed(500);
@@ -148,9 +148,9 @@ App.MainHostDetailsController = Em.Controller.extend({
           console.log('Send request for STOPPING successfully');
 
           if (App.testMode) {
-            component.set('workStatus', App.Component.Status.stopping);
+            component.set('workStatus', App.HostComponentStatus.stopping);
             setTimeout(function(){
-              component.set('workStatus', App.Component.Status.stopped);
+              component.set('workStatus', App.HostComponentStatus.stopped);
             },10000);
           } else {
             App.router.get('clusterController').loadUpdatedStatus();
@@ -322,7 +322,7 @@ App.MainHostDetailsController = Em.Controller.extend({
    * var components = this.get('content.components');
    * components.forEach(function (cInstance) { var cName =
    * cInstance.get('componentName'); if (slaveComponents.contains(cName)) { if
-   * (cInstance.get('workStatus') === App.Component.Status.stopped &&
+   * (cInstance.get('workStatus') === App.HostComponentStatus.stopped &&
    * !cInstance.get('decommissioned')) { workingComponents.push(cName); } } else {
    * masterComponents.push(cName); } }); // debugger; if
    * (workingComponents.length || masterComponents.length) {

+ 2 - 2
ambari-web/app/controllers/main/service/add_controller.js

@@ -161,7 +161,7 @@ App.AddServiceController = App.WizardController.extend({
   saveMasterComponentHosts: function (stepController) {
     var obj = stepController.get('selectedServicesMasters');
     var masterComponentHosts = [];
-    var installedComponents = App.Component.find();
+    var installedComponents = App.HostComponent.find();
 
     obj.forEach(function (_component) {
         masterComponentHosts.push({
@@ -187,7 +187,7 @@ App.AddServiceController = App.WizardController.extend({
     var masterComponentHosts = App.db.getMasterComponentHosts();
     if(!masterComponentHosts){
       masterComponentHosts = [];
-      App.Component.find().filterProperty('isMaster', true).forEach(function(item){
+      App.HostComponent.find().filterProperty('isMaster', true).forEach(function(item){
         masterComponentHosts.push({
           component: item.get('componentName'),
           hostName: item.get('host.hostName'),

+ 5 - 5
ambari-web/app/controllers/main/service/info/configs.js

@@ -987,27 +987,27 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     switch (serviceName) {
       case 'HDFS':
         var sNameNodeHost = serviceConfigs.findProperty('name', 'snamenode_host');
-        sNameNodeHost.defaultValue = this.get('content.components').findProperty('componentName', 'SECONDARY_NAMENODE').get('host.hostName');
+        sNameNodeHost.defaultValue = this.get('content.hostComponents').findProperty('componentName', 'SECONDARY_NAMENODE').get('host.hostName');
         globalConfigs.push(sNameNodeHost);
         break;
       case 'MAPREDUCE':
         var jobTrackerHost = serviceConfigs.findProperty('name', 'jobtracker_host');
-        jobTrackerHost.defaultValue = this.get('content.components').findProperty('componentName', 'JOBTRACKER').get('host.hostName');
+        jobTrackerHost.defaultValue = this.get('content.hostComponents').findProperty('componentName', 'JOBTRACKER').get('host.hostName');
         globalConfigs.push(jobTrackerHost);
         break;
       case 'HIVE':
         var hiveMetastoreHost = serviceConfigs.findProperty('name', 'hivemetastore_host');
-        hiveMetastoreHost.defaultValue = this.get('content.components').findProperty('componentName', 'HIVE_SERVER').get('host.hostName');
+        hiveMetastoreHost.defaultValue = this.get('content.hostComponents').findProperty('componentName', 'HIVE_SERVER').get('host.hostName');
         globalConfigs.push(hiveMetastoreHost);
         break;
       case 'OOZIE':
         var oozieServerHost = serviceConfigs.findProperty('name', 'oozieserver_host');
-        oozieServerHost.defaultValue = this.get('content.components').findProperty('componentName', 'OOZIE_SERVER').get('host.hostName');
+        oozieServerHost.defaultValue = this.get('content.hostComponents').findProperty('componentName', 'OOZIE_SERVER').get('host.hostName');
         globalConfigs.push(oozieServerHost);
         break;
       case 'HBASE':
         var hbaseMasterHost = serviceConfigs.findProperty('name', 'hbasemaster_host');
-        hbaseMasterHost.defaultValue = this.get('content.components').findProperty('componentName', 'HBASE_MASTER').get('host.hostName');
+        hbaseMasterHost.defaultValue = this.get('content.hostComponents').findProperty('componentName', 'HBASE_MASTER').get('host.hostName');
         globalConfigs.push(hbaseMasterHost);
         break;
     }

+ 11 - 6
ambari-web/app/controllers/main/service/item.js

@@ -76,7 +76,6 @@ App.MainServiceItemController = Em.Controller.extend({
       primary: 'Yes',
       secondary: 'No',
       onPrimary: function () {
-        self.get('content.components').setEach('workStatus', App.Component.Status.starting);
         self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT", {
           ServiceInfo: {
             state: 'STARTED'
@@ -89,9 +88,11 @@ App.MainServiceItemController = Em.Controller.extend({
           console.log('Send request for STARTING successfully');
 
           if (App.testMode) {
-            self.content.set('workStatus', App.Service.Health.starting);
+            self.set('content.workStatus', App.Service.Health.starting);
+            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.starting);
             setTimeout(function () {
-              self.content.set('workStatus', App.Service.Health.live);
+              self.set('content.workStatus', App.Service.Health.live);
+              self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.started);
             }, 10000);
           } else {
             App.router.get('clusterController').loadUpdatedStatusDelayed(500);
@@ -134,7 +135,6 @@ App.MainServiceItemController = Em.Controller.extend({
       primary: 'Yes',
       secondary: 'No',
       onPrimary: function() {
-        self.get('content.components').setEach('workStatus', App.Component.Status.stopping);
         self.sendCommandToServer('/services/' + self.get('content.serviceName').toUpperCase(), "PUT",{
           ServiceInfo:{
             state: 'INSTALLED'
@@ -145,9 +145,11 @@ App.MainServiceItemController = Em.Controller.extend({
           }
           console.log('Send request for STOPPING successfully');
           if (App.testMode) {
-            self.content.set('workStatus', App.Service.Health.stopping);
+            self.set('content.workStatus', App.Service.Health.stopping);
+            self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopping);
             setTimeout(function () {
-              self.content.set('workStatus', App.Service.Health.dead);
+              self.set('content.workStatus', App.Service.Health.dead);
+              self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus.stopped);
             }, 10000);
           } else {
             App.router.get('clusterController').loadUpdatedStatusDelayed(500);
@@ -237,6 +239,9 @@ App.MainServiceItemController = Em.Controller.extend({
     });
   },
   doAction: function (event) {
+    if ($(event.target).hasClass('disabled') || $(event.target.parentElement).hasClass('disabled')) {
+      return;
+    }
     var methodName = event.context;
     switch (methodName) {
       case 'runRebalancer':

+ 1 - 2
ambari-web/app/controllers/wizard/step10_controller.js

@@ -19,11 +19,10 @@
 var App = require('app');
 
 App.WizardStep10Controller = Em.Controller.extend({
-  name: 'wizardStep10Controller',
   clusterInfo: [],
 
   isNagiosRestartRequired: function() {
-    return App.db.getSelectedServiceNames().contains('NAGIOS') && this.get('content.controllerName') !== 'installerController';
+    return this.get('content.controllerName') !== 'installerController' && App.db.getSlaveComponentHosts().findProperty('componentName', 'HBASE_REGIONSERVER').hosts.length;
   }.property(),
 
   clearStep: function () {

+ 1 - 1
ambari-web/app/controllers/wizard/step5_controller.js

@@ -161,7 +161,7 @@ App.WizardStep5Controller = Em.Controller.extend({
           componentObj.component_name = _componentInfo.component_name;
           componentObj.display_name = _componentInfo.display_name;
           componentObj.selectedHost = savedComponent ? savedComponent.hostName : this.selectHost(_componentInfo.component_name);   // call the method that plays selectNode algorithm or fetches from server
-          componentObj.isInstalled = savedComponent ? savedComponent.isInstalled : App.Component.find().someProperty('componentName', _componentInfo.component_name);
+          componentObj.isInstalled = savedComponent ? savedComponent.isInstalled : App.HostComponent.find().someProperty('componentName', _componentInfo.component_name);
           componentObj.serviceId = services[index];
           componentObj.availableHosts = [];
           componentObj.isHiveCoHost = ['HIVE_METASTORE', 'WEBHCAT_SERVER'].contains(_componentInfo.component_name);

+ 2 - 5
ambari-web/app/mappers/hosts_mapper.js

@@ -15,6 +15,8 @@
  * the License.
  */
 
+var App = require('app');
+
 App.hostsMapper = App.QuickDataMapper.create({
   model: App.Host,
   tmp_result:[],
@@ -23,11 +25,6 @@ App.hostsMapper = App.QuickDataMapper.create({
     host_name: 'Hosts.host_name',
     public_host_name: 'Hosts.public_host_name',
     cluster_id: 'Hosts.cluster_name',// 1
-    components_key: 'host_components',
-    components_type: 'array',
-    components: {
-      item: 'HostRoles.component_name'
-    },
     rack: 'Hosts.rack_info',
     host_components_key: 'host_components',
     host_components_type: 'array',

+ 7 - 47
ambari-web/app/mappers/service_mapper.js

@@ -14,6 +14,8 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
+
+var App = require('app');
 var stringUtils = require('utils/string_utils');
 
 App.servicesMapper = App.QuickDataMapper.create({
@@ -49,11 +51,6 @@ App.servicesMapper = App.QuickDataMapper.create({
     work_status: 'ServiceInfo.state',
     $service_audit: [ 1, 2, 3 ],
     $alerts: [ 1, 2, 3 ],
-    components_key: 'components',
-    components_type: 'array',
-    components: {
-      item: 'ServiceComponentInfo.component_name'
-    },
     host_components: 'host_components'
   },
   hdfsConfig: {
@@ -115,21 +112,6 @@ App.servicesMapper = App.QuickDataMapper.create({
     heap_memory_max: 'masterComponent.ServiceComponentInfo.HeapMemoryMax'
   },
 
-  model2: App.Component,
-  config2: {
-    id: 'ServiceComponentInfo.component_name',
-    component_name: 'ServiceComponentInfo.component_name',
-    service_id: 'ServiceComponentInfo.service_name',
-    // TODO - PROBLEM:
-    // below statements are a problem for multiple 
-    // host_component components. Because it randomly
-    // picks one of the hosts. Especially the host details
-    // page must be careful because, it will randomly
-    // pick a host.
-    work_status: 'host_components[0].HostRoles.state',
-    host_id: 'host_components[0].HostRoles.host_name'
-  },
-
   model3: App.HostComponent,
   config3: {
     id: 'id',
@@ -137,7 +119,7 @@ App.servicesMapper = App.QuickDataMapper.create({
     desired_status: 'HostRoles.desired_state',
     component_name: 'HostRoles.component_name',
     host_id: 'HostRoles.host_name',
-    service_id: 'component[0].ServiceComponentInfo.service_name'
+    $service_id: 'none' /* will be set outside of parse function */
   },
 
   map: function (json) {
@@ -195,37 +177,15 @@ App.servicesMapper = App.QuickDataMapper.create({
       result = this.sortByOrder(this.get('servicesSortOrder'), result);
       App.store.loadMany(this.get('model'), result);
 
-      // Service components
-      result = [];
-      json.items.forEach(function(item){
-        item.components.forEach(function(component){
-          result.push(this.parseIt(component, this.config2));
-        }, this)
-      }, this);
-      var newComponents = [];
-      result.forEach(function(componentJson){
-        var component = App.Component.find(componentJson.id);
-        if (component && component.get('isLoaded')) { // UPDATE
-          if (componentJson.work_status) {
-            component.set('workStatus', componentJson.work_status);
-          }
-          if (componentJson.host_id) {
-            component.set('host', App.Host.find(componentJson.host_id));
-          }
-        } else {
-          newComponents.push(componentJson);
-        }
-      });
-      if (newComponents.length > 0) {
-        App.store.loadMany(this.get('model2'), newComponents);
-      }
-
       // Host components
       result = [];
       json.items.forEach(function(item){
         item.components.forEach(function(component){
+          var service = component.ServiceComponentInfo.service_name;
           component.host_components.forEach(function(host_component){
-            result.push(this.parseIt(host_component, this.config3));
+            var comp = this.parseIt(host_component, this.config3);
+            comp.service_id = service;
+            result.push(comp);
           }, this)
         }, this)
       }, this);

+ 0 - 16
ambari-web/app/mappers/status_mapper.js

@@ -59,22 +59,6 @@ App.statusMapper = App.QuickDataMapper.create({
         }
       })
 
-      result = [];
-      json.items.forEach(function (item) {
-        item.components.forEach(function (component) {
-          result.push(this.parseIt(component, this.config2));
-        }, this)
-      }, this);
-
-      //console.log(result)
-      var components = App.Component.find();
-      result.forEach(function(item){
-        var component = components.findProperty('id', item.id);
-        if(component){
-          component.set('workStatus', item.work_status);
-        }
-      })
-
       result = [];
       json.items.forEach(function (item) {
         item.components.forEach(function (component) {

+ 7 - 8
ambari-web/app/messages.js

@@ -79,11 +79,11 @@ Em.I18n.translations = {
   'installer.step2.hostName.error.notRequired':'Host Names will be ignored if not using SSH to automatically configure hosts',
   'installer.step2.hostName.error.invalid':'Invalid Host Name(s)',
   'installer.step2.hostName.pattern.header':'Host name pattern expressions',
-  'installer.step2.sshKey':'Host Connectivity Information',
+  'installer.step2.sshKey':'Host Registration Information',
   'installer.step2.sshKey.error.required':'SSH Private Key is required',
   'installer.step2.passphrase.error.match':'Passphrases do not match',
   'installer.step2.manualInstall.label':'Do not use SSH to automatically configure hosts ',
-  'installer.step2.manualInstall.info':'By not using SSH to connect to the target hosts, you must manually install and start the ' +
+  'installer.step2.manualInstall.info':'By not using SSH to connect to the target hosts, you must manually install the ' +
     'Ambari Agent on each host in order for the wizard to perform the necessary configurations and software installs.',
   'installer.step2.advancedOption':'Advanced Options',
   'installer.step2.repoConf':'Software Repository Configuration File Path',
@@ -92,22 +92,22 @@ Em.I18n.translations = {
   'installer.step2.localRepo.label_instead':'instead of downloading software packages from the Internet',
   'installer.step2.localRepo.error.required':'Local repository file path is required',
   'installer.step2.localRepo.tooltip.title':'Local Software Repository',
-  'installer.step2.localRepo.tooltip.content': 'The install process requires access to the Internet to fetch software ' +
+  'installer.step2.localRepo.tooltip.content': 'The cluster install requires access to the Internet to fetch software ' +
     'from a remote repository. In some cases, adequate bandwidth is not available and you want to prevent downloading ' +
     'packages from the remote repository over and over again. Other times, Internet access is not available from the ' +
     'hosts in your cluster. In these situations, you must set up a version of the repository that your machines can ' +
     'access locally and this is called a <b>Local Software Repository</b>',
   'installer.step2.javaHome.label' : 'Path to 64-bit JDK',
-  'installer.step2.javaHome.label2' : 'on all hosts',
   'installer.step2.javaHome.tooltip.title' : 'JAVA_HOME',
   'installer.step2.javaHome.tooltip.content' : 'Path to 64-bit JAVA_HOME. /usr/jdk/jdk1.6.0_31 is the default used by Ambari. You can override this to a specific path that contains the JDK. <br/> Note: the path must be valid on <b>ALL</b> hosts in your cluster.',
   'installer.step2.useSsh.provide' : 'Provide your',
   'installer.step2.useSsh.provide_id_rsa' : '(id_rsa for root) and use SSH to automatically register hosts',
   'installer.step2.useSsh.tooltip.title':'SSH Private Key',
   'installer.step2.useSsh.tooltip.content':'The <b>SSH Private Key File</b> is used for the root access to the target hosts in your cluster.',
-  'installer.step2.manualInstall.tooltip.title':'Not Using SSH (Manual Install)',
-  'installer.step2.manualInstall.tooltip.content':'If you do not wish Ambari to automatically configure the target hosts via SSH,' +
-    ' you have the option of configuring them yourself.  This involves installing and starting Ambari Agent on each of your target hosts.',
+  'installer.step2.manualInstall.perform':'Perform',
+  'installer.step2.manualInstall.perform_on_hosts':'on hosts and do not use SSH',
+  'installer.step2.manualInstall.tooltip.title':'manual registration',
+  'installer.step2.manualInstall.tooltip.content':'Manually registering the Ambari Agent on each host eliminates the need for SSH and should be performed prior to continuing cluster installation.',
   'installer.step2.manualInstall.popup.header':'Before You Proceed',
   'installer.step2.manualInstall.popup.body':'You must install Ambari Agents on each host you want to manage before you proceed.',
 
@@ -289,7 +289,6 @@ Em.I18n.translations = {
   'hosts.cant.do.popup.masterList.body':'You cannot delete this host because it is hosting following master services: {0}.',
   'hosts.cant.do.popup.workingList.body':'You cannot delete this host because following slave services are not fully stopped or decommissioned: {0}.',
   'hosts.add.header':'Add Host Wizard',
-  'hosts.add.step2.warning':'Hosts are already part of the cluster and will be ignored',
   'hosts.assignRack':'Assign Rack',
 
   'charts.horizon.chart.showText':'show',

+ 0 - 1
ambari-web/app/models.js

@@ -26,7 +26,6 @@ require('models/cluster_states');
 require('models/hosts');
 require('models/quick_links');
 require('models/service');
-require('models/component');
 require('models/service_config');
 require('models/service_audit');
 require('models/service/hdfs');

+ 0 - 103
ambari-web/app/models/component.js

@@ -1,103 +0,0 @@
-/**
- * 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');
-
-App.Component = DS.Model.extend({
-
-  componentName: DS.attr('string'),
-
-  displayName: function () {
-    return App.format.role(this.get('componentName'));
-  }.property('componentName'),
-
-  service: DS.belongsTo('App.Service'),
-  //service_id: DS.attr('string'),
-
-  host: DS.belongsTo('App.Host'),
-  //host_id: DS.attr('string'),
-
-  workStatus: DS.attr('string'),
-
-  isMaster: function () {
-    switch (this.get('componentName')) {
-      case 'NAMENODE':
-      case 'SECONDARY_NAMENODE':
-      case 'SNAMENODE':
-      case 'JOBTRACKER':
-      case 'ZOOKEEPER_SERVER':
-      case 'HIVE_SERVER':
-      case 'HIVE_METASTORE':
-      case 'MYSQL_SERVER':
-      case 'HBASE_MASTER':
-      case 'NAGIOS_SERVER':
-      case 'GANGLIA_SERVER':
-      case 'OOZIE_SERVER':
-      case 'WEBHCAT_SERVER':
-        return true;
-      default:
-        return false;
-    }
-    return this.get('componentName');
-  }.property('componentName'),
-  isSlave: function(){
-    switch (this.get('componentName')) {
-      case 'DATANODE':
-      case 'TASKTRACKER':
-      case 'HBASE_REGIONSERVER':
-      case 'GANGLIA_MONITOR':
-        return true;
-      default:
-        return false;
-    }
-    return this.get('componentName');
-  }.property('componentName')
-});
-
-App.Component.Status = {
-  started: "STARTED",
-  starting: "STARTING",
-  stopped: "INSTALLED",
-  stopping: "STOPPING",
-  stop_failed: "STOP_FAILED",
-  start_failed: "START_FAILED",
-  install_failed: "INSTALL_FAILED",
-
-  getKeyName:function(value){
-    switch(value){
-      case this.started:
-        return 'started';
-      case this.starting:
-        return 'starting';
-      case this.stopped:
-        return 'installed';
-      case this.stopping:
-        return 'stopping';
-      case this.stop_failed:
-        return 'stop_failed';
-      case this.start_failed:
-        return 'start_failed';
-      case this.install_failed:
-         return 'install_failed';
-    }
-    return 'none';
-  }
-}
-
-App.Component.FIXTURES = [];
-

+ 1 - 2
ambari-web/app/models/host.js

@@ -34,7 +34,6 @@ App.Host = DS.Model.extend({
   hostName: DS.attr('string'),
   publicHostName: DS.attr('string'),
   cluster: DS.belongsTo('App.Cluster'),
-  components: DS.hasMany('App.Component'),
   hostComponents: DS.hasMany('App.HostComponent'),
   cpu: DS.attr('string'),
   memory: DS.attr('string'),
@@ -130,7 +129,7 @@ App.Host = DS.Model.extend({
     } else {
       var status;
       var masterComponents = this.get('hostComponents').filterProperty('isMaster', true);
-      var masterComponentsRunning = masterComponents.everyProperty('workStatus', App.HostComponent.Status.started);
+      var masterComponentsRunning = masterComponents.everyProperty('workStatus', App.HostComponentStatus.started);
       if (this.get('isNotHeartBeating')) {
         status = 'DEAD-YELLOW';
       } else if (masterComponentsRunning) {

+ 7 - 4
ambari-web/app/models/host_component.js

@@ -83,15 +83,18 @@ App.HostComponent = DS.Model.extend({
     }
     return decommissioning;
   }.property('componentName', 'host.hostName', 'App.router.mainServiceController.hdfsService.decommissionDataNodes.@each.hostName')
-})
+});
 
-App.HostComponent.Status = {
+App.HostComponent.FIXTURES = [];
+
+App.HostComponentStatus = {
   started: "STARTED",
   starting: "STARTING",
   stopped: "INSTALLED",
   stopping: "STOPPING",
   stop_failed: "STOP_FAILED",
   start_failed: "START_FAILED",
+  install_failed: "INSTALL_FAILED",
 
   getKeyName:function(value){
     switch(value){
@@ -107,10 +110,10 @@ App.HostComponent.Status = {
         return 'stop_failed';
       case this.start_failed:
         return 'start_failed';
+      case this.install_failed:
+        return 'install_failed';
     }
     return 'none';
   }
 }
 
-App.HostComponent.FIXTURES = [];
-

+ 9 - 10
ambari-web/app/models/service.js

@@ -27,7 +27,6 @@ App.Service = DS.Model.extend({
   workStatus: DS.attr('string'),
   alerts: DS.hasMany('App.Alert'),
   quickLinks: DS.hasMany('App.QuickLinks'),
-  components: DS.hasMany('App.Component'),
   hostComponents: DS.hasMany('App.HostComponent'),
   isStartDisabled: function () {
     return !(this.get('healthStatus') == 'red');
@@ -39,11 +38,11 @@ App.Service = DS.Model.extend({
 
   healthStatus: function () {
     var components = this.get('hostComponents').filterProperty('isMaster', true);
-    if (components.everyProperty('workStatus', App.HostComponent.Status.started)) {
+    if (components.everyProperty('workStatus', App.HostComponentStatus.started)) {
       return 'green';
-    } else if (components.someProperty('workStatus', App.HostComponent.Status.starting)) {
+    } else if (components.someProperty('workStatus', App.HostComponentStatus.starting)) {
       return 'green-blinking';
-    } else if (components.someProperty('workStatus', App.HostComponent.Status.stopped)) {
+    } else if (components.someProperty('workStatus', App.HostComponentStatus.stopped)) {
       return 'red';
     } else {
       return 'red-blinking';
@@ -51,20 +50,20 @@ App.Service = DS.Model.extend({
   }.property('hostComponents.@each.workStatus'),
 
   isStopped: function () {
-    var components = this.get('components');
+    var components = this.get('hostComponents');
     var flag = true;
     components.forEach(function (_component) {
-      if (_component.get('workStatus') !== App.Component.Status.stopped && _component.get('workStatus') !== App.Component.Status.install_failed) {
+      if (_component.get('workStatus') !== App.HostComponentStatus.stopped && _component.get('workStatus') !== App.HostComponentStatus.install_failed) {
         flag = false;
       }
     }, this);
     return flag;
-  }.property('components.@each.workStatus'),
+  }.property('hostComponents.@each.workStatus'),
 
   isStarted: function () {
-    var components = this.get('components').filterProperty('isMaster', true);
-    return components.everyProperty('workStatus', App.Component.Status.started);
-  }.property('components.@each.workStatus'),
+    var components = this.get('hostComponents').filterProperty('isMaster', true);
+    return components.everyProperty('workStatus', App.HostComponentStatus.started);
+  }.property('hostComponents.@each.workStatus'),
   isMaintained: function () {
     var maintainedServices = [
       "HDFS",

+ 9 - 0
ambari-web/app/styles/application.less

@@ -286,6 +286,15 @@ h1 {
     .java-home {
       margin-bottom: 10px
     }
+    .ssh-key-input {
+      padding-left: 18px;
+    }
+    .ssh-key-input-indentation {
+      margin-bottom: 5px;
+    }
+    input[type="radio"]:focus {
+      outline: none;
+    }
   }
   #confirm-hosts {
     #host-filter {

+ 1 - 1
ambari-web/app/templates/main/service/info/summary.hbs

@@ -47,7 +47,7 @@
       {{#unless view.serviceStatus.mapreduce}}
       {{#unless view.serviceStatus.hbase}}
       {{#unless view.serviceStatus.ganglia}}
-      {{#each component in controller.content.components}}
+      {{#each component in controller.content.hostComponents}}
         <tr>
           {{#if component.isMaster}}
             <td class="summary-label">{{component.displayName}}</td>

+ 1 - 1
ambari-web/app/templates/main/service/info/summary/ganglia.hbs

@@ -15,7 +15,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-{{#each component in controller.content.components}}
+{{#each component in controller.content.hostComponents}}
   {{#if component.isMaster}}
     <tr>
         <td class="summary-label">{{component.displayName}}</td>

+ 1 - 1
ambari-web/app/templates/main/service/info/summary/oozie.hbs

@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-{{#each component in controller.content.components}}
+{{#each component in controller.content.hostComponents}}
   {{#if component.isMaster}}
     <tr>
         <td class="summary-label">Server</td>

+ 1 - 1
ambari-web/app/templates/main/service/item.hbs

@@ -28,7 +28,7 @@
     <ul class="dropdown-menu">
       <!-- dropdown menu links -->
       {{#each option in view.maintenance}}
-      <li>
+      <li {{bindAttr class="controller.content.isStopDisabled:disabled"}}>
         <a {{action "doAction" option.action target="controller" href=true}}>{{option.label}}</a>
       </li>
       {{/each}}

+ 23 - 29
ambari-web/app/templates/wizard/step2.hbs

@@ -33,19 +33,6 @@
         </a>
       </p>
 
-      {{#if view.parentView.controller.hideBackButton}}
-        {{#if view.hostsInfo.oldHostNames }}
-          <p class="alert alert-info">
-            {{t hosts.add.step2.warning}}
-            <br/>
-            {{{view.hostsInfo.oldHostNames}}}
-              {{#if view.hostsInfo.showMoreHostsText}}
-                <a href="" {{action "showMoreHosts" target="view"}}>{{view.hostsInfo.showMoreHostsText}}</a>
-              {{/if}}
-          </p>
-        {{/if}}
-      {{/if}}
-
       <div class="controls">
         {{view Ember.TextArea class="span6" valueBinding="content.installOptions.hostNames" rows="5" placeholder="host names"}}
         {{#if hostsError}}
@@ -59,30 +46,38 @@
     <div class="ambari-agents">
       <h5>{{t installer.step2.sshKey}}</h5>
 
-      <label class="checkbox">
-        {{view Ember.Checkbox checkedBinding="content.installOptions.useSsh"}}
+      <label class="radio">
+        {{view view.providingSSHKeyRadioButton}}
         {{t installer.step2.useSsh.provide}}
           <a href="javascript:void(null)"
              rel="popover"
             {{translateAttr title="installer.step2.useSsh.tooltip.title" data-content="installer.step2.useSsh.tooltip.content"}}>
-              {{t installer.step2.useSsh.tooltip.title}}</a>
-          {{t installer.step2.useSsh.provide_id_rsa}}
+            {{t installer.step2.useSsh.tooltip.title}}</a>
+        {{t installer.step2.useSsh.provide_id_rsa}}
       </label>
-
-      <div {{bindAttr class="sshKeyError:error :control-group"}}>
+      <div {{bindAttr class="sshKeyError:error :control-group :ssh-key-input"}}>
         {{#if view.isFileApi}}
-          {{view App.SshKeyFileUploader}}
-          <pre {{bindAttr class="view.sshKeyPreviewClass"}}>{{content.installOptions.sshKey}}</pre>
+          {{view App.SshKeyFileUploader disabledBinding="view.sshKeyState"}}
         {{/if}}
-        <div class="controls">
-          {{view Ember.TextArea class="span6" rows="4" classBinding="view.sshKeyClass"  id="sshKey"
-          placeholder="ssh private key" disabledBinding="view.sshKeyState" valueBinding="content.installOptions.sshKey"}}
-          {{#if sshKeyError}}
-          <span class="help-inline">{{sshKeyError}}</span>
-          {{/if}}
-        </div>
+          <div class="controls">
+            {{view Ember.TextArea class="span6" rows="3" id="sshKey"
+            placeholder="ssh private key" disabledBinding="view.sshKeyState" valueBinding="content.installOptions.sshKey"}}
+            {{#if sshKeyError}}
+                <span class="help-inline">{{sshKeyError}}</span>
+            {{/if}}
+          </div>
       </div>
 
+      <label class="radio">
+        {{view view.manualRegistrationRadioButton}}
+        {{t installer.step2.manualInstall.perform}}
+          <a href="javascript:void(null)"
+             rel="popover"
+            {{translateAttr title="installer.step2.manualInstall.tooltip.title" data-content="installer.step2.manualInstall.tooltip.content"}}>
+            {{t installer.step2.manualInstall.tooltip.title}}</a>
+        {{t installer.step2.manualInstall.perform_on_hosts}}
+      </label>
+
     </div>
   </div>
 
@@ -109,7 +104,6 @@
            rel="popover"
           {{translateAttr title="installer.step2.javaHome.tooltip.title" data-content="installer.step2.javaHome.tooltip.content"}}>
             {{t installer.step2.javaHome.tooltip.title}}</a>
-        {{t installer.step2.javaHome.label2}}
       </div>
       {{view App.WizardTextField valueBinding="content.installOptions.javaHome" placeholder="/usr/jdk/jdk1.6.0_31"}}
     </label>

+ 55 - 0
ambari-web/app/utils/component.js

@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+/**
+ * Here will be stored slave functions related to components
+ * @type {Object}
+ */
+module.exports = {
+
+  /**
+   * Return list of installed components. Syntax is:
+   *
+   * [{
+   *    id : 'DATANODE',
+   *    displayName : 'DataNode',
+   *    isMaster : true,
+   *    isSlave : false,
+   *    isClient : false
+   * }]
+   *
+   */
+  getInstalledComponents : function(){
+    var components = App.HostComponent.find();
+    var names = components.mapProperty('componentName').uniq();
+    var result = [];
+
+    names.forEach(function(componentName){
+      var component = components.findProperty('componentName', componentName);
+      result.push(Ember.Object.create({
+        id: componentName,
+        isMaster: component.get('isMaster'),
+        isSlave: component.get('isSlave'),
+        isClient: !component.get('isMaster') && !component.get('isSlave'),
+        displayName: component.get('displayName')
+      }));
+    });
+
+    return result;
+  }
+};

+ 4 - 4
ambari-web/app/views/common/quick_view_link_view.js

@@ -25,15 +25,15 @@ App.QuickViewLinks = Em.View.extend({
    */
   quickLinks:function () {
     var serviceName = this.get('content.serviceName');
-    var components = this.get('content.components');
+    var components = this.get('content.hostComponents');
     var host;
 
     if (serviceName === 'HDFS') {
-      host = components.filterProperty('id', 'NAMENODE').objectAt(0).get('host.publicHostName');
+      host = components.findProperty('componentName', 'NAMENODE').get('host.publicHostName');
     } else if (serviceName === 'MAPREDUCE') {
-      host = components.filterProperty('id', 'JOBTRACKER').objectAt(0).get('host.publicHostName');
+      host = components.findProperty('componentName', 'JOBTRACKER').get('host.publicHostName');
     } else if (serviceName === 'HBASE') {
-      host = components.filterProperty('id', 'HBASE_MASTER').objectAt(0).get('host.publicHostName');
+      host = components.findProperty('componentName', 'HBASE_MASTER').get('host.publicHostName');
     }
     if (!host) {
       return [];

+ 1 - 1
ambari-web/app/views/main/dashboard/service/hbase.js

@@ -82,7 +82,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   }.property("service.masterActiveTime"),
 
   regionServerComponent: function () {
-    return App.Component.find().findProperty('componentName', 'HBASE_REGIONSERVER');
+    return App.HostComponent.find().findProperty('componentName', 'HBASE_REGIONSERVER');
   }.property('components'),
 
   isCollapsed: false,

+ 1 - 1
ambari-web/app/views/main/dashboard/service/hdfs.js

@@ -109,7 +109,7 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
   }.property('service.capacityUsed', 'service.capacityTotal'),
 
   dataNodeComponent: function () {
-    return App.Component.find().findProperty('componentName', 'DATANODE');
+    return App.HostComponent.find().findProperty('componentName', 'DATANODE');
   }.property('+'),
 
   isCollapsed: false,

+ 1 - 1
ambari-web/app/views/main/dashboard/service/mapreduce.js

@@ -117,7 +117,7 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
   }.property('service.mapSlots', 'service.reduceSlots', 'service.aliveTrackers'),
 
   taskTrackerComponent: function () {
-    return App.Component.find().findProperty('componentName', 'TASKTRACKER');
+    return App.HostComponent.find().findProperty('componentName', 'TASKTRACKER');
   }.property('components'),
 
   isCollapsed: false,

+ 16 - 40
ambari-web/app/views/main/host.js

@@ -68,8 +68,7 @@ App.MainHostView = Em.View.extend({
     content:null,
 
     shortLabels: function() {
-      var components = this.get('labels');
-      var labels = this.get('content.components').getEach('displayName');
+      var labels = this.get('content.hostComponents').getEach('displayName');
       var shortLabels = '';
       var c = 0;
       labels.forEach(function(label) {
@@ -88,8 +87,8 @@ App.MainHostView = Em.View.extend({
     }.property('labels'),
 
     labels: function(){
-      return this.get('content.components').getEach('displayName').join('\n');
-    }.property('content.components.@each'),
+      return this.get('content.hostComponents').getEach('displayName').join('\n');
+    }.property('content.hostComponents.@each'),
 
     usageStyle:function () {
       return "width:" + this.get('content.diskUsage') + "%";
@@ -198,57 +197,37 @@ App.MainHostView = Em.View.extend({
 
     allComponentsChecked:false,
     toggleAllComponents:function () {
-      this.set('masterComponentsChecked', this.get('allComponentsChecked'));
-      this.set('slaveComponentsChecked', this.get('allComponentsChecked'));
-      this.set('clientComponentsChecked', this.get('allComponentsChecked'));
+      var checked = this.get('allComponentsChecked');
+      this.set('masterComponentsChecked', checked);
+      this.set('slaveComponentsChecked', checked);
+      this.set('clientComponentsChecked', checked);
     }.observes('allComponentsChecked'),
 
     masterComponentsChecked:false,
     toggleMasterComponents:function () {
-      var checked = this.get('masterComponentsChecked');
-      this.get('masterComponents').forEach(function (comp) {
-        comp.set('checkedForHostFilter', checked);
-      });
+      this.get('masterComponents').setEach('checkedForHostFilter', this.get('masterComponentsChecked'));
     }.observes('masterComponentsChecked'),
 
     slaveComponentsChecked:false,
     toggleSlaveComponents:function () {
-      var checked = this.get('slaveComponentsChecked');
-      this.get('slaveComponents').forEach(function (comp) {
-        comp.set('checkedForHostFilter', checked);
-      });
+      this.get('slaveComponents').setEach('checkedForHostFilter', this.get('slaveComponentsChecked'));
     }.observes('slaveComponentsChecked'),
 
     clientComponentsChecked: false,
     toggleClientComponents: function() {
-      var checked = this.get('clientComponentsChecked');
-      this.get('clientComponents').forEach(function(comp) {
-        comp.set('checkedForHostFilter', checked);
-      });
+      this.get('clientComponents').setEach('checkedForHostFilter', this.get('clientComponentsChecked'));
     }.observes('clientComponentsChecked'),
 
     masterComponents:function(){
-      var masterComponents = [];
-      for(var i = 0; i < this.get('parentView').get('controller.masterComponents').length; i++) {
-        masterComponents.push(this.get('parentView').get('controller.masterComponents')[i]);
-      }
-      return masterComponents;
+      return this.get('parentView.controller.masterComponents');
     }.property('parentView.controller.masterComponents'),
 
     slaveComponents:function(){
-      var slaveComponents = [];
-      for(var i = 0; i < this.get('parentView').get('controller.slaveComponents').length; i++) {
-        slaveComponents.push(this.get('parentView').get('controller.slaveComponents')[i]);
-      }
-      return slaveComponents;
+      return this.get('parentView.controller.slaveComponents');
     }.property('parentView.controller.slaveComponents'),
 
     clientComponents: function() {
-      var clientComponents = [];
-      for (var i = 0; i < this.get('parentView').get('controller.clientComponents').length; i++) {
-        clientComponents.push(this.get('parentView').get('controller.clientComponents')[i]);
-      }
-      return clientComponents;
+      return this.get('parentView.controller.clientComponents');
     }.property('parentView.controller.clientComponents'),
 
     template: Ember.Handlebars.compile('<div {{bindAttr class="view.btnGroupClass"}} >'+
@@ -335,12 +314,6 @@ App.MainHostView = Em.View.extend({
       var self = this;
       this.set('isFilterOpen', !this.get('isFilterOpen'));
       if (this.get('isFilterOpen')) {
-        var filters = App.router.get('mainHostController.filters.components');
-        $('.filter-component').each(function() {
-          var componentId = parseInt($(this).attr('id').replace('component-', ''));
-          var index = filters.indexOf(componentId);
-          $(this).attr('checked', index == -1);
-        });
 
         var dropDown = $('#filter-dropdown');
         var firstClick = true;
@@ -358,6 +331,9 @@ App.MainHostView = Em.View.extend({
       if (this.get('controller.comeWithFilter')) {
         this.applyFilter();
         this.closeFilters();
+        this.set('controller.comeWithFilter', false);
+      } else {
+        this.clearFilter(this);
       }
     },
 

+ 8 - 8
ambari-web/app/views/main/host/summary.js

@@ -93,7 +93,7 @@ App.MainHostSummaryView = Em.View.extend({
   sortedComponents: function() {
     var slaveComponents = [];
     var masterComponents = [];
-    this.get('content.components').forEach(function(component){
+    this.get('content.hostComponents').forEach(function(component){
       if(component.get('isMaster')){
         masterComponents.push(component);
       } else if(component.get('isSlave')) {
@@ -104,7 +104,7 @@ App.MainHostSummaryView = Em.View.extend({
   }.property('content'),
   clients: function(){
     var clients = [];
-    this.get('content.components').forEach(function(component){
+    this.get('content.hostComponents').forEach(function(component){
       if(!component.get('componentName')){
         //temporary fix because of different data in hostComponents and serviceComponents
         return;
@@ -152,14 +152,14 @@ App.MainHostSummaryView = Em.View.extend({
           return 'health-status-DEAD-ORANGE';
         }
       }
-      return 'health-status-' + App.Component.Status.getKeyName(this.get('workStatus'));
-    }.property('workStatus'),
+      return 'health-status-' + App.HostComponentStatus.getKeyName(this.get('workStatus'));
+    }.property('workStatus', 'isDataNodeRecommissionAvailable'),
     /**
      * Disable element while component is starting/stopping
      */
     disabledClass:function(){
       var workStatus = this.get('workStatus');
-      if([App.Component.Status.starting, App.Component.Status.stopping].contains(workStatus) ){
+      if([App.HostComponentStatus.starting, App.HostComponentStatus.stopping].contains(workStatus) ){
         return 'disabled';
       } else {
         return '';
@@ -171,7 +171,7 @@ App.MainHostSummaryView = Em.View.extend({
     doBlinking : function(){
       var workStatus = this.get('workStatus');
       var self = this;
-      var pulsate = [ App.Component.Status.starting, App.Component.Status.stopping ].contains(workStatus);
+      var pulsate = [ App.HostComponentStatus.starting, App.HostComponentStatus.stopping ].contains(workStatus);
       if (!pulsate && this.get('isDataNode')) {
         var dataNodeComponent = this.get('content');
         if (dataNodeComponent)
@@ -193,11 +193,11 @@ App.MainHostSummaryView = Em.View.extend({
     }.observes('workStatus'),
 
     isStart : function() {
-      return (this.get('workStatus') === App.Component.Status.started || this.get('workStatus') === App.Component.Status.starting);
+      return (this.get('workStatus') === App.HostComponentStatus.started || this.get('workStatus') === App.HostComponentStatus.starting);
     }.property('workStatus'),
 
     isInProgress : function() {
-      return (this.get('workStatus') === App.Component.Status.stopping || this.get('workStatus') === App.Component.Status.starting);
+      return (this.get('workStatus') === App.HostComponentStatus.stopping || this.get('workStatus') === App.HostComponentStatus.starting);
     }.property('workStatus'),
     /**
      * Shows whether we need to show Decommision/Recomission buttons

+ 7 - 7
ambari-web/app/views/main/service/info/summary.js

@@ -142,7 +142,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   monitorsObj: function(){
     var service = this.get('controller.content');
     if (service.get("id") == "GANGLIA") {
-      var monitors = service.get('components').filterProperty('isMaster', false);
+      var monitors = service.get('hostComponents').filterProperty('isMaster', false);
       if (monitors.length) {
         return monitors[0];
       }
@@ -157,7 +157,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   serversHost: function() {
     var service = this.get('controller.content');
     if (service.get("id") == "ZOOKEEPER") {
-      var servers = service.get('components').filterProperty('isMaster');
+      var servers = service.get('hostComponents').filterProperty('isMaster');
       if (servers.length > 0) {
         return servers[0];
       }
@@ -172,7 +172,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   clientObj: function() {
     var service = this.get('controller.content');
     if (service.get("id") == "OOZIE" || service.get("id") == "ZOOKEEPER") {
-      var clients = service.get('components').filterProperty('isMaster', false);
+      var clients = service.get('hostComponents').filterProperty('isMaster', false);
       if (clients.length > 0) {
         return clients[0];
       }
@@ -190,7 +190,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   gangliaServer:function(){
     var service=this.get('controller.content');
     if(service.get("id") == "GANGLIA"){
-      return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName");
+      return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName");
     }else{
       return "";
     }
@@ -198,7 +198,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   nagiosServer:function(){
     var service=this.get('controller.content');
     if(service.get("id") == "NAGIOS"){
-      return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName");
+      return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName");
     }else{
       return "";
     }
@@ -206,7 +206,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
   oozieServer:function(){
     var service=this.get('controller.content');
     if(service.get("id") == "OOZIE"){
-      return service.get("components").findProperty('isMaster', true).get("host").get("publicHostName");
+      return service.get("hostComponents").findProperty('isMaster', true).get("host").get("publicHostName");
     }else{
       return "";
     }
@@ -224,7 +224,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     var service=this.get('controller.content');
     if(service.get("id") == "HIVE"){
       var self = this;
-      var components = service.get("components");
+      var components = service.get("hostComponents");
       if(components){
         components.forEach(function(component){
           var ci = {

+ 32 - 73
ambari-web/app/views/wizard/step2_view.js

@@ -20,7 +20,8 @@
 var App = require('app');
 
 App.SshKeyFileUploader = Ember.View.extend({
-  template:Ember.Handlebars.compile('<input type="file" />'),
+  template:Ember.Handlebars.compile('<input type="file" {{bindAttr disabled="view.disabled"}} />'),
+  classNames: ['ssh-key-input-indentation'],
 
   change: function (e) {
     var self=this;
@@ -61,62 +62,9 @@ App.WizardStep2View = Em.View.extend({
     this.set('controller.sshKeyError',null);
     this.loadHostsInfo();
   },
-  /**
-   * Config for displaying more hosts
-   * if oldHosts.length more than config.count that configuration will be applied
-   */
-  hostDisplayConfig: [
-    {
-      count: 0,
-      delimitery: '<br/>',
-      popupDelimitery: '<br />'
-    },
-    {
-      count: 10,
-      delimitery: ', ',
-      popupDelimitery: '<br />'
-    },
-    {
-      count: 50,
-      delimitery: ', ',
-      popupDelimitery: ', '
-    }
-  ],
-  showMoreHosts: function () {
-    var self = this;
-    App.ModalPopup.show({
-      header: "Hosts are already part of the cluster and will be ignored",
-      body: self.get('hostsInfo.oldHostNamesMore'),
-      encodeBody: false,
-      onPrimary: function () {
-        this.hide();
-      },
-      secondary: null
-    });
-  },
-  loadHostsInfo: function(){
 
+  loadHostsInfo: function(){
     var hostsInfo = Em.Object.create();
-
-    var oldHostNames = App.Host.find().getEach('id');
-    var k = 10;
-
-    var usedConfig = false;
-    this.get('hostDisplayConfig').forEach(function (config) {
-      if (oldHostNames.length > config.count) {
-        usedConfig = config;
-      }
-    });
-
-    k = usedConfig.count ? usedConfig.count : oldHostNames.length;
-    var displayedHostNames = oldHostNames.slice(0, k);
-    hostsInfo.set('oldHostNames', displayedHostNames.join(usedConfig.delimitery));
-    if (usedConfig.count) {
-      var moreHostNames = oldHostNames.slice(k + 1);
-      hostsInfo.set('oldHostNamesMore', moreHostNames.join(usedConfig.popupDelimitery));
-      hostsInfo.set('showMoreHostsText', "...and %@ more".fmt(moreHostNames.length));
-    }
-
     this.set('hostsInfo', hostsInfo);
   },
 
@@ -132,26 +80,10 @@ App.WizardStep2View = Em.View.extend({
     return this.get("controller.content.installOptions.manualInstall");
   }.property("controller.content.installOptions.manualInstall"),
 
-  sshKeyClass:function() {
-    return (this.get("isFileApi")) ? "hide" : "" ;
-  }.property("isFileApi"),
-
   isFileApi: function () {
     return (window.File && window.FileReader && window.FileList) ? true : false ;
   }.property(),
 
-  sshKeyPreviewClass: function() {
-    if (this.get('controller.content.installOptions.sshKey').trim() != '') {
-      if (this.get('controller.content.installOptions.manualInstall')) {
-        return 'sshKey-file-view disabled';
-      } else {
-        return 'sshKey-file-view';
-      }
-    } else {
-      return 'hidden';
-    }
-  }.property('controller.content.installOptions.sshKey', 'controller.content.installOptions.manualInstall'),
-
   manualInstallPopup: function(){
     if(!this.get('controller.content.installOptions.useSsh')){
       App.ModalPopup.show({
@@ -165,8 +97,35 @@ App.WizardStep2View = Em.View.extend({
       });
     }
     this.set('controller.content.installOptions.manualInstall', !this.get('controller.content.installOptions.useSsh'));
-  }.observes('controller.content.installOptions.useSsh')
-
+  }.observes('controller.content.installOptions.useSsh'),
+
+  providingSSHKeyRadioButton: Ember.Checkbox.extend({
+    tagName: 'input',
+    attributeBindings: ['type', 'checked'],
+    checked: function () {
+      return this.get('controller.content.installOptions.useSsh');
+    }.property('controller.content.installOptions.useSsh'),
+    type: 'radio',
+
+    click: function () {
+      this.set('controller.content.installOptions.useSsh', true);
+      this.set('controller.content.installOptions.manualInstall', false);
+    }
+  }),
+
+  manualRegistrationRadioButton: Ember.Checkbox.extend({
+    tagName: 'input',
+    attributeBindings: ['type', 'checked'],
+    checked: function () {
+      return this.get('controller.content.installOptions.manualInstall');
+    }.property('controller.content.installOptions.manualInstall'),
+    type: 'radio',
+
+    click: function () {
+      this.set('controller.content.installOptions.manualInstall', true);
+      this.set('controller.content.installOptions.useSsh', false);
+    }
+  })
 });