Browse Source

AMBARI-2058. Host Detail page: if the host component is in INSTALL_FAILED state, we should let the user reinstall it. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1478194 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
7a51b551ae

+ 3 - 0
CHANGES.txt

@@ -823,6 +823,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2058. Host Detail page: if the host component is in INSTALL_FAILED
+ state, we should let the user reinstall it. (yusaku)
+
  AMBARI-2055. Oozie reconfig forces the user to enter bogus values for two
  parameters in order to save any changes. (yusaku)
 

+ 1 - 17
ambari-web/app/assets/data/dashboard/services.json

@@ -28,7 +28,7 @@
                 "cluster_name" : "cl1",
                 "desired_configs" : { },
                 "desired_state" : "INSTALLED",
-                "state" : "STARTED",
+                "state" : "INSTALL_FAILED",
                 "component_name" : "HBASE_REGIONSERVER",
                 "host_name" : "domU-12-31-39-0E-E6-01.compute-1.internal"
               }
@@ -742,22 +742,6 @@
                 "host_name" : "domU-12-31-39-16-48-4B.compute-1.internal"
               }
             },
-            {
-              "href" : "http://ec2-184-73-46-113.compute-1.amazonaws.com:8080/api/v1/clusters/cl1/hosts/domU-12-31-39-0E-E6-01.compute-1.internal/host_components/TASKTRACKER",
-              "HostRoles" : {
-                "configs" : {
-                  "mapred-site" : "version1",
-                  "global" : "version1",
-                  "core-site" : "version1"
-                },
-                "cluster_name" : "cl1",
-                "desired_configs" : { },
-                "desired_state" : "STARTED",
-                "state" : "STARTED",
-                "component_name" : "TASKTRACKER",
-                "host_name" : "domU-12-31-39-0E-E6-01.compute-1.internal"
-              }
-            },
             {
               "href" : "http://ec2-184-73-46-113.compute-1.amazonaws.com:8080/api/v1/clusters/cl1/hosts/ip-10-110-38-164.ec2.internal/host_components/TASKTRACKER",
               "HostRoles" : {

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

@@ -282,6 +282,61 @@ App.MainHostDetailsController = Em.Controller.extend({
       }
     });
   },
+  /**
+   * send command to server to install selected host component
+   * @param event
+   * @param context
+   */
+  installComponent: function (event, context) {
+    var self = this;
+    var component = event.context;
+    var componentName = component.get('componentName').toUpperCase().toString();
+
+    App.ModalPopup.show({
+      primary: Em.I18n.t('yes'),
+      secondary: Em.I18n.t('no'),
+      header: Em.I18n.t('popup.confirmation.commonHeader'),
+      bodyClass: Ember.View.extend({
+        template: Ember.Handlebars.compile([
+          '{{t hosts.delete.popup.body}}<br /><br />',
+          '{{t hosts.host.addComponent.note}}'
+        ].join(''))
+      }),
+      onPrimary: function () {
+        this.hide();
+        self.sendCommandToServer('/hosts/' + self.get('content.hostName') + '/host_components/' + component.get('componentName').toUpperCase(), {
+            RequestInfo: {
+              "context": Em.I18n.t('requestInfo.installHostComponent') + " " + componentName
+            },
+            Body: {
+              HostRoles: {
+                state: 'INSTALLED'
+              }
+            }
+          },
+          'PUT',
+          function (requestId) {
+            if (!requestId) {
+              return;
+            }
+
+            console.log('Send request for REINSTALL COMPONENT successfully');
+
+            if (App.testMode) {
+              component.set('workStatus', App.HostComponentStatus.installing);
+              setTimeout(function () {
+                component.set('workStatus', App.HostComponentStatus.stopped);
+              }, App.testModeDelayForActions);
+            } else {
+              App.router.get('clusterController').loadUpdatedStatusDelayed(500);
+            }
+
+            App.router.get('backgroundOperationsController').showPopup();
+
+          });
+      }
+    });
+  },
   /**
    * send command to server to run decommission on DATANODE
    * @param event

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

@@ -128,6 +128,7 @@ Em.I18n.translations = {
   'common.abort': 'Abort',
   'common.misc': 'Misc',
   'common.operations': 'Operations',
+  'common.install': 'Install',
 
   'requestInfo.installComponents':'Install Components',
   'requestInfo.installServices':'Install Services',

+ 6 - 1
ambari-web/app/templates/main/host/summary.hbs

@@ -86,7 +86,7 @@
                       {{t common.stop}}
                     </a>
                   </li>
-                  <li {{bindAttr class="view.isStart:hidden:"}}>
+                  <li {{bindAttr class="view.isStart:hidden: view.isInstallFailed:hidden"}}>
                     <a href="javascript:void(null)" data-toggle="modal" {{action "startComponent" view.content target="controller"}}>
                       {{t common.start}}
                     </a>
@@ -96,6 +96,11 @@
                       {{t common.upgrade}}
                     </a>
                   </li>
+                  <li {{bindAttr class="view.isInstallFailed::hidden"}}>
+                    <a href="javascript:void(null)" data-toggle="modal" {{action "installComponent" view.content target="controller"}}>
+                      {{t common.install}}
+                    </a>
+                  </li>
                 </ul>
               </div>
               {{/if}}

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

@@ -197,17 +197,22 @@ App.MainHostSummaryView = Em.View.extend({
           return 'health-status-DEAD-ORANGE';
         }
       }
+      if(this.get('workStatus') === App.HostComponentStatus.install_failed){
+        return 'icon-remove';
+      }
       return 'health-status-' + App.HostComponentStatus.getKeyName(this.get('workStatus'));
     }.property('workStatus', 'isDataNodeRecommissionAvailable'),
     /**
      * For Upgrade failed state
      */
     isUpgradeFailed:function(){
-      if(App.HostComponentStatus.getKeyName(this.get('workStatus')) == "upgrade_failed"){
-        return true;
-      }else{
-        return false;
-      }
+      return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "upgrade_failed";
+    }.property("workStatus"),
+    /**
+     * For Install failed state
+     */
+    isInstallFailed:function(){
+      return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "install_failed";
     }.property("workStatus"),
     /**
      * Disable element while component is starting/stopping