Prechádzať zdrojové kódy

AMBARI-12971. Hive view visualization enhancements - error handling. (Pallav Kulshreshtha via yusaku)

Yusaku Sako 9 rokov pred
rodič
commit
98d3f320fa

+ 10 - 0
contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/query-tabs.js

@@ -20,6 +20,11 @@ import Ember from 'ember';
 import constants from 'hive/utils/constants';
 
 export default Ember.Controller.extend({
+  jobProgressService: Ember.inject.service(constants.namingConventions.jobProgress),
+  openQueries   : Ember.inject.controller(constants.namingConventions.openQueries),
+  notifyService: Ember.inject.service(constants.namingConventions.notify),
+  index: Ember.inject.controller(),
+
   tabClassNames : "fa queries-icon query-context-tab",
 
   tabs: [
@@ -43,6 +48,7 @@ export default Ember.Controller.extend({
     Ember.Object.create({
       iconClass: 'fa-area-chart',
       id: 'visualization-icon',
+      type: 'visualization',
       action: 'toggleOverlay',
       tooltip: Ember.I18n.t('tooltips.visualization'),
       into: 'index',
@@ -155,6 +161,10 @@ export default Ember.Controller.extend({
     }
   },
 
+  showVisulization: function () {
+    return this.get('index.displayJobTabs');
+  }.property('index.content', 'index.jobSaveSucceeded'),
+
   actions: {
     toggleOverlay: function (tab) {
       if (tab !== this.get('default') && tab.get('active')) {

+ 5 - 2
contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visualization-ui.js

@@ -20,7 +20,6 @@ import Ember from 'ember';
 import constants from 'hive/utils/constants';
 
 export default Ember.Controller.extend({
-
   needs: [ constants.namingConventions.index,
             constants.namingConventions.openQueries,
             constants.namingConventions.jobResults
@@ -63,6 +62,10 @@ export default Ember.Controller.extend({
         url += '/' + constants.namingConventions.jobs + '/' + model.get('id') + '/results?&first=true';
         url += '&count='+constants.visualizationRowCount+'&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.");
+            return;
+          }
           this.set("error", null);
           var id = model.get('id');
           this.set("polestarUrl", this.get('polestarPath') + "?url=" + url);
@@ -71,7 +74,7 @@ export default Ember.Controller.extend({
             self.alterIframe();
           });
         } else {
-          this.set("error", "No visualization available. Please execute a query and wait for the results to visualize data.");
+          this.set("error", "No visualization available. Please execute a query and wait for the results to visualize the data.");
         }
       }
     }

+ 22 - 8
contrib/views/hive/src/main/resources/ui/hive-web/app/templates/query-tabs.hbs

@@ -17,13 +17,27 @@
 }}
 
 {{#each tab in tabs}}
-    <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active tab.flash:flash" title="tab.tooltip" id="tab.id"}}>
-      {{#if tab.badge}}
-        <span class="badge">{{tab.badge}}</span>
-      {{/if}}
+  {{#if tab.type}}
+    {{#if showVisulization}}
+        <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active tab.flash:flash" title="tab.tooltip" id="tab.id"}}>
+          {{#if tab.badge}}
+            <span class="badge">{{tab.badge}}</span>
+          {{/if}}
 
-      {{#if tab.text}}
-        {{tab.text}}
-      {{/if}}
-    </span>
+          {{#if tab.text}}
+            {{tab.text}}
+          {{/if}}
+        </span>
+    {{/if}}
+    {{else}}
+      <span {{action tab.action tab}} {{bind-attr class=":query-menu-tab tabClassNames tab.iconClass tab.active:active tab.flash:flash" title="tab.tooltip" id="tab.id"}}>
+        {{#if tab.badge}}
+          <span class="badge">{{tab.badge}}</span>
+        {{/if}}
+
+        {{#if tab.text}}
+          {{tab.text}}
+        {{/if}}
+      </span>
+  {{/if}}
 {{/each}}

+ 2 - 2
contrib/views/hive/src/main/resources/ui/hive-web/bower.json

@@ -18,8 +18,8 @@
     "jquery-ui": "~1.11.2",
     "selectize": "~0.12.0",
     "pretender": "0.1.0",
-    "polestar": "https://github.com/vivekratnavel/polestar.git",
-    "voyager": "https://github.com/vivekratnavel/voyager.git"
+    "polestar": "https://github.com/pallavkul/polestar.git",
+    "voyager": "https://github.com/pallavkul/voyager.git"
   },
   "resolutions": {
     "ember": "1.10.0"