Browse Source

AMBARI-3495.NameNode HA wizard: Retry button sticks around after JN install (alexantonenko)

Alex Antonenko 11 years ago
parent
commit
f9d8b55f76

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

@@ -35,6 +35,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   isRollback: false,
 
   loadStep: function () {
+    console.warn('func: loadStep');
     this.clearStep();
     this.initializeTasks();
     this.loadTasks();
@@ -43,6 +44,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   clearStep: function () {
+    console.warn('func: clearStep');
     this.set('isSubmitDisabled', true);
     this.set('tasks', []);
     this.set('logs', []);
@@ -50,6 +52,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   initializeTasks: function() {
+    console.warn('func: initializeTasks');
     var commands = this.get('commands');
     var currentStep = App.router.get('highAvailabilityWizardController.currentStep');
     for (var i = 0; i < commands.length; i++) {
@@ -74,6 +77,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   }.property('tasks'),
 
   loadTasks: function () {
+    console.warn('func: loadTasks');
     var self = this;
     var loadedStauses = this.get('content.tasksStatuses');
     var loadedLogs = this.get('content.logs');
@@ -96,14 +100,17 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   setTaskStatus: function (taskId, status) {
+    console.warn('func: setTaskStatus');
     this.get('tasks').findProperty('id', taskId).set('status', status);
   },
 
   restoreTaskLog: function (taskId, log) {
+    console.warn('func: restoreTaskLog');
     this.get('tasks').findProperty('id', taskId).set('hosts', log);
   },
 
   setTaskLogs: function (taskId, tasks) {
+    console.warn('func: setTaskLogs');
     var hosts = [];
     var uniqHosts = tasks.mapProperty('Tasks.host_name').uniq();
     uniqHosts.forEach(function (host) {
@@ -121,6 +128,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   retryTask: function () {
+    console.warn('func: retryTask');
     var task = this.get('tasks').findProperty('status', 'FAILED');
     task.set('showRetry', false);
     task.set('showRollback', false);
@@ -128,6 +136,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   manualRollback: function () {
+    console.warn('func: manualRollback');
     App.ModalPopup.show({
       header: Em.I18n.t('admin.highAvailability.confirmRollbackHeader'),
       primary: Em.I18n.t('yes'),
@@ -159,6 +168,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   rollback: function () {
+    console.warn('func: rollback');
     var task = this.get('tasks').findProperty('status', 'FAILED');
     App.router.get(this.get('content.controllerName')).saveFailedTask(task);
     App.ModalPopup.show({
@@ -179,28 +189,35 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   onTaskStatusChange: function () {
+    console.warn('func: onTaskStatusChange1');
     if (!this.get('tasks').someProperty('status', 'IN_PROGRESS') && !this.get('tasks').someProperty('status', 'QUEUED') && !this.get('tasks').someProperty('status', 'FAILED')) {
       var nextTask = this.get('tasks').findProperty('status', 'PENDING');
       if (nextTask) {
+        console.warn('func: onTaskStatusChange2');
         this.set('status', 'IN_PROGRESS');
         this.setTaskStatus(nextTask.get('id'), 'QUEUED');
         this.set('currentTaskId', nextTask.get('id'));
         this.runTask(nextTask.get('id'));
       } else {
+        console.warn('func: onTaskStatusChange3');
         this.set('status', 'COMPLETED');
         this.set('isSubmitDisabled', false);
       }
     } else if (this.get('tasks').someProperty('status', 'FAILED')) {
+      console.warn('func: onTaskStatusChange4');
       this.set('status', 'FAILED');
       this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
       if(App.supports.autoRollbackHA){
         this.get('tasks').findProperty('status', 'FAILED').set('showRollback', true);
       }
     }
+    this.get('tasks').filterProperty('status','COMPLETED').setEach('showRetry', false);
+    this.get('tasks').filterProperty('status','COMPLETED').setEach('showRollback', false);
 
     var statuses = this.get('tasks').mapProperty('status');
     var logs = this.get('tasks').mapProperty('hosts');
     var requestIds = this.get('currentRequestIds');
+    console.warn('func: onTaskStatusChange5',statuses, logs, requestIds);
     App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
     App.router.get(this.get('content.controllerName')).saveRequestIds(requestIds);
     App.router.get(this.get('content.controllerName')).saveLogs(logs);
@@ -216,18 +233,22 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
    run command of appropriate task
    */
   runTask: function (taskId) {
+    console.warn('func: runTask',taskId);
     this[this.get('tasks').findProperty('id', taskId).get('command')]();
   },
 
   onTaskError: function () {
+    console.warn('func: onTaskError');
     this.setTaskStatus(this.get('currentTaskId'), 'FAILED');
   },
 
   onTaskCompleted: function () {
+    console.warn('func: onTaskCompleted');
     this.setTaskStatus(this.get('currentTaskId'), 'COMPLETED');
   },
 
   createComponent: function (componentName, hostName) {
+    console.warn('func: createComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -254,6 +275,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   onCreateComponent: function () {
+    console.warn('func: onCreateComponent');
     var hostName = arguments[2].hostName;
     var componentName = arguments[2].componentName;
     var taskNum = arguments[2].taskNum;
@@ -261,6 +283,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   installComponent: function (componentName, hostName, taskNum) {
+    console.warn('func: installComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -281,6 +304,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   startComponent: function (componentName, hostName) {
+    console.warn('func: startComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -302,17 +326,21 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
 
   startPolling: function (data) {
     if (data) {
+      console.warn('func: startPolling1');
       this.get('currentRequestIds').push(data.Requests.id);
       var tasksCount = arguments[2].taskNum || 1;
       if (tasksCount === this.get('currentRequestIds').length) {
+        console.warn('func: startPolling2');
         this.doPolling();
       }
     } else {
+      console.warn('func: startPolling3');
       this.onTaskCompleted();
     }
   },
 
   doPolling: function () {
+    console.warn('func: doPolling');
     this.setTaskStatus(this.get('currentTaskId'), 'IN_PROGRESS');
     var requestIds = this.get('currentRequestIds');
     for (var i = 0; i < requestIds.length; i++) {
@@ -329,6 +357,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
   },
 
   parseLogs: function (logs) {
+    console.warn('func: parseLogs');
     this.get('logs').push(logs.tasks);
     if (this.get('currentRequestIds').length === this.get('logs').length) {
       var tasks = [];

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

@@ -46,6 +46,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   ],
 
   loadStep: function () {
+    console.warn('func: loadStep');
     this.initData();
     this.clearStep();
     this.loadTasks();
@@ -54,12 +55,14 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   initData: function () {
+    console.warn('func: initData');
     this.loadMasterComponentHosts();
     this.loadFailedTask();
     this.loadHdfsClientHosts();
   },
 
   setCommandsAndTasks: function(tmpTasks) {
+    console.warn('func: setCommandsAndTasks');
     var fTask = this.get('failedTask');
     var newCommands = [];
     var newTasks = [];
@@ -97,6 +100,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   clearStep: function () {
+    console.warn('func: clearStep');
     this.set('isSubmitDisabled', true);
     this.set('tasks', []);
     this.set('logs', []);
@@ -123,26 +127,33 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onTaskStatusChange: function () {
+    console.warn('func: onTaskStatusChange');
     if (!this.get('tasks').someProperty('status', 'IN_PROGRESS') && !this.get('tasks').someProperty('status', 'QUEUED') && !this.get('tasks').someProperty('status', 'FAILED')) {
       var nextTask = this.get('tasks').findProperty('status', 'PENDING');
       if (nextTask) {
+        console.warn('func: onTaskStatusChange1');
         this.set('status', 'IN_PROGRESS');
-        this.runTask(nextTask.get('id'));
         this.setTaskStatus(nextTask.get('id'), 'QUEUED');
         this.set('currentTaskId', nextTask.get('id'));
+        this.runTask(nextTask.get('id'));
       } else {
+        console.warn('func: onTaskStatusChange2');
         this.set('status', 'COMPLETED');
         this.set('isSubmitDisabled', false);
       }
     } else if (this.get('tasks').someProperty('status', 'FAILED')) {
+      console.warn('func: onTaskStatusChange3');
       this.set('status', 'FAILED');
       this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
       this.get('tasks').findProperty('status', 'FAILED').set('showSkip', true);
     }
+    this.get('tasks').filterProperty('status','COMPLETED').setEach('showRetry', false);
+    this.get('tasks').filterProperty('status','COMPLETED').setEach('showSkip', false);
 
     var statuses = this.get('tasks').mapProperty('status');
     var logs = this.get('tasks').mapProperty('hosts');
     var requestIds = this.get('currentRequestIds');
+    console.warn('func: onTaskStatusChange4',statuses,logs,requestIds);
     this.saveTasksStatuses(statuses);
     this.saveRequestIds(requestIds);
     this.saveLogs(logs);
@@ -155,6 +166,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   skipTask: function () {
+    console.warn('func: skipTask');
     var task = this.get('tasks').findProperty('status', 'FAILED');
     task.set('showRetry', false);
     task.set('showSkip', false);
@@ -162,6 +174,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   retryTask: function () {
+    console.warn('func: retryTask');
     var task = this.get('tasks').findProperty('status', 'FAILED');
     task.set('showRetry', false);
     task.set('showSkip', false);
@@ -169,6 +182,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onTaskCompleted: function () {
+    console.warn('func: onTaskCompleted');
     var curTaskStatus = this.getTaskStatus(this.get('currentTaskId'));
     if (curTaskStatus != 'FAILED' && curTaskStatus != 'TIMEDOUT' && curTaskStatus != 'ABORTED') {
       this.setTaskStatus(this.get('currentTaskId'), 'COMPLETED');
@@ -176,10 +190,12 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   getTaskStatus: function (taskId) {
+    console.warn('func: getTaskStatus');
     return this.get('tasks').findProperty('id', taskId).get('status');
   },
 
   loadFailedTask: function(){
+    console.warn('func: loadFailedTask');
     var failedTask = App.db.getHighAvailabilityWizardFailedTask();
     this.set('failedTask', failedTask);
   },
@@ -192,6 +208,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   stopAllServices: function(){
+    console.warn('func: stopAllServices');
     App.ajax.send({
       name: 'admin.high_availability.stop_all_services',
       sender: this,
@@ -200,6 +217,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     });
   },
   restoreHBaseConfigs: function(){
+    console.warn('func: restoreHBaseConfigs');
     this.loadConfigTag("hbaseSiteTag");
     var hbaseSiteTag = this.get("content.hbaseSiteTag");
     App.ajax.send({
@@ -214,41 +232,51 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   stopFailoverControllers: function(){
+    console.warn('func: stopFailoverControllers');
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
     this.stopComponent('ZKFC', hostNames);
   },
   deleteFailoverControllers: function(){
+    console.warn('func: deleteFailoverControllers');
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
     this.checkBeforeDelete('ZKFC', hostNames);
   },
   stopStandbyNameNode: function(){
+    console.warn('func: stopStandbyNameNode');
     var hostName = this.get('content.masterComponentHosts').findProperty('isAddNameNode', true).hostName;;
     this.stopComponent('NAMENODE', hostName);
   },
   stopNameNode: function(){
+    console.warn('func: stopNameNode');
     var hostNames = this.get('content.masterComponentHosts').findProperty('isCurNameNode').hostName;
     this.stopComponent('NAMENODE', hostNames);
   },
   restoreHDFSConfigs: function(){
+    console.warn('func: restoreHDFSConfigs');
     this.unInstallHDFSClients();
   },
   enableSecondaryNameNode: function(){
+    console.warn('func: enableSecondaryNameNode');
     var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
     this.installComponent('SECONDARY_NAMENODE', hostName, hostName.length);
   },
   stopJournalNodes: function(){
+    console.warn('func: stopJournalNodes');
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
     this.stopComponent('JOURNALNODE', hostNames);
   },
   deleteJournalNodes: function(){
+    console.warn('func: deleteJournalNodes');
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
     this.unInstallComponent('JOURNALNODE', hostNames);
   },
   deleteAdditionalNameNode: function(){
+    console.warn('func: deleteAdditionalNameNode');
     var hostNames = this.get('content.masterComponentHosts').filterProperty('isAddNameNode', true).mapProperty('hostName');
     this.unInstallComponent('NAMENODE', hostNames);
   },
   startAllServices: function(){
+    console.warn('func: startAllServices');
     App.ajax.send({
       name: 'admin.high_availability.start_all_services',
       sender: this,
@@ -258,6 +286,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onLoadHbaseConfigs: function (data) {
+    console.warn('func: onLoadHbaseConfigs');
     var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
     App.ajax.send({
       name: 'admin.high_availability.save_configs',
@@ -272,6 +301,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   stopComponent: function (componentName, hostName) {
+    console.warn('func: stopComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -292,6 +322,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onDeletedHDFSClient: function () {
+    console.warn('func: onDeletedHDFSClient');
     var deletedHdfsClients = this.get('deletedHdfsClients');
     var hostName = this.get("content.hdfsClientHostNames");
     var notDeletedHdfsClients = hostName.length - deletedHdfsClients;
@@ -316,6 +347,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onLoadConfigs: function (data) {
+    console.warn('func: onLoadConfigs');
     this.set('configsSaved', false);
     App.ajax.send({
       name: 'admin.high_availability.save_configs',
@@ -340,6 +372,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onHdfsConfigsSaved: function () {
+    console.warn('func: onHdfsConfigsSaved');
     if (!this.get('configsSaved')) {
       this.set('configsSaved', true);
       return;
@@ -348,6 +381,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   unInstallHDFSClients: function () {
+    console.warn('func: unInstallHDFSClients');
     var hostName = this.get("content.hdfsClientHostNames");
     for (var i = 0; i < hostName.length; i++) {
       App.ajax.send({
@@ -364,6 +398,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   unInstallComponent: function (componentName, hostName) {
+    console.warn('func: unInstallComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -384,6 +419,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   checkBeforeDelete: function (componentName, hostName){
+    console.warn('func: checkBeforeDelete');
     this.set('hostsToPerformDel', []);
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
@@ -405,6 +441,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   checkResult: function () {
+    console.warn('func: checkResult');
     var callback = arguments[2].callback;
     var hostName = arguments[2].hostName;
     var componentName = arguments[2].componentName;
@@ -433,6 +470,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   deleteComponent: function (componentName, hostName) {
+    console.warn('func: deleteComponent');
     if (!(hostName instanceof Array)) {
       hostName = [hostName];
     }
@@ -452,6 +490,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   },
 
   onDeleteComplete: function () {
+    console.warn('func: onDeleteComplete');
     var leftOp = this.get('numOfDelOperations');
     if(leftOp > 1){
       this.set('numOfDelOperations', leftOp-1);