瀏覽代碼

AMBARI-3184. NameNode HA wizard (rollback): When task fails in rollback popup, rollback button is shown

Alex Antonenko 11 年之前
父節點
當前提交
9b240c97a7

+ 3 - 0
ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js

@@ -53,6 +53,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
         id: i,
         id: i,
         command: commands[i],
         command: commands[i],
         showRetry: false,        
         showRetry: false,        
+        showRollback: false,
         name: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
         name: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
         displayName: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
         displayName: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
         progress: 0,
         progress: 0,
@@ -104,6 +105,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   retryTask: function () {
   retryTask: function () {
     var task = this.get('tasks').findProperty('status', 'FAILED');
     var task = this.get('tasks').findProperty('status', 'FAILED');
     task.set('showRetry', false);
     task.set('showRetry', false);
+    task.set('showRollback', false);
     task.set('status', 'PENDING');
     task.set('status', 'PENDING');
   },
   },
 
 
@@ -141,6 +143,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
     } else if (this.get('tasks').someProperty('status', 'FAILED') || this.get('tasks').someProperty('status', 'TIMEDOUT') || this.get('tasks').someProperty('status', 'ABORTED')) {
     } else if (this.get('tasks').someProperty('status', 'FAILED') || this.get('tasks').someProperty('status', 'TIMEDOUT') || this.get('tasks').someProperty('status', 'ABORTED')) {
       this.set('status', 'FAILED');
       this.set('status', 'FAILED');
       this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
       this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
+      this.get('tasks').findProperty('status', 'FAILED').set('showRollback', true);
     }
     }
 
 
     var statuses = this.get('tasks').mapProperty('status');
     var statuses = this.get('tasks').mapProperty('status');

+ 1 - 0
ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js

@@ -106,6 +106,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
         id: i,
         id: i,
         command: commands[i],
         command: commands[i],
         showRetry: false,
         showRetry: false,
+        showRollback: false,
         name: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'),
         name: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'),
         displayName: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'),
         displayName: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'),
         progress: 0,
         progress: 0,

+ 1 - 1
ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js

@@ -53,7 +53,7 @@ App.HighAvailabilityWizardStep6Controller = Em.Controller.extend({
   checkJnCheckPointStatus: function (data) {
   checkJnCheckPointStatus: function (data) {
     var self = this;
     var self = this;
     var journalStatusInfo;
     var journalStatusInfo;
-    if (data.metrics) {
+    if (data.metrics && data.metrics.dfs) {
       journalStatusInfo = $.parseJSON(data.metrics.dfs.journalnode.journalsStatus);
       journalStatusInfo = $.parseJSON(data.metrics.dfs.journalnode.journalsStatus);
       if (journalStatusInfo[this.get('content.nameServiceId')] && journalStatusInfo[this.get('content.nameServiceId')].Formatted === "true") {
       if (journalStatusInfo[this.get('content.nameServiceId')] && journalStatusInfo[this.get('content.nameServiceId')].Formatted === "true") {
         this.set("initJnCounter", (this.get('initJnCounter') + 1));
         this.set("initJnCounter", (this.get('initJnCounter') + 1));

+ 1 - 1
ambari-web/app/mappers/service_mapper.js

@@ -336,7 +336,7 @@ App.servicesMapper = App.QuickDataMapper.create({
         // make active nameNode as host_components[0].
         // make active nameNode as host_components[0].
         if ( component.host_components.length == 2) { //enabled HA
         if ( component.host_components.length == 2) { //enabled HA
           var haState2;
           var haState2;
-          if (component.host_components[1].metrics.dfs) {
+          if (component.host_components[1].metrics && component.host_components[1].metrics.dfs) {
             haState2 = component.host_components[1].metrics.dfs.FSNamesystem.HAState;
             haState2 = component.host_components[1].metrics.dfs.FSNamesystem.HAState;
           }
           }
           if (haState2 == "active") { // change places
           if (haState2 == "active") { // change places

+ 2 - 0
ambari-web/app/templates/main/admin/highAvailability/progress.hbs

@@ -40,6 +40,8 @@
           <i class="icon-repeat icon-white"></i>
           <i class="icon-repeat icon-white"></i>
           {{t common.retry}}
           {{t common.retry}}
         </a>
         </a>
+      {{/if}}
+      {{#if task.showRollback}}
         <a {{action rollback target="controller"}} class="btn btn-primary retry">
         <a {{action rollback target="controller"}} class="btn btn-primary retry">
           <i class="icon-repeat icon-white"></i>
           <i class="icon-repeat icon-white"></i>
           {{t common.rollBack}}
           {{t common.rollBack}}