ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject ambari git commit: AMBARI-13055. [Hive View Visualization] Add more options for max number of rows for reports/charts. (Pallav Kulshreshtha via yusaku)
Date Tue, 22 Sep 2015 00:00:14 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 f11802c73 -> 1e6707e1a


AMBARI-13055. [Hive View Visualization] Add more options for max number of rows for reports/charts.
(Pallav Kulshreshtha via yusaku)


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

Branch: refs/heads/branch-2.1
Commit: 1e6707e1a40d06434279a93977136d334a747a8e
Parents: f11802c
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Mon Sep 21 16:58:55 2015 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Mon Sep 21 17:00:00 2015 -0700

----------------------------------------------------------------------
 .../app/controllers/visualization-ui.js         | 56 +++++++++++++++++++-
 .../resources/ui/hive-web/app/styles/app.scss   | 12 +++++
 .../components/visualization-tabs-widget.hbs    |  2 +-
 .../hive-web/app/templates/visualization-ui.hbs |  7 ++-
 .../ui/hive-web/app/utils/constants.js          |  3 +-
 5 files changed, 75 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1e6707e1/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js
b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js
index 5ba22e4..fd0645b 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js
@@ -20,6 +20,7 @@ import Ember from 'ember';
 import constants from 'hive/utils/constants';
 
 export default Ember.Controller.extend({
+  selectedRowCount: constants.defaultVisualizationRowCount,
   needs: [ constants.namingConventions.index,
             constants.namingConventions.openQueries,
             constants.namingConventions.jobResults
@@ -27,12 +28,16 @@ export default Ember.Controller.extend({
   index         : Ember.computed.alias('controllers.' + constants.namingConventions.index),
   openQueries   : Ember.computed.alias('controllers.' + constants.namingConventions.openQueries),
   results   : Ember.computed.alias('controllers.' + constants.namingConventions.jobResults),
+  notifyService: Ember.inject.service(constants.namingConventions.notify),
 
   polestarUrl: '',
   voyagerUrl: '',
   polestarPath: 'polestar/#/',
   voyagerPath: 'voyager/#/',
 
+  showDataExplorer: true,
+  showAdvVisulization: false,
+
   visualizationTabs: function () {
     return [
       Ember.Object.create({
@@ -48,6 +53,12 @@ export default Ember.Controller.extend({
     ]
   }.property('polestarUrl', 'voyagerUrl'),
 
+  activeTab: function () {
+    console.log("I am in activeTab function.");
+    this.get('visualizationTabs')[0].active = this.get("showDataExplorer");
+    this.get('visualizationTabs')[1].active = this.get("showAdvVisulization");
+  }.observes('polestarUrl', 'voyagerUrl'),
+
   alterIframe: function () {
     Ember.$("#visualization_frame").height(Ember.$("#visualization").height());
   },
@@ -60,7 +71,7 @@ export default Ember.Controller.extend({
         var existingJob = this.get('results').get('cachedResults').findBy('id', model.get('id'));
         var url = this.container.lookup('adapter:application').buildURL();
         url += '/' + constants.namingConventions.jobs + '/' + model.get('id') + '/results?&first=true';
-        url += '&count='+constants.visualizationRowCount+'&job_id='+model.get('id');
+        url += '&count='+self.get('selectedRowCount')+'&job_id='+model.get('id')
         if (existingJob) {
           if(existingJob.results[0].rows.length === 0){
             this.set("error", "Query has insufficient results to visualize the data.");
@@ -77,6 +88,47 @@ export default Ember.Controller.extend({
           this.set("error", "No visualization available. Please execute a query and wait
for the results to visualize the data.");
         }
       }
-    }
+    },
+
+      changeRowCount: function () {
+        var self = this;
+        if(isNaN(self.get('selectedRowCount')) || !(self.get('selectedRowCount')%1 === 0)
|| (self.get('selectedRowCount') <= 0)){
+          self.get('notifyService').error("Please enter a posive integer number.");
+          return;
+        }
+        var model = this.get('index.model');
+        if (model) {
+          var existingJob = this.get('results').get('cachedResults').findBy('id', model.get('id'));
+          var url = this.container.lookup('adapter:application').buildURL();
+          url += '/' + constants.namingConventions.jobs + '/' + model.get('id') + '/results?&first=true';
+          url += '&count='+self.get('selectedRowCount')+'&job_id='+model.get('id');
+          if (existingJob) {
+            this.set("error", null);
+            var id = model.get('id');
+
+            $('.nav-tabs.visualization-tabs li.active').each(function( index ) {
+
+              if($(this)[index].innerText.indexOf("Data Explorer") > -1){
+                self.set("showDataExplorer",true);
+                self.set("showAdvVisulization",false);
+                self.set("voyagerUrl", self.get('voyagerPath') + "?url=" + url);
+                self.set("polestarUrl", self.get('polestarPath') + "?url=" + url);
+                document.getElementById("visualization_frame").src =  self.get("voyagerUrl");
+              }
+              if($(this)[index].innerText.indexOf("Advanced Visualization") > -1){
+                self.set("showAdvVisulization",true);
+                self.set("showDataExplorer",false);
+                self.set("voyagerUrl", self.get('voyagerPath') + "?url=" + url);
+                self.set("polestarUrl", self.get('polestarPath') + "?url=" + url);
+                document.getElementById("visualization_frame").src = self.get("polestarUrl");
+              }
+            })
+            document.getElementById("visualization_frame").contentWindow.location.reload();
+          } else {
+            this.set("error", "No visualization available. Please execute a query and wait
for the results to visualize data.");
+          }
+        }
+
+      }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e6707e1/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
index 398a8ef..5283daf 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/styles/app.scss
@@ -563,3 +563,15 @@ tree-view ul li {
     width: 300px;
   }
 }
+
+#visualization{
+    .max-rows {
+      float: right;
+    }
+}
+
+#visualization{
+    .max-rows {
+      float: right;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e6707e1/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/visualization-tabs-widget.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/visualization-tabs-widget.hbs
b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/visualization-tabs-widget.hbs
index f46b709..dad5e41 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/visualization-tabs-widget.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/components/visualization-tabs-widget.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<ul class="nav nav-tabs">
+<ul class="nav nav-tabs visualization-tabs">
   {{#each tab in tabs}}
       <li {{bind-attr class="tab.active:active"}} {{action 'selectTab' tab}}>
         <a>{{tab.name}}</a>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e6707e1/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visualization-ui.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visualization-ui.hbs
b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visualization-ui.hbs
index 79c0f63..22cbaef 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visualization-ui.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visualization-ui.hbs
@@ -22,7 +22,12 @@
       <div class="alert alert-danger" role="alert"><strong>{{error}}</strong></div>
     {{else}}
       {{#if polestarUrl}}
-        {{#visualization-tabs-widget tabs=visualizationTabs}}
+        <div class="max-rows" >
+          <label>Maximum Row Count: </label> {{input value=selectedRowCount placeholder=selectedRowCount
}}
+          <button {{action "changeRowCount"}}>OK</button>
+        </div>
+        {{#visualization-tabs-widget tabs=visualizationTabs }}
+
         {{/visualization-tabs-widget}}
       {{else}}
           <div class="alert alert-danger" role="alert"><strong>An unknown error
occurred! Please try again later.</strong></div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e6707e1/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
index c5d5cf0..0000691 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/utils/constants.js
@@ -222,5 +222,6 @@ export default Ember.Object.create({
     comment: "--Global Settings--\n\n"
   },
 
-  visualizationRowCount: 30000
+  defaultVisualizationRowCount: 30000
+
 });


Mime
View raw message