Bläddra i källkod

AMBARI-6629. Only client component is displayed on summary page for a new service added to stack. (jaimin)

Jaimin Jetly 11 år sedan
förälder
incheckning
3b9e4d1d1f

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

@@ -57,34 +57,7 @@ App.HostComponent = DS.Model.extend({
    * @returns {bool}
    */
   isMaster: function () {
-    switch (this.get('componentName')) {
-      case 'NAMENODE':
-      case 'SECONDARY_NAMENODE':
-      case 'SNAMENODE':
-      case 'JOURNALNODE':
-      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':
-      case 'HUE_SERVER':
-      case 'HISTORYSERVER':
-      case 'FALCON_SERVER':
-      case 'NIMBUS':
-      case 'STORM_UI_SERVER':
-      case 'DRPC_SERVER':
-      case 'STORM_REST_API':
-      case 'RESOURCEMANAGER':
-      case 'APP_TIMELINE_SERVER':
-        return true;
-      default:
-        return false;
-    }
+    return App.get('components.masters').contains(this.get('componentName'));
   }.property('componentName'),
 
   /**
@@ -92,19 +65,7 @@ App.HostComponent = DS.Model.extend({
    * @returns {bool}
    */
   isSlave: function(){
-    switch (this.get('componentName')) {
-      case 'DATANODE':
-      case 'TASKTRACKER':
-      case 'HBASE_REGIONSERVER':
-      case 'GANGLIA_MONITOR':
-      case 'NODEMANAGER':
-      case 'ZKFC':
-      case 'SUPERVISOR':
-      case 'FLUME_HANDLER':
-        return true;
-      default:
-        return false;
-    }
+    return App.get('components.slaves').contains(this.get('componentName'));
   }.property('componentName'),
   /**
    * Only certain components can be deleted.
@@ -114,24 +75,8 @@ App.HostComponent = DS.Model.extend({
    * @returns {bool}
    */
   isDeletable: function() {
-    var canDelete = false;
-    switch (this.get('componentName')) {
-      case 'DATANODE':
-      case 'TASKTRACKER':
-      case 'ZOOKEEPER_SERVER':
-      case 'HBASE_REGIONSERVER':
-      case 'GANGLIA_MONITOR':
-      case 'SUPERVISOR':
-      case 'NODEMANAGER':
-        canDelete = true;
-        break;
-      default:
-    }
-    if (!canDelete) {
-      canDelete = this.get('isClient');
-    }
-    return canDelete;
-  }.property('componentName', 'isClient'),
+    return App.get('components.deletable').contains(this.get('componentName'));
+  }.property('componentName'),
   /**
    * A host-component is decommissioning when it is in HDFS service's list of
    * decomNodes.

+ 1 - 1
ambari-web/app/views/main/service/info/components_list_view.js

@@ -20,7 +20,7 @@ var App = require('app');
 
 App.SummaryMasterComponentsView = Em.View.extend({
   templateName: require('templates/main/service/info/summary/master_components'),
-  masterComp: null,
+  mastersComp: null,
   didInsertElement: function() {
     App.tooltip($('[rel=healthTooltip]'));
   }

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

@@ -329,7 +329,7 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     return graphs;
   }.property(''),
 
-  loadServiceSummary: function (serviceName) {
+  loadServiceSummary: function () {
     var serviceName = this.get('serviceName');
     var serviceSummaryView = null;