You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2015/09/22 01:59:45 UTC
ambari git commit: AMBARI-13055. [Hive View Visualization] Add more
options for max number of rows for reports/charts. (Pallav Kulshreshtha via
yusaku)
Repository: ambari
Updated Branches:
refs/heads/trunk f9271abc2 -> 6d165213e
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/6d165213
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6d165213
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6d165213
Branch: refs/heads/trunk
Commit: 6d165213e25ff31ce64e0bd92f07ed986f8bac28
Parents: f9271ab
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Mon Sep 21 16:58:55 2015 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Mon Sep 21 16:58:55 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/6d165213/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/6d165213/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/6d165213/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/6d165213/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/6d165213/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
+
});