incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-2899. NameNode HA Wizard: implement progress popup for tasks on progress pages. (Antonenko Alexander via yusaku)
Date Wed, 14 Aug 2013 18:56:01 GMT
Updated Branches:
  refs/heads/trunk 8b5583fee -> 1d93addee


AMBARI-2899. NameNode HA Wizard: implement progress popup for tasks on progress pages. (Antonenko
Alexander 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/1d93adde
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/1d93adde
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/1d93adde

Branch: refs/heads/trunk
Commit: 1d93addee9e89df2a70ea40060274faa74206d16
Parents: 8b5583f
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Wed Aug 14 11:55:16 2013 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Wed Aug 14 11:55:16 2013 -0700

----------------------------------------------------------------------
 .../highAvailability/progress_controller.js     | 40 ++++++++++++++++++--
 ambari-web/app/styles/application.less          | 24 +++++++++---
 .../main/admin/highAvailability/progress.hbs    |  2 +-
 .../admin/highAvailability/progress_view.js     | 17 ++++++++-
 4 files changed, 72 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d93adde/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 3bf3c94..a6f4a27 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -27,6 +27,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
   currentTaskId: null,
   POLL_INTERVAL: 4000,
   isSubmitDisabled: true,
+  serviceTimestamp: null,
 
   loadStep: function () {
     this.clearStep();
@@ -48,17 +49,41 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
         status: 'PENDING',
         id: i,
         command: commands[i],
-        showRetry: false
+        showRetry: false,        
+        name: 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,
+        isRunning: false,
+        hosts: []
       }));
     }
   },
 
+  services: function(){
+    return this.get('tasks');
+  }.property('tasks'),
+
   loadTasks: function () {
     //load and set tasks statuses form server
   },
 
   setTaskStatus: function (taskId, status) {
-    this.get('tasks').findProperty('id', taskId).set('status', status)
+    this.get('tasks').findProperty('id', taskId).set('status', status);
+  },
+
+  setTaskLogs: function (taskId, tasks) {
+    var hosts = [];
+    tasks.forEach(function (task) {
+      hosts.push(
+       {
+          name: task.Tasks.host_name,
+          publicName: task.Tasks.host_name,
+          logTasks: [task]
+        }
+      );
+    });
+    this.get('tasks').findProperty('id', taskId).set('hosts', hosts);
+    this.set('serviceTimestamp', new Date().getTime());
   },
 
   showRetry: function (taskId) {
@@ -212,18 +237,27 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
       if (!tasks.someProperty('Tasks.status', 'PENDING') && !tasks.someProperty('Tasks.status',
'QUEUED') && !tasks.someProperty('Tasks.status', 'IN_PROGRESS')) {
         if (tasks.someProperty('Tasks.status', 'FAILED')) {
           this.setTaskStatus(currentTaskId, 'FAILED');
+          this.showRetry(currentTaskId);
         } else {
           this.setTaskStatus(currentTaskId, 'COMPLETED');
         }
         this.set('currentRequestIds', []);
       } else {
-        var progress = Math.round((tasks.filterProperty('Tasks.status', 'COMPLETED').length
+ tasks.filterProperty('Tasks.status', 'IN_PROGRESS').length / 2) / tasks.length * 100);
+        var actionsPerHost = tasks.length;
+        var completedActions = tasks.filterProperty('Tasks.status', 'COMPLETED').length
+          + tasks.filterProperty('Tasks.status', 'FAILED').length
+          + tasks.filterProperty('Tasks.status', 'ABORTED').length
+          + tasks.filterProperty('Tasks.status', 'TIMEDOUT').length;
+        var queuedActions = tasks.filterProperty('Tasks.status', 'QUEUED').length;
+        var inProgressActions = tasks.filterProperty('Tasks.status', 'IN_PROGRESS').length;
+        var progress = Math.ceil(((queuedActions * 0.09) + (inProgressActions * 0.35) + completedActions
) / actionsPerHost * 100);
         this.get('tasks').findProperty('id', currentTaskId).set('progress', progress);
         this.setTaskStatus(currentTaskId, 'IN_PROGRESS');
         window.setTimeout(function () {
           self.doPolling()
         }, self.POLL_INTERVAL);
       }
+      this.setTaskLogs(currentTaskId, tasks);
       this.set('logs', []);
     }
   },

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d93adde/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 90dbd5b..67be4f2 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -452,16 +452,28 @@ h1 {
       i {
         font-size: 20px;
       }
+      .not-active-link{
+        text-decoration: none;
+        pointer-events: none;
+        color: black;
+        cursor: default;
+      }
+      .active-link{
+        pointer-events: auto;
+        color: #0088cc;
+        cursor: pointer;
+      }
+      .retry {
+        cursor: pointer;
+        margin-left: 15px;
+        i {
+          font-size: 14px;
+        }
+      }
     }
     .row {
       margin-left: 0;
     }
-    .retry {
-      margin-left: 15px;
-      i {
-        font-size: 14px;
-      }
-    }
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d93adde/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 48c8f02..c97d169 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/progress.hbs
@@ -23,7 +23,7 @@
   {{#view view.taskView contentBinding="task"}}
   <div class="item">
     <i {{bindAttr class="view.icon view.iconColor"}}></i>
-    <a href="javascript:void(0)">{{task.title}}</a>
+    <a {{bindAttr class="view.linkClass"}} {{action "hostsLogPopup" task target="view"}}
>{{task.title}}</a>
     {{#if task.showRetry}}
     <a {{action retryTask target="controller"}} class="btn btn-primary retry">
       <i class="icon-repeat icon-white"></i>

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d93adde/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 55d157b..98c36c6 100644
--- a/ambari-web/app/views/main/admin/highAvailability/progress_view.js
+++ b/ambari-web/app/views/main/admin/highAvailability/progress_view.js
@@ -30,6 +30,7 @@ App.HighAvailabilityProgressPageView = Em.View.extend({
   taskView: Em.View.extend({
     icon: '',
     iconColor: '',
+    linkClass: '',
 
     didInsertElement: function () {
       this.onStatus();
@@ -40,6 +41,7 @@ App.HighAvailabilityProgressPageView = Em.View.extend({
     }.property('content.progress'),
 
     onStatus: function () {
+      this.set('linkClass', 'active-link');
       if (this.get('content.status') === 'IN_PROGRESS') {
         this.set('icon', 'icon-cog');
         this.set('iconColor', 'text-info');
@@ -52,11 +54,24 @@ App.HighAvailabilityProgressPageView = Em.View.extend({
       } else {
         this.set('icon', 'icon-cog');
         this.set('iconColor', '');
+        this.set('linkClass', 'not-active-link');
       }
     }.observes('content.status'),
 
     showProgressBar: function () {
       return this.get('content.status') === "IN_PROGRESS";
-    }.property('content.status')
+    }.property('content.status'),
+
+    /**
+     * open popup with list of hosts, that associated to service
+     * @param event
+     */
+    hostsLogPopup: function(event){
+      if(event.contexts[0].linkClass != "not-active-link"){
+        var serviceName = event.contexts[0].title;
+        var controller = this.get("controller");
+        App.HostPopup.initPopup(serviceName, controller);
+      }
+    }
   })
 });


Mime
View raw message