You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2017/02/09 10:24:23 UTC

ambari git commit: AMBARI-19916. HiveView2.0: No option to search for jobs in the jobs tab. (dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 38cf7a63d -> a512b3e67


AMBARI-19916. HiveView2.0: No option to search for jobs in the jobs tab. (dipayanb)


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

Branch: refs/heads/branch-2.5
Commit: a512b3e67f6023166471dd6b05e9fb2e5c497454
Parents: 38cf7a6
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Thu Feb 9 15:54:11 2017 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Thu Feb 9 15:54:11 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/jobs-browser.js | 39 ++++++++++++++++++--
 .../src/main/resources/ui/app/styles/app.scss   |  2 +-
 .../app/templates/components/jobs-browser.hbs   | 17 +++++++--
 3 files changed, 49 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a512b3e6/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 b0a82b0..7179d45 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
@@ -22,15 +22,33 @@ export default Ember.Component.extend({
   startTime: null,
   endTime: null,
   maxEndTime: null,
-  statusCounts: Ember.computed('jobs', function() {
-    return this.get('jobs').reduce((acc, item, index) => {
+  statusFilter: null,
+  titleFilter: null,
+
+  titleFilteredJobs: Ember.computed('jobs', 'titleFilter', function() {
+    if (!Ember.isEmpty(this.get('titleFilter'))) {
+      return (this.get('jobs').filter((entry) => entry.get('title').toLowerCase().indexOf(this.get('titleFilter').toLowerCase()) >= 0));
+    } else {
+      return this.get('jobs');
+    }
+  }),
+
+  filteredJobs: Ember.computed('titleFilteredJobs', 'statusFilter', function () {
+    if (this.get('statusFilter')) {
+      return  this.get('titleFilteredJobs').filter((entry) => entry.get('status').toLowerCase() === this.get('statusFilter'));
+    } else {
+      return this.get('titleFilteredJobs');
+    }
+  }),
+
+  statusCounts: Ember.computed('titleFilteredJobs', function () {
+    return this.get('titleFilteredJobs').reduce((acc, item, index) => {
       let status = item.get('status').toLowerCase();
-      if(Ember.isEmpty(acc[status])) {
+      if (Ember.isEmpty(acc[status])) {
         acc[status] = 1;
       } else {
         acc[status] = acc[status] + 1;
       }
-
       return acc;
     }, {});
   }),
@@ -39,6 +57,19 @@ export default Ember.Component.extend({
   actions: {
     setDateRange(startDate, endDate) {
       this.sendAction('filterChanged', startDate, endDate);
+    },
+
+    selectJobForStatus(status) {
+      let s = status.toLowerCase();
+      if (s === 'all') {
+        this.set('statusFilter');
+      } else {
+        this.set('statusFilter', s);
+      }
+    },
+
+    clearTitleFilter() {
+      this.set('titleFilter');
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a512b3e6/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
index 4f73ef8..0dae396 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
@@ -787,7 +787,7 @@ pre {
   border-top: 1px solid darken($body-bg, 10%);
   border-bottom: 1px solid darken($body-bg, 10%);
   .strip {
-    margin-top: 25px;
+    margin-top: 20px;
   }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a512b3e6/contrib/views/hive20/src/main/resources/ui/app/templates/components/jobs-browser.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/jobs-browser.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/jobs-browser.hbs
index abb4a97..014691e 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/jobs-browser.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/jobs-browser.hbs
@@ -18,15 +18,24 @@
 
 <div class="row jobs-status">
   <div class="col-md-12 ">
-    <div class="col-md-9">
+    <div class="col-md-7">
       <div class="strip">
-        <ul class="list-inline">
+        <ul class="nav nav-pills">
+          <li class="{{if (not statusFilter) "active"}}"><a href="#" {{action "selectJobForStatus" "all"}}>{{titleFilteredJobs.length}} <span class="text-uppercase">All</span></a></li>
           {{#each-in statusCounts as |status count|}}
-            <li>{{count}} <span class="text-uppercase">{{status}}</span></li>
+            <li class="{{if (eq statusFilter status) "active"}}"><a href="#" {{action "selectJobForStatus" status}}>{{count}} <span class="text-uppercase">{{status}}</span></a></li>
           {{/each-in}}
         </ul>
       </div>
     </div>
+    <div class="col-md-2">
+      <div class="row strip input-group">
+        {{input type="text" value=titleFilter placeholder="Search title" class="form-control"}}
+        <span class="input-group-btn">
+          <button class="btn btn-default" {{action "clearTitleFilter"}}>{{fa-icon "times"}} </button>
+        </span>
+      </div>
+    </div>
     <div class="col-md-3">
       {{date-range-picker
         start=startTime
@@ -54,7 +63,7 @@
         </tr>
       </thead>
       <tbody>
-        {{#each jobs as |job| }}
+        {{#each filteredJobs as |job| }}
           {{job-item job=job}}
         {{/each}}
       </tbody>