ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject [03/11] ambari git commit: AMBARI-21198. Hive2. Query result improvements (pallavkul)
Date Mon, 12 Jun 2017 16:34:27 GMT
AMBARI-21198. Hive2. Query result improvements (pallavkul)


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

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d5105226bcfcb97d938e92d40914ef3a083c2d77
Parents: 13798c2
Author: pallavkul <pallav.kul@gmail.com>
Authored: Mon Jun 12 14:47:02 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Mon Jun 12 14:47:02 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/models/worksheet.js   |  1 +
 .../resources/ui/app/routes/queries/query.js    | 15 +---
 .../ui/app/routes/queries/query/results.js      |  6 +-
 .../templates/components/query-result-table.hbs | 92 ++++++++++----------
 .../ui/app/templates/queries/query.hbs          | 10 +--
 .../ui/app/templates/queries/query/log.hbs      | 12 ++-
 .../ui/app/templates/queries/query/results.hbs  |  9 +-
 7 files changed, 74 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js b/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
index 12a681c..e3c4d07 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/models/worksheet.js
@@ -29,6 +29,7 @@ export default DS.Model.extend({
   nextPage: DS.attr('number', {defaultValue: 1}),
   selected: DS.attr('boolean', {transient: true, defaultValue: false}),
   jobData: DS.attr({defaultValue: []}),
+  currentJobId: DS.attr({defaultValue: null}),
   currentJobData: DS.attr({defaultValue: null}),
   hasNext: DS.attr('boolean', { defaultValue: false}),
   hasPrevious: DS.attr('boolean', { defaultValue: false}),

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
index 6b395ac..f6256898 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query.js
@@ -128,30 +128,23 @@ export default Ember.Route.extend(UILoggerMixin, {
     controller.set('worksheet', model);
     controller.set('selectedTablesModels',model.get('selectedTablesModels') || selectedTablesModels
);
     controller.set('selectedMultiDb', model.get('selectedMultiDb') || selectedMultiDb);
-
     controller.set('isQueryRunning', model.get('isQueryRunning'));
     controller.set('currentQuery', model.get('query'));
-    controller.set('currentJobId', null);
+    controller.set('currentJobId', model.get('currentJobId'));
     controller.set('queryResult', model.get('queryResult'));
     controller.set('isJobSuccess', model.get('isJobSuccess'));
     controller.set('isJobCancelled', model.get('isJobCancelled'));
     controller.set('isJobCreated', model.get('isJobCreated'));
-
     controller.set('isExportResultSuccessMessege', false);
     controller.set('isExportResultFailureMessege', false);
     controller.set('showSaveHdfsModal', false);
-
     controller.set('logResults', model.get('logResults') || '');
-
     controller.set('isVisualExplainQuery', false);
     controller.set('visualExplainJson', model.get('visualExplainJson'));
-
     controller.set('showWorksheetModal',false);
     controller.set('worksheetModalSuccess',false);
     controller.set('worksheetModalFail',false);
-
     controller.set('tabs', tabs);
-
   },
   checkIfDeafultDatabaseExists(alldatabases){
     if(this.get('controller.model').get('selectedDb')) {
@@ -248,7 +241,7 @@ export default Ember.Route.extend(UILoggerMixin, {
     executeQuery(isVisualExplainQuery){
 
       let self = this, ctrlr = self.get('controller'), ctrlrModel = self.get('controller.model');
-      this.get('controller').set('currentJobId', null);
+      this.get('controller.model').set('currentJobId', null);
       if(!Ember.isEmpty(isVisualExplainQuery)){
         isVisualExplainQuery = true;
         this.get('controller').set('isVisualExplainQuery', true);
@@ -325,7 +318,7 @@ export default Ember.Route.extend(UILoggerMixin, {
         self.get('controller.model').set('currentJobData', data);
         self.get('controller.model').set('queryFile', data.job.queryFile);
         self.get('controller.model').set('logFile', data.job.logFile);
-        self.get('controller').set('currentJobId', data.job.id);
+        self.get('controller.model').set('currentJobId', data.job.id);
         ctrlrModel.set('isJobCreated',true);
         ctrlr.set('isJobCreated',true);
 
@@ -362,7 +355,7 @@ export default Ember.Route.extend(UILoggerMixin, {
     },
 
     stopQuery(){
-      let jobId = this.get('controller').get('currentJobId');
+      let jobId = this.get('controller.model').get('currentJobId');
       this.get('jobs').stopJob(jobId)
         .then( data => this.get('controller').set('isJobCancelled', true));
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query/results.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query/results.js
b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query/results.js
index df970fb..66c6112 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query/results.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/query/results.js
@@ -37,27 +37,23 @@ export default Ember.Route.extend(UILoggerMixin, {
     model.set('lastResultRoute', ".results");
 
     if(!Ember.isEmpty(model.get('currentJobData'))){
-
       let jobId = model.get('currentJobData').job.id;
+      this.controller.set('model', model);
       this.controller.set('jobId', jobId);
       this.controller.set('payloadTitle',  model.get('currentJobData').job.title);
       this.controller.set('isQueryRunning', model.get('isQueryRunning'));
       this.controller.set('previousPage', model.get('previousPage'));
       this.controller.set('hasNext', model.get('hasNext'));
       this.controller.set('hasPrevious', model.get('hasPrevious'));
-
       this.controller.set('queryResult', model.get('queryResult'));
       this.controller.set('isExportResultSuccessMessege', false);
       this.controller.set('isExportResultFailureMessege', false);
       this.controller.set('showSaveHdfsModal', false);
       this.controller.set('showDownloadCsvModal', false);
-
-
       this.controller.set('hasJobAssociated', true);
     } else {
       this.controller.set('hasJobAssociated', false);
     }
-
   },
 
   actions:{

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/templates/components/query-result-table.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/query-result-table.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/query-result-table.hbs
index 395987f..c75ef48 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/query-result-table.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/query-result-table.hbs
@@ -16,54 +16,58 @@
 * limitations under the License.
 }}
 
-  <div class="clearfix">
-    <div class="col-md-2">
-      <div class="row input-group">
-        {{input type="text" value=columnFilterText placeholder="Filter columns" class="form-control"}}
-        <span class="input-group-btn">
-          <button class="btn btn-default" {{action "clearColumnsFilter"}}>{{fa-icon
"times"}} </button>
-        </span>
-      </div>
-    </div>
-    <div class="pull-right">
-      <span class="dropdown">
-      <button class="btn btn-default dropdown-toggle" title="Actions" data-toggle="dropdown">{{fa-icon
"bars"}} </button>
-      <ul class="dropdown-menu dropdown-menu-right">
-        <li><a href="#" {{action "openSaveHdfsModal" }} class="text-uppercase">{{fa-icon
"save"}} Save To HDFS</a></li>
-        <li><a href="#" {{action "openDownloadCsvModal" }} class="text-uppercase">{{fa-icon
"download"}} Download As CSV</a></li>
-      </ul>
-    </span>&nbsp;
+{{#unless isQueryRunning}}
+    {{#if currentJobData}}
+      <div class="clearfix">
+        <div class="col-md-2">
+          <div class="row input-group">
+            {{input type="text" value=columnFilterText placeholder="Filter columns" class="form-control"}}
+            <span class="input-group-btn">
+              <button class="btn btn-default" {{action "clearColumnsFilter"}}>{{fa-icon
"times"}} </button>
+            </span>
+          </div>
+        </div>
+        <div class="pull-right">
+          <span class="dropdown">
+          <button class="btn btn-default dropdown-toggle" title="Actions" data-toggle="dropdown">{{fa-icon
"bars"}} </button>
+          <ul class="dropdown-menu dropdown-menu-right">
+            <li><a href="#" {{action "openSaveHdfsModal" }} class="text-uppercase">{{fa-icon
"save"}} Save To HDFS</a></li>
+            <li><a href="#" {{action "openDownloadCsvModal" }} class="text-uppercase">{{fa-icon
"download"}} Download As CSV</a></li>
+          </ul>
+        </span>&nbsp;
 
-      <button class="btn btn-default" title="Previous Page" {{action "goPrevPage" payloadTitle
}} disabled={{not hasPrevious}} >{{fa-icon "arrow-left"}} </button>
-      <button class="btn btn-default" title="Next Page" {{action "goNextPage" payloadTitle}}
disabled={{not hasNext}} >{{fa-icon "arrow-right"}} </button> &nbsp;
-      <button class="btn btn-default" title="Expand/Collspse" {{action "expandQueryResultPanel"
}}>{{fa-icon "expand"}}</button>
-    </div>
-  </div>
+          <button class="btn btn-default" title="Previous Page" {{action "goPrevPage"
payloadTitle }} disabled={{not hasPrevious}} >{{fa-icon "arrow-left"}} </button>
+          <button class="btn btn-default" title="Next Page" {{action "goNextPage" payloadTitle}}
disabled={{not hasNext}} >{{fa-icon "arrow-right"}} </button> &nbsp;
+          <button class="btn btn-default" title="Expand/Collspse" {{action "expandQueryResultPanel"
}}>{{fa-icon "expand"}}</button>
+        </div>
+      </div>
 
-  <div class="col-md-12">
-    <div class="row">
-      <div class="query-result">
-        <table class="table table-striped">
-          <thead>
-            <tr>
-              {{#each filteredColumns as |column|}}
-                <th>{{column.label}}</th>
-              {{/each}}
-            </tr>
-          </thead>
-          <tbody>
-          {{#each rows as |row|}}
-            <tr>
-              {{#each filteredColumns as |column|}}
-                <td>{{extract-value row column.valuePath}}</td>
+      <div class="col-md-12">
+        <div class="row">
+          <div class="query-result">
+            <table class="table table-striped">
+              <thead>
+                <tr>
+                  {{#each filteredColumns as |column|}}
+                    <th>{{column.label}}</th>
+                  {{/each}}
+                </tr>
+              </thead>
+              <tbody>
+              {{#each rows as |row|}}
+                <tr>
+                  {{#each filteredColumns as |column|}}
+                    <td>{{extract-value row column.valuePath}}</td>
+                  {{/each}}
+                </tr>
               {{/each}}
-            </tr>
-          {{/each}}
-          </tbody>
-        </table>
+              </tbody>
+            </table>
+          </div>
+        </div>
       </div>
-    </div>
-  </div>
+    {{/if}}
+{{/unless}}
 
 {{#if showSaveHdfsModal}}
   {{export-result

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
index 7b27ba7..16fb466 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query.hbs
@@ -56,11 +56,11 @@
 
       </div>
     </div>
-
-    {{#tabs-pane tabs=tabs inverse=true as |tab|}}
-      {{tabs-item tab=tab tabs=tabs}}
-    {{/tabs-pane}}
-
+    {{#if worksheet.currentJobId}}
+        {{#tabs-pane tabs=tabs inverse=true as |tab|}}
+          {{tabs-item tab=tab tabs=tabs}}
+        {{/tabs-pane}}
+    {{/if}}
     {{outlet}}
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/log.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/log.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/log.hbs
index e9f1a50..6dc7633 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/log.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/log.hbs
@@ -23,7 +23,13 @@
 {{/unless}}
 
 {{#if hasJobAssociated}}
-  <div>
-    <pre class="prettyprint">{{logResults}}</pre>
-  </div>
+  {{#if logResults}}
+    <div>
+      <pre class="prettyprint">{{logResults}}</pre>
+    </div>
+  {{else}}
+    <div class="explain--error">
+      <div>No Log available.</div>
+    </div>
+  {{/if}}
 {{/if}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5105226/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/results.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/results.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/results.hbs
index 966312c..db0a79c 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/results.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/queries/query/results.hbs
@@ -16,8 +16,6 @@
 * limitations under the License.
 }}
 
-{{outlet}}
-
 {{#unless hasJobAssociated}}
   <div class="explain--error">
     <div>No Results available.</div>
@@ -27,7 +25,9 @@
 {{#if hasJobAssociated}}
   {{query-result-table
   queryResult=queryResult
-  isQueryRunning=isQueryRunning
+  isQueryRunning=model.isQueryRunning
+  currentJobData=model.currentJobData
+  isJobCreated=model.isJobCreated
   jobId=jobId
   payloadTitle=payloadTitle
   previousPage=previousPage
@@ -45,6 +45,9 @@
   showDownloadCsvModal=showDownloadCsvModal
   }}
 {{/if}}
+{{outlet}}
+
+
 
 
 


Mime
View raw message