You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/08/20 22:21:04 UTC

git commit: AMBARI-2966. NameNode HA Wizard: Provide dynamic status notice for progress steps. (Aleksandr Kovalenko via yusaku)

Updated Branches:
  refs/heads/trunk 6d37377cc -> 0eee1ff3d


AMBARI-2966. NameNode HA Wizard: Provide dynamic status notice for progress steps. (Aleksandr Kovalenko via yusaku)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/0eee1ff3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/0eee1ff3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/0eee1ff3

Branch: refs/heads/trunk
Commit: 0eee1ff3d216de5a04edc2f840a401adcd383ed4
Parents: 6d37377
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Aug 20 13:20:38 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Aug 20 13:20:38 2013 -0700

----------------------------------------------------------------------
 .../admin/highAvailability/progress_controller.js | 15 ++++++---------
 ambari-web/app/messages.js                        |  4 +++-
 .../main/admin/highAvailability/progress.hbs      |  2 +-
 .../main/admin/highAvailability/progress_view.js  | 18 +++++++++++++++++-
 4 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0eee1ff3/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 994ee1e..9bcca06 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -20,6 +20,7 @@ var App = require('app');
 
 App.HighAvailabilityProgressPageController = Em.Controller.extend({
 
+  status: 'IN_PROGRESS',
   tasks: [],
   commands: [],
   currentRequestIds: [],
@@ -69,9 +70,6 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
       for (var i = 0; i < loadedStauses.length; i++) {
         this.setTaskStatus(i, loadedStauses[i]);
       }
-      if (loadedStauses.contains('FAILED')) {
-        this.showRetry();
-      }
       if (loadedStauses.contains('IN_PROGRESS')) {
         this.set('currentRequestIds', this.get('content.requestIds'));
         this.set('currentTaskId', loadedStauses.indexOf('IN_PROGRESS'));
@@ -101,10 +99,6 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
     this.set('serviceTimestamp', new Date().getTime());
   },
 
-  showRetry: function () {
-    this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
-  },
-
   retryTask: function () {
     var task = this.get('tasks').findProperty('status', 'FAILED');
     task.set('showRetry', false);
@@ -115,12 +109,17 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
     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) {
+        this.set('status', 'IN_PROGRESS');
         this.setTaskStatus(nextTask.get('id'), 'QUEUED');
         this.set('currentTaskId', nextTask.get('id'));
         this.runTask(nextTask.get('id'));
       } else {
+        this.set('status', 'COMPLETED');
         this.set('isSubmitDisabled', false);
       }
+    } else if (this.get('tasks').someProperty('status', 'FAILED')) {
+      this.set('status', 'FAILED');
+      this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true);
     }
 
     var statuses = this.get('tasks').mapProperty('status');
@@ -144,7 +143,6 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
 
   onTaskError: function () {
     this.setTaskStatus(this.get('currentTaskId'), 'FAILED');
-    this.showRetry();
   },
 
   onTaskCompleted: function () {
@@ -265,7 +263,6 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
         this.set('currentRequestIds', []);
         if (tasks.someProperty('Tasks.status', 'FAILED')) {
           this.setTaskStatus(currentTaskId, 'FAILED');
-          this.showRetry();
         } else {
           this.setTaskStatus(currentTaskId, 'COMPLETED');
         }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0eee1ff3/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 29e9066..8b14d7d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -642,7 +642,9 @@ Em.I18n.translations = {
   'admin.highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable NameNode HA.',
   'admin.highAvailability.error.security':'You cannot enable NameNode HA via this wizard as your cluster is already secured.  First, disable security by going to Admin > Security, and then run this Enable NameNode HA wizard again.  After NameNode HA is enabled, you can go back to Admin > Security to secure the cluster.',
   'admin.highAvailability.wizard.header':'Enable NameNode HA Wizard',
-  'admin.highAvailability.wizard.progressPage.notice':'Please wait while NameNode HA is being deployed.',
+  'admin.highAvailability.wizard.progressPage.notice.inProgress':'Please wait while NameNode HA is being deployed.',
+  'admin.highAvailability.wizard.progressPage.notice.completed':'Please proceed to the next step.',
+  'admin.highAvailability.wizard.progressPage.notice.failed':'You can click on the Retry button to retry failed tasks.',
   'admin.highAvailability.wizard.progressPage.header':'Deploy',
   'admin.highAvailability.wizard.step1.header':'Get Started',
   'admin.highAvailability.wizard.step2.header':'Select Hosts',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0eee1ff3/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
index c97d169..5256e76 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
@@ -18,7 +18,7 @@
 <div id="ha-progress-page">
   <h2>{{t admin.highAvailability.wizard.progressPage.header}}</h2>
 
-  <div class="alert alert-info">{{view.notice}}</div>
+  <div {{bindAttr class="view.noticeClass"}}>{{view.notice}}</div>
   {{#each task in controller.tasks}}
   {{#view view.taskView contentBinding="task"}}
   <div class="item">

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0eee1ff3/ambari-web/app/views/main/admin/highAvailability/progress_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/progress_view.js b/ambari-web/app/views/main/admin/highAvailability/progress_view.js
index 98c36c6..56aa76b 100644
--- a/ambari-web/app/views/main/admin/highAvailability/progress_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/progress_view.js
@@ -25,7 +25,23 @@ App.HighAvailabilityProgressPageView = Em.View.extend({
     this.get('controller').loadStep();
   },
 
-  notice: Em.I18n.t('admin.highAvailability.wizard.progressPage.notice'),
+  notice: Em.I18n.t('admin.highAvailability.wizard.progressPage.notice.inProgress'),
+
+  noticeClass: 'alert alert-info',
+
+  onStatusChange: function () {
+    var status = this.get('controller.status');
+    if (status === 'COMPLETED') {
+      this.set('notice', Em.I18n.t('admin.highAvailability.wizard.progressPage.notice.completed'));
+      this.set('noticeClass', 'alert alert-success');
+    } else if (status === 'FAILED') {
+      this.set('notice', Em.I18n.t('admin.highAvailability.wizard.progressPage.notice.failed'));
+      this.set('noticeClass', 'alert alert-error');
+    } else {
+      this.set('notice', Em.I18n.t('admin.highAvailability.wizard.progressPage.notice.inProgress'));
+      this.set('noticeClass', 'alert alert-info');
+    }
+  }.observes('controller.status'),
 
   taskView: Em.View.extend({
     icon: '',