ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-20213. HiveView2.0 - order jobs with most recent first. (dipayanb)
Date Wed, 01 Mar 2017 06:23:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0ffa4789a -> 4c0690ac5


AMBARI-20213. HiveView2.0 - order jobs with most recent first. (dipayanb)


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

Branch: refs/heads/trunk
Commit: 4c0690ac5460d64c09bc0799d1a11b02520a0cba
Parents: 0ffa478
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Wed Mar 1 11:51:57 2017 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Wed Mar 1 11:53:03 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/components/jobs-browser.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c0690ac/contrib/views/hive20/src/main/resources/ui/app/components/jobs-browser.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/jobs-browser.js b/contrib/views/hive20/src/main/resources/ui/app/components/jobs-browser.js
index 7179d45..be2771c 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/components/jobs-browser.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/jobs-browser.js
@@ -25,11 +25,20 @@ export default Ember.Component.extend({
   statusFilter: null,
   titleFilter: null,
 
-  titleFilteredJobs: Ember.computed('jobs', 'titleFilter', function() {
+  sortedJobs: Ember.computed.sort('jobs', function (m1, m2) {
+    if (m1.get('dateSubmitted') < m2.get('dateSubmitted')) {
+      return 1;
+    } else if (m1.get('dateSubmitted') > m2.get('dateSubmitted')) {
+      return -1;
+    }
+    return 0;
+  }),
+
+  titleFilteredJobs: Ember.computed('sortedJobs', 'titleFilter', function() {
     if (!Ember.isEmpty(this.get('titleFilter'))) {
-      return (this.get('jobs').filter((entry) => entry.get('title').toLowerCase().indexOf(this.get('titleFilter').toLowerCase())
>= 0));
+      return (this.get('sortedJobs').filter((entry) => entry.get('title').toLowerCase().indexOf(this.get('titleFilter').toLowerCase())
>= 0));
     } else {
-      return this.get('jobs');
+      return this.get('sortedJobs');
     }
   }),
 


Mime
View raw message