浏览代码

AMBARI-4371 YARN ATS: implement Hosts/Host Details changes. (Denys Buzhor via atkach)

atkach 11 年之前
父节点
当前提交
76e0c5547f

+ 2 - 0
ambari-web/app/config.js

@@ -39,6 +39,8 @@ App.pageReloadTime=3600000;
 App.singleNodeInstall = false;
 App.singleNodeAlias = document.location.hostname;
 App.reassignableComponents = ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER'];
+App.restartableComponents = ['APP_TIMELINE_SERVER'];
+App.deletableComponents = ['SUPERVISOR', 'HBASE_MASTER'];
 
 // experimental features are automatically enabled if running on brunch server
 App.enableExperimental = false;

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

@@ -360,6 +360,12 @@ App.MainHostDetailsController = Em.Controller.extend({
     });
   },
 
+  restartComponent: function(event) {
+    var component = event.context;
+    App.showConfirmationPopup(function(){
+      batchUtils.restartHostComponents([component]);
+    });
+  },
   /**
    * send command to server to install selected host component
    * @param event

+ 7 - 0
ambari-web/app/templates/main/host/summary.hbs

@@ -97,6 +97,13 @@
                       </a>
                     </li>
                   {{/if}}
+                  {{#if view.isRestartableComponent}}
+                    <li {{bindAttr class="view.isRestartComponentDisabled:disabled"}}>
+                      <a href="javascript:void(null)" data-toggle="modal" {{action "restartComponent" view.content target="controller"}}>
+                        {{t common.restart}}
+                      </a>
+                    </li>
+                  {{/if}}
                   {{#unless view.isInstalling}}
                     {{#unless view.isInMaintenance}}
                       {{#if view.isStart}}

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

@@ -468,16 +468,9 @@ App.MainHostSummaryView = Em.View.extend({
      * Shows whether we need to show Delete button
      */
     isDeletableComponent: function () {
-      var canDelete = false;
-      switch (this.get('content.componentName')) {
-        case 'HBASE_MASTER':
-        case 'SUPERVISOR':
-          canDelete = true;
-          break;
-        default:
-      }
-      return canDelete;
+      return App.deletableComponents.contains(this.get('content.componentName'));
     }.property('content'),
+
     isDeleteComponentDisabled: function () {
       return !(this.get('workStatus') == App.HostComponentStatus.stopped || this.get('workStatus') == App.HostComponentStatus.unknown ||
         this.get('workStatus') == App.HostComponentStatus.install_failed || this.get('workStatus') == App.HostComponentStatus.upgrade_failed);
@@ -485,7 +478,16 @@ App.MainHostSummaryView = Em.View.extend({
 
     isReassignable: function () {
       return App.supports.reassignMaster && App.reassignableComponents.contains(this.get('content.componentName')) && App.Host.find().content.length > 1;
-    }.property('content.componentName')
+    }.property('content.componentName'),
+
+    isRestartableComponent: function() {
+      return App.restartableComponents.contains(this.get('content.componentName'));
+    }.property('content'),
+
+    isRestartComponentDisabled: function() {
+      var allowableStates = [App.HostComponentStatus.started];
+      return !allowableStates.contains(this.get('workStatus'));
+    }.property('workStatus')
 
   }),
   timeSinceHeartBeat: function () {