Pārlūkot izejas kodu

AMBARI-5259. Jobs UI - Sorting on duration does not actually sort jobs (alexantonenko)

Alex Antonenko 11 gadi atpakaļ
vecāks
revīzija
3a7ad3a6c6

+ 1 - 6
ambari-web/app/routes/main.js

@@ -160,12 +160,7 @@ module.exports = Em.Route.extend({
       exit: function(router) {
         router.get('mainHiveJobDetailsController').set('loaded', false);
       }
-    }),
-    showJobDetails : function(router, event) {
-      if (event.context && event.context.get('hasTezDag')) {
-        router.transitionTo('jobDetails', event.context);
-      }
-    }
+    })
   }),
 
   mirroring: Em.Route.extend({

+ 1 - 5
ambari-web/app/templates/main/jobs.hbs

@@ -63,11 +63,7 @@
                 </td>
                 <td>
                   <div class="id">
-                    {{#if job.hasTezDag}}
-                      <a rel="tooltip" class="job-link" {{bindAttr data-original-title="job.queryText"}} href="#" {{action "showJobDetails" job}}>{{job.name}}</a>
-                    {{else}}
-                      <span rel="tooltip" class="job-link" {{bindAttr data-original-title="job.queryText"}}>{{job.name}}</span>
-                    {{/if}}
+                    {{view view.jobNameView jobBinding="job"}}
                   </div>
                 </td>
                 <td>

+ 23 - 0
ambari-web/app/views/main/jobs_view.js

@@ -229,6 +229,29 @@ App.MainJobsView = App.TableView.extend({
     }
   }),
 
+  jobNameView: Em.View.extend({
+    classNames: ['job-link'],
+    rel: 'tooltip',
+    href: '#',
+    template: Ember.Handlebars.compile('{{job.name}}'),
+    attributeBindings: function () {
+      var attributes = ['rel', 'job.queryText:data-original-title'];
+      if (this.get('job.hasTezDag')) {
+        attributes.push('href');
+      };
+      return attributes;
+    }.property('job.hasTezDag'),
+    tagName: function () {
+      return this.get('job.hasTezDag') ? 'a' : 'span';
+    }.property('job.hasTezDag'),
+    click: function(event) {
+      if (this.get('job.hasTezDag')) {
+        App.router.transitionTo('main.jobs.jobDetails', this.get('job'));
+      };
+      return false;
+    }
+  }),
+
   /**
    * associations between content (jobs list) property and column index
    */