You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/02/17 22:06:03 UTC

[04/50] [abbrv] ambari git commit: AMBARI-20019. WFM Dashboard Actions menu items not working properly.(Padma Priya N via gauravn7)

AMBARI-20019. WFM Dashboard Actions menu items not working properly.(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/f91095b5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f91095b5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f91095b5

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: f91095b55e18c79a70ac58937b608f7d4cd5adeb
Parents: 2edfefc
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Wed Feb 15 17:09:08 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Wed Feb 15 17:10:02 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/components/job-row.js | 26 +++++++++++++++---
 .../ui/app/components/search-create-new-bar.js  | 11 ++++----
 .../resources/ui/app/components/search-table.js |  8 ++++++
 .../ui/app/controllers/design/dashboardtab.js   |  8 +++---
 .../ui/app/routes/design/dashboardtab.js        | 15 ++++++++---
 .../src/main/resources/ui/app/styles/app.less   |  1 +
 .../templates/components/designer-workspace.hbs | 10 +++----
 .../ui/app/templates/components/job-row.hbs     | 28 ++++++++++----------
 .../app/templates/components/search-table.hbs   | 12 ++++++---
 9 files changed, 79 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/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 2a5fc22..1dd580e 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
@@ -38,16 +38,33 @@ export default Ember.Component.extend({
     });
     return deferred.promise;
   },
+  jobType : Ember.computed('job', function(){
+    if(this.get('job').bundleJobId){
+      return 'bundle';
+    }else if(this.get('job').coordJobId){
+      return 'coord';
+    }else{
+      return 'wf';
+    }
+
+  }),
   actions : {
     doAction(action, id) {
+      this.set('showError', false);
+      this.set('showLoader', true);
       var deferred = Ember.RSVP.defer();
       deferred.promise.then(function(){
+        this.set('showLoader', false);
         if(action === 'start'){
           this.set('job.status','RUNNING');
-        }else if(action === 'suspend'){
+        }else if(action === 'suspend' && this.get('job.status') === 'RUNNING'){
           this.set('job.status','SUSPENDED');
-        }else if(action === 'resume'){
+        }else if(action === 'suspend' && this.get('job.status') === 'PREP'){
+          this.set('job.status','PREPSUSPENDED');
+        }else if(action === 'resume' && this.get('job.status') === 'SUSPENDED'){
           this.set('job.status','RUNNING');
+        }else if(action === 'resume' && this.get('job.status') === 'PREPSUSPENDED'){
+          this.set('job.status','PREP');
         }else if(action === 'stop'){
           this.set('job.status','STOPPED');
         }else if(action === 'rerun'){
@@ -55,7 +72,10 @@ export default Ember.Component.extend({
         }else if(action === 'kill'){
           this.set('job.status','KILLED');
         }
-      }.bind(this),function(){
+      }.bind(this)).catch(function(e){
+        this.set('showError', true);
+        this.set('showLoader', false);
+        console.error(e);
       }.bind(this));
       if(action === 'rerun' && this.get('job').bundleJobId){
         action = 'bundle-'+action;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/components/search-create-new-bar.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/search-create-new-bar.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/search-create-new-bar.js
index e9bc44f..e6f7ec8 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/search-create-new-bar.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/search-create-new-bar.js
@@ -88,17 +88,16 @@ export default Ember.Component.extend(Ember.Evented,{
                     'Status:SUSPENDED',
                     'Status:SUCCEEDED',
                     'Status:KILLED',
-                    'Status:FAILED'];
+                    'Status:FAILED',
+                    'Status:PREP'];
       var substringMatcher = function(strs) {
         return function findMatches(q, cb) {
           var searchTerm =  self.$('#search-field').tagsinput('input').val();
           var originalLength = strs.length;
-          if(self.get('jobType') === 'wf'){
-            strs.push('Status:PREP');
+          if(self.get('jobType') && self.get('jobType') !== 'wf'){
+            strs.pushObjects(['Status:PREPSUSPENDED','Status:PREPPAUSED','Status:DONEWITHERROR']);
           }
-          strs.push('Name:'+ searchTerm);
-          strs.push('User:'+ searchTerm);
-          strs.push('Job id:'+ searchTerm);
+          strs.pushObjects(['Name:'+ searchTerm, 'User:'+ searchTerm, 'Job id:'+ searchTerm]);
           var newLength = strs.length;
           var matches, substrRegex;
           matches = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/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 714de66..b2f2a57 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
@@ -20,6 +20,7 @@ import Ember from 'ember';
 export default Ember.Component.extend({
   showBulkAction : false,
   history: Ember.inject.service(),
+  userInfo : Ember.inject.service('user-info'),
   currentPage : Ember.computed('jobs.start',function(){
     if(Ember.isBlank(this.get('jobs.start'))){
       return 1;
@@ -30,6 +31,13 @@ export default Ember.Component.extend({
   rendered : function(){
     this.sendAction('onSearch', this.get('history').getSearchParams());
   }.on('didInsertElement'),
+  isUpdated : function(){
+    if(this.get('showActionError')){
+      this.$('#alert').fadeOut(2500, ()=>{
+        this.set("showActionError", false);
+      });
+    }
+  }.on('didUpdate'),
   actions: {
     selectAll() {
       this.$(".cbox").click();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design/dashboardtab.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design/dashboardtab.js b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design/dashboardtab.js
index 9760ddb..98dcd70 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design/dashboardtab.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/controllers/design/dashboardtab.js
@@ -46,10 +46,10 @@ export default Ember.Controller.extend({
       if(params.action.indexOf('rerun') > -1){
         jobActionParams.data = params.conf;
       }
-      Ember.$.ajax(jobActionParams).done(function(){
-        deferred.resolve();
-      }).fail(function(){
-        deferred.reject();
+      Ember.$.ajax(jobActionParams).done(function(response){
+        deferred.resolve(response);
+      }).fail(function(error){
+        deferred.reject(error);
       });
     },
     onBulkAction : function(params, deferred){

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/dashboardtab.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/dashboardtab.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/dashboardtab.js
index 95d06fc..0749d98 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/dashboardtab.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design/dashboardtab.js
@@ -19,6 +19,7 @@ import Ember from 'ember';
 
 export default Ember.Route.extend({
   history: Ember.inject.service(),
+  userInfo : Ember.inject.service('user-info'),
   errorMessage : "Error",
   queryParams: {
     jobType: { refreshModel: true },
@@ -85,10 +86,16 @@ export default Ember.Route.extend({
       "&filter=", filter
     ].join(""),
     page = (start - 1) / len + 1;
-    return this.fetchJobs(url).catch(function(){
+    return Ember.RSVP.hash({
+      jobs : this.fetchJobs(url),
+      userName:this.get("userInfo").getUserData()
+    }).catch(function(e){
+      console.error(e);
       this.controllerFor('design.dashboardtab').set('model',{error : "Remote API Failed"});
       Ember.$("#loading").css("display", "none");
-    }.bind(this)).then(function (res) {
+    }.bind(this)).then(function (response) {
+      var res = response.jobs;
+      this.controllerFor('design.dashboardtab').set('userName', response.userName);
       if(!res){
         return;
       }
@@ -145,10 +152,10 @@ export default Ember.Route.extend({
       return res;
     }.bind(this));
   },
-  afterModel: function (model) {
+  afterModel: function () {
     Ember.$("#loading").css("display", "none");
   },
-  model: function (params) {
+  model: function () {
 
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
index 3f24000..f4869e4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
@@ -1030,6 +1030,7 @@ height: 100vh;
 .PAUSEDWITHERROR,
 .PREPPAUSED,
 .RUNNINGWITHERROR,
+.PREPSUSPENDED,
 .SUSPENDED,
 .SUSPENDEDWITHERROR {
     color: #f0ad4e;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs
index a4a0cc2..c8d8dc3 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/designer-workspace.hbs
@@ -26,13 +26,13 @@
         </div>
         <div class="col-sm-8">
           <div class="text-right pull-right paddingtop7">
-              <button {{action 'showDashboard'}} class="backto-dashboard btn btn-default" title="Workflow Dashboard">
+              <button id="dashboard-btn" {{action 'showDashboard'}} class="backto-dashboard btn btn-default" title="Workflow Dashboard">
                 <i class="fa fa-th marginright5"></i>Dashboard
               </button>
             <div class="btn-group">
             <div class="btn-group">
             <div class="dropdown create-wf-menu">
-              <button class="btn btn-default dropdown-toggle borderRightRadiusNone" type="button" data-toggle="dropdown">Create
+              <button id="create-workflows-btn" class="btn btn-default dropdown-toggle borderRightRadiusNone" type="button" data-toggle="dropdown">Create
                 <span class="caret"></span></button>
                 <ul class="dropdown-menu">
                   <li>
@@ -70,7 +70,7 @@
             </div>
             <div class="btn-group">
             <div class="dropdown create-wf-menu">
-              <button class="btn btn-default dropdown-toggle borderRadiusNone" {{action "showTopRecentList"}} type="button" data-toggle="dropdown">Recent
+              <button id="recent-workflows-btn" class="btn btn-default dropdown-toggle borderRadiusNone" {{action "showTopRecentList"}} type="button" data-toggle="dropdown">Recent
                 <span class="caret"></span></button>
                 <ul class="dropdown-menu proj-menu">
                  {{#if projList}}
@@ -88,7 +88,7 @@
                     </li>
                    {{/each}}
                   <li>
-                      <a {{action "showProjectManagerList"}} title="My Workflows" class="pointer">
+                      <a id="more-workflows-btn" {{action "showProjectManagerList"}} title="My Workflows" class="pointer">
                       More...
                       </a>
                   </li>
@@ -100,7 +100,7 @@
                 </ul>
              </div>
              </div>
-              <button {{action "showAssetManager" true}} class="btn btn-default" title="Manage Assets">
+              <button id="manage-assets-btn" {{action "showAssetManager" true}} class="btn btn-default" title="Manage Assets">
                   Manage Assets
               </button>
             </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-row.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-row.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-row.hbs
index be9310e..4c18d5d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-row.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-row.hbs
@@ -46,7 +46,7 @@
       <button title="Start" {{action 'doAction' 'start' job.id}} type="button" class="btn btn-default isOn" data-status="{{job.status}}">
         <i class="fa fa-play">  </i>
       </button>
-      {{else if (eq job.status "SUSPENDED")}}
+      {{else if (or (eq job.status "SUSPENDED")(eq job.status "PREPSUSPENDED"))}}
       <button title="Resume" {{action 'doAction' 'resume' job.id}} type="button" class="btn btn-default isOn" data-status="{{job.status}}">
         <i class="fa fa-play">  </i>
       </button>
@@ -55,38 +55,38 @@
         <i class="fa fa-play">  </i>
       </button>
       {{/if}}
-      {{#if (eq job.status "RUNNING")}}
-      <button {{action 'doAction' 'suspend' job.id}} type="button" class="btn btn-default isOn" data-status="{{job.status}}">
+      {{#if (or (eq job.status "RUNNING")(and (eq job.status "PREP") (eq jobType "coord")))}}
+      <button title="Suspend" {{action 'doAction' 'suspend' job.id}} type="button" class="btn btn-default isOn" data-status="{{job.status}}">
         <i class="fa fa-pause">  </i>
       </button>
       {{else}}
-      <button type="button" class="btn btn-default" data-status="{{job.status}}">
+      <button title="Suspend" type="button" class="btn btn-default" data-status="{{job.status}}">
         <i class="fa fa-pause">  </i>
       </button>
       {{/if}}
-      {{#if (or (eq job.status "FAILED") (eq job.status "KILLED"))}}
-      <button {{action 'doAction' 'rerun' job.id}} type="button" class="btn btn-default isOn">
+      {{#if (or (eq job.status "FAILED") (eq job.status "KILLED") (eq job.status "SUCCEEDED")(eq job.status "DONEWITHERROR"))}}
+      <button title="Rerun" {{action 'doAction' 'rerun' job.id}} type="button" class="btn btn-default isOn">
         <i class="fa fa-repeat">  </i>
       </button>
       {{else}}
-      <button {{action 'doAction' 'rerun' job.id}} type="button" class="btn btn-default">
+      <button title="Rerun" type="button" class="btn btn-default">
         <i class="fa fa-repeat">  </i>
       </button>
       {{/if}}
     </div>
-    {{#if (eq job.status "RUNNING")}}
-    <button {{action 'doAction' 'kill' job.id}} type="button" class="isOn btn btn-default btn-sm btn-kill">
+    {{#if (not (or (eq job.status "SUCCEEDED")(eq job.status "FAILED")(eq job.status "KILLED")))}}
+    <button title="Kill" {{action 'doAction' 'kill' job.id}} type="button" class="isOn btn btn-default btn-sm btn-kill">
       <i class="fa fa-close">  </i> Kill
     </button>
     {{else}}
-    <button {{action 'doAction' 'kill' job.id}} type="button" class="btn btn-default btn-sm btn-kill">
+    <button title="Kill" type="button" class="btn btn-default btn-sm btn-kill">
       <i class="fa fa-close">  </i> Kill
     </button>
     {{/if}}
-    {{#if showLoader}}
+  </div>
+  {{#if showLoader}}
     <div class='loading-container'>
-      {{spin-spinner lines=7 length=3 width=3 radius=3 top=-10 left=150}}
+      {{spin-spinner lines=7 length=3 width=3 radius=3 top=10 left=150}}
     </div>
-    {{/if}}
-  </div>
+  {{/if}}
 </td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/f91095b5/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 eccc95d..5c15493 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
@@ -15,7 +15,11 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-
+{{#if showActionError}}
+<div id="alert"class="alert alert-danger alert-dismissible fade in workflow-error" role="alert">
+  <span>Action could not be completed.</span>
+</div>
+{{/if}}
 <table id="search-table" class="table search-table listing table-striped table-hover table-bordered" cellspacing="0" width="100%">
   <thead>
     <tr>
@@ -49,9 +53,9 @@
   </thead>
   <tbody>
     {{#if jobs.jobs}}
-    {{#each jobs.jobs as |job idx|}}
-    {{#job-row job=job onAction="onAction" showJobDetails="showJobDetails" rowSelected="rowSelected"}}{{/job-row}}
-    {{/each}}
+      {{#each jobs.jobs as |job idx|}}
+        {{#job-row job=job onAction="onAction" showJobDetails="showJobDetails" rowSelected="rowSelected" userName=userName showError=showActionError}}{{/job-row}}
+      {{/each}}
     {{/if}}
   </tbody>
 </table>