ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gna...@apache.org
Subject ambari git commit: AMBARI-20164. Kill a workflow jumps to another tab in WFM. (Padma Priya N via gauravn7)
Date Fri, 24 Feb 2017 17:07:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ab8b821e2 -> ae3719754


AMBARI-20164. Kill a workflow jumps to another tab in WFM. (Padma Priya N via gauravn7)


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

Branch: refs/heads/branch-2.5
Commit: ae37197548bc1f4bc9111d2a51d95616a91aa0de
Parents: ab8b821
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Fri Feb 24 22:36:43 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Fri Feb 24 22:36:54 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/components/job-row.js |  2 +-
 .../resources/ui/app/components/search-table.js | 47 +++++++++++++++-----
 .../ui/app/domain/actionjob_hanlder.js          |  2 +-
 .../app/templates/components/search-table.hbs   | 15 ++++---
 4 files changed, 48 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ae371975/contrib/views/wfmanager/src/main/resources/ui/app/components/job-row.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-row.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-row.js
index 2b40392..ab32868 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-row.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-row.js
@@ -72,7 +72,7 @@ export default Ember.Component.extend({
         }else if(action === 'kill'){
           this.set('job.status','KILLED');
         }
-        this.sendAction('showMessage', {type:'success', message:`${action.toUpperCase()}
action complete. Job is ${this.get('job.status')}`});
+        this.sendAction('showMessage', {type:'success', message:`${action.toUpperCase()}
action request complete. Job is ${this.get('job.status')}`});
       }.bind(this)).catch(function(e){
         this.set('showError', true);
         this.set('showLoader', false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae371975/contrib/views/wfmanager/src/main/resources/ui/app/components/search-table.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/search-table.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/search-table.js
index c8df452..5f92d6f 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/search-table.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/search-table.js
@@ -44,6 +44,24 @@ export default Ember.Component.extend({
       });
     }
   }.on('didUpdate'),
+  handleBulkActionResponse(response){
+    if (typeof response === "string") {
+      response = JSON.parse(response);
+    }
+    if(response.workflows){
+      this.updateJobs(response.workflows, 'id');
+    }else if(response.coordinatorjobs){
+      this.updateJobs(response.coordinatorjobs, 'coordJobId');
+    }else if(response.bundlejobs){
+      this.updateJobs(response.bundlejobs, 'bundleJobId');
+    }
+  },
+  updateJobs(jobsToUpdate, queryField){
+    jobsToUpdate.forEach(job =>{
+      var existing = this.get('jobs.jobs').findBy('id', job[queryField]);
+      Ember.set(existing, 'status', job.status);
+    });
+  },
   actions: {
     selectAll() {
       this.$(".cbox").click();
@@ -56,25 +74,27 @@ export default Ember.Component.extend({
       this.sendAction("doRefresh");
     },
     doBulkAction(action){
+      this.set('showBulkActionLoader', true);
       var filter = '';
       var deferred = Ember.RSVP.defer();
       this.$('.cbox:checked').each(function(index, element){
-        filter = filter + "name=" + this.$(element).attr('name')+ ";";
+        filter = filter + "id=" + this.$(element).attr('id')+ ";";
       }.bind(this));
       var params = {};
-      this.$('#bulk-action-loader').removeClass('hidden');
       params.action = action;
       params.filter = filter;
       params.jobType = this.get('jobs.jobTypeValue');
       params.start = this.get('jobs.start');
       params.len = this.get('jobs.pageSize');
       this.sendAction('onBulkAction', params, deferred);
-      deferred.promise.then(function(){
-        this.sendAction("doRefresh");
-        this.$('#bulk-action-loader').addClass('hidden');
+      deferred.promise.then(function(response){
+        this.set('showBulkActionLoader', false);
+        this.handleBulkActionResponse(response);
         this.set('showBulkAction', false);
+        this.send('showMessage', {type:'success', message:`${action.toUpperCase()} action
request complete`});
       }.bind(this), function(){
-        this.$('#bulk-action-loader').addClass('hidden');
+        this.set('showBulkActionLoader', false);
+        this.send('showMessage', {type:'error', message: `${action.toUpperCase()} action
for could not be completed`});
       }.bind(this));
     },
     page: function (page) {
@@ -123,16 +143,23 @@ export default Ember.Component.extend({
         var isSame = status.every(function(value, idx, array){
           return idx === 0 || value === array[idx - 1];
         });
-        if(isSame && status[0] === 'SUSPENDED'){
+        if(isSame && status.get('firstObject') === 'SUSPENDED'){
           this.set('toggleResume', 'enabled');
+          this.set('toggleStart', 'disabled');
           this.set('toggleSuspend', 'disabled');
-        }else if(isSame && status[0] === 'RUNNING'){
+        }else if(isSame && status.get('firstObject') === 'PREP'){
+          this.set('toggleStart', 'enabled');
+          this.set('toggleSuspend', 'disabled');
+          this.set('toggleResume', 'disabled');
+        }else if(isSame && status.get('firstObject') === 'RUNNING'){
           this.set('toggleSuspend', 'enabled');
           this.set('toggleResume', 'disabled');
-        }else{
-          this.set('toggleKill', 'enabled');
+          this.set('toggleStart', 'disabled');
+        }else if(isSame && status.get('firstObject') === 'KILLED'){
+          this.set('toggleKill', 'disabled');
           this.set('toggleSuspend', 'disabled');
           this.set('toggleResume', 'disabled');
+          this.set('toggleStart', 'disabled');
         }
       }else{
         this.set('showBulkAction', false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae371975/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
b/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
index 691cc26..3058610 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/actionjob_hanlder.js
@@ -191,7 +191,7 @@ var SqoopActionJobHandler=ActionJobHandler.extend({
     ];
   },
   validate(nodeDomain){
-    if (Ember.isBlank(nodeDomain.command) && nodeDomain.arg.length < 1){
+    if (Ember.isBlank(nodeDomain.command) && (!nodeDomain.arg || nodeDomain.arg.length
< 1)){
       return [{message : "Either command or arguments have to be set."}];
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae371975/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/search-table.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/search-table.hbs
b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/search-table.hbs
index d28a497..7b5a625 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/search-table.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/search-table.hbs
@@ -44,14 +44,17 @@
             <i class="fa fa-cog" aria-hidden="true"></i>&nbsp;<span class="caret"></span>
           </button>
           <ul class="dropdown-menu">
-            <li {{action 'doBulkAction' 'resume'}} class={{toggleResume}}><a href="#"><i
class="fa fa-play"></i>Resume</a></li>
-            <li {{action 'doBulkAction' 'suspend'}} class={{toggleSuspend}}><a href="#"><i
class="fa fa-pause"></i>Suspend</a></li>
-            <li {{action 'doBulkAction' 'kill'}} class={{toggleKill}}><a href="#"><i
class="fa fa-close"></i>Kill</a></li>
+            <li {{action 'doBulkAction' 'start'}} class={{toggleStart}}><a href="javascript:void(0)"><i
class="fa fa-play"></i>Start</a></li>
+            <li {{action 'doBulkAction' 'resume'}} class={{toggleResume}}><a href="javascript:void(0)"><i
class="fa fa-play"></i>Resume</a></li>
+            <li {{action 'doBulkAction' 'suspend'}} class={{toggleSuspend}}><a href="javascript:void(0)"><i
class="fa fa-pause"></i>Suspend</a></li>
+            <li {{action 'doBulkAction' 'kill'}} class={{toggleKill}}><a href="javascript:void(0)"><i
class="fa fa-close"></i>Kill</a></li>
           </ul>
         </div>
-        <div id="bulk-action-loader" class='loading-container hidden'>
-          {{spin-spinner lines=7 length=3 width=3 radius=3 top=-10 left=150}}
-        </div>
+        {{#if showBulkActionLoader}}
+          <div class='loading-container'>
+            {{spin-spinner lines=7 length=3 width=3 radius=3 top=200 left=1250}}
+          </div>
+        {{/if}}
         {{/if}}
       </th>
     </tr>


Mime
View raw message