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/06/27 15:00:18 UTC

svn commit: r1497337 - in /incubator/ambari/branches/branch-1.2.5/ambari-web/app: controllers/main/admin/security/add/step3.js controllers/main/admin/security/disable.js templates/main/service/reconfigure.hbs utils/polling.js

Author: yusaku
Date: Thu Jun 27 13:00:18 2013
New Revision: 1497337

URL: http://svn.apache.org/r1497337
Log:
AMBARI-2505. Retry button for Enable security wizard. (jaimin via yusaku)

Modified:
    incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/add/step3.js
    incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/disable.js
    incubator/ambari/branches/branch-1.2.5/ambari-web/app/templates/main/service/reconfigure.hbs
    incubator/ambari/branches/branch-1.2.5/ambari-web/app/utils/polling.js

Modified: incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/add/step3.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/add/step3.js?rev=1497337&r1=1497336&r2=1497337&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/add/step3.js (original)
+++ incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/add/step3.js Thu Jun 27 13:00:18 2013
@@ -69,6 +69,15 @@ App.MainAdminSecurityAddStep3Controller 
     this.get('serviceConfigTags').clear();
   },
 
+  retry: function () {
+    if (this.get('stages').someProperty('isError', true)) {
+      var failedStages = this.get('stages').filterProperty('isError', true);
+      failedStages.setEach('isError', false);
+      failedStages.setEach('isStarted', false);
+    }
+    this.moveToNextStage();
+  },
+
   loadStep: function () {
     this.set('secureMapping', require('data/secure_mapping').slice(0));
     this.clearStep();
@@ -79,14 +88,13 @@ App.MainAdminSecurityAddStep3Controller 
         stages[index] = App.Poll.create(_stage);
       }, this);
       if (stages.someProperty('isError', true)) {
-        var failedStages = stages.filterProperty('isError', true);
-        failedStages.setEach('isError', false);
-        failedStages.setEach('isStarted', false);
+        this.get('stages').pushObjects(stages);
+        return;
       } else if (stages.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
         var runningStage = stages.filterProperty('isStarted', true).findProperty('isCompleted', false);
         runningStage.set('isStarted', false);
+        this.get('stages').pushObjects(stages);
       }
-      this.get('stages').pushObjects(stages);
     } else {
       this.loadStages();
       this.addInfoToStages();

Modified: incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/disable.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/disable.js?rev=1497337&r1=1497336&r2=1497337&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/disable.js (original)
+++ incubator/ambari/branches/branch-1.2.5/ambari-web/app/controllers/main/admin/security/disable.js Thu Jun 27 13:00:18 2013
@@ -40,6 +40,15 @@ App.MainAdminSecurityDisableController =
     this.get('serviceConfigTags').clear();
   },
 
+  retry: function () {
+    if (this.get('stages').someProperty('isError', true)) {
+      var failedStages = this.get('stages').filterProperty('isError', true);
+      failedStages.setEach('isError', false);
+      failedStages.setEach('isStarted', false);
+    }
+    this.moveToNextStage();
+  },
+
   loadStep: function () {
     this.clearStep();
     var stages = App.db.getSecurityDeployStages();
@@ -48,14 +57,13 @@ App.MainAdminSecurityDisableController =
         stages[index] = App.Poll.create(_stage);
       }, this);
       if (stages.someProperty('isError', true)) {
-        var failedStages = stages.filterProperty('isError', true);
-        failedStages.setEach('isError', false);
-        failedStages.setEach('isStarted', false);
+        this.get('stages').pushObjects(stages);
+        return;
       } else if (stages.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
         var runningStage = stages.filterProperty('isStarted', true).findProperty('isCompleted', false);
         runningStage.set('isStarted', false);
+        this.get('stages').pushObjects(stages);
       }
-      this.get('stages').pushObjects(stages);
     } else {
       this.loadStages();
       this.addInfoToStages();

Modified: incubator/ambari/branches/branch-1.2.5/ambari-web/app/templates/main/service/reconfigure.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.5/ambari-web/app/templates/main/service/reconfigure.hbs?rev=1497337&r1=1497336&r2=1497337&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.5/ambari-web/app/templates/main/service/reconfigure.hbs (original)
+++ incubator/ambari/branches/branch-1.2.5/ambari-web/app/templates/main/service/reconfigure.hbs Thu Jun 27 13:00:18 2013
@@ -45,6 +45,14 @@
             {{/if}}
           {{/if}}
       </td>
+      <td>
+        {{#if stage.isError}}
+          <a class="btn btn-primary"
+             href="javascript:void(null)" {{action retry target = "controller"}}><i class="icon-repeat icon-white"></i>
+            {{t common.retry}}
+          </a>
+        {{/if}}
+      </td>
     </tr>
     {{/each}}
   </tbody>

Modified: incubator/ambari/branches/branch-1.2.5/ambari-web/app/utils/polling.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.5/ambari-web/app/utils/polling.js?rev=1497337&r1=1497336&r2=1497337&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.5/ambari-web/app/utils/polling.js (original)
+++ incubator/ambari/branches/branch-1.2.5/ambari-web/app/utils/polling.js Thu Jun 27 13:00:18 2013
@@ -48,7 +48,7 @@ App.Poll = Em.Object.extend({
 
   showLink: function () {
     return (this.get('isPolling') === true && this.get('isStarted') === true);
-  }.property('isPolling','isStarted'),
+  }.property('isPolling', 'isStarted'),
 
   start: function () {
     if (this.get('requestId') === undefined) {
@@ -161,7 +161,7 @@ App.Poll = Em.Object.extend({
 
   calculateProgressByTasks: function (tasksData) {
     var queuedTasks = tasksData.filterProperty('Tasks.status', 'QUEUED').length;
-    var completedTasks = tasksData.filter(function(task){
+    var completedTasks = tasksData.filter(function (task) {
       return ['COMPLETED', 'FAILED', 'ABORTED', 'TIMEDOUT'].contains(task.Tasks.status);
     }).length;
     var inProgressTasks = tasksData.filterProperty('Tasks.status', 'IN_PROGRESS').length;
@@ -169,11 +169,16 @@ App.Poll = Em.Object.extend({
   },
 
   isPollingFinished: function (polledData) {
-    if (polledData.everyProperty('Tasks.status', 'COMPLETED')) {
-      this.set('isSuccess', true);
-      return true;
-    } else if (polledData.someProperty('Tasks.status', 'FAILED') || polledData.someProperty('Tasks.status', 'TIMEDOUT') || polledData.someProperty('Tasks.status', 'ABORTED')) {
-      this.set('isError', true);
+    var runningTasks;
+    runningTasks = polledData.filterProperty('Tasks.status', 'QUEUED').length;
+    runningTasks += polledData.filterProperty('Tasks.status', 'IN_PROGRESS').length;
+    runningTasks += polledData.filterProperty('Tasks.status', 'PENDING').length;
+    if (runningTasks === 0) {
+      if (polledData.everyProperty('Tasks.status', 'COMPLETED')) {
+        this.set('isSuccess', true);
+      } else if (polledData.someProperty('Tasks.status', 'FAILED') || polledData.someProperty('Tasks.status', 'TIMEDOUT') || polledData.someProperty('Tasks.status', 'ABORTED')) {
+        this.set('isError', true);
+      }
       return true;
     } else {
       return false;