ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsai...@apache.org
Subject ambari git commit: AMBARI-22091.Hive view2.0 Jobs worksheets doesn't have hyperlink whereas view1.5 History worksheets had hyperlinks pointing to fetched results(Venkata Sairam)
Date Sat, 30 Sep 2017 03:37:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 27efa3f1a -> 9e34f4000


AMBARI-22091.Hive view2.0 Jobs worksheets doesn't have hyperlink whereas view1.5 History worksheets
had hyperlinks pointing to fetched results(Venkata Sairam)


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

Branch: refs/heads/branch-2.6
Commit: 9e34f40009cd60fd8ca3ffdcc992bda4352170ae
Parents: 27efa3f
Author: Venkata Sairam <venkatasairam.lanka@gmail.com>
Authored: Sat Sep 30 09:05:33 2017 +0530
Committer: Venkata Sairam <venkatasairam.lanka@gmail.com>
Committed: Sat Sep 30 09:06:57 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/job-item.js     |  49 +++++-
 .../resources/ui/app/components/jobs-browser.js |   3 +
 .../src/main/resources/ui/app/routes/jobs.js    |  11 ++
 .../main/resources/ui/app/routes/queries/new.js |   2 +
 .../resources/ui/app/routes/queries/query.js    | 164 ++++++++++++-------
 .../src/main/resources/ui/app/styles/app.scss   |   8 +
 .../ui/app/templates/components/job-item.hbs    |   2 +-
 .../app/templates/components/jobs-browser.hbs   |   2 +-
 .../main/resources/ui/app/templates/jobs.hbs    |   1 +
 9 files changed, 177 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js b/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js
index 42a3411..0545624 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js
@@ -17,12 +17,17 @@
  */
 
 import Ember from 'ember';
+import UILoggerMixin from '../mixins/ui-logger';
 
-export default Ember.Component.extend({
+export default Ember.Component.extend(UILoggerMixin, {
   jobs: Ember.inject.service(),
   tagName: '',
   expanded: false,
   expandedValue: null,
+  store: Ember.inject.service(),
+  savedQueries: Ember.inject.service(),
+
+
   actions: {
     toggleExpandJob(jobId) {
       if(this.get('expanded')) {
@@ -39,6 +44,48 @@ export default Ember.Component.extend({
         });
       }
 
+    },
+    openAsWorksheet(savedQuery){
+
+      let hasWorksheetModel = this.get('model'), self = this;
+      let worksheetId;
+
+      if (Ember.isEmpty(hasWorksheetModel)){
+        worksheetId = 1;
+      }else {
+
+        let isWorksheetExist = (this.get('model').filterBy('title', savedQuery.title).get('length')
> 0);
+        if(isWorksheetExist) {
+          this.sendAction('openWorksheet', savedQuery, true);
+          return;
+        }
+
+        let worksheets = this.get('model');
+        worksheets.forEach((worksheet) => {
+          worksheet.set('selected', false);
+      });
+        worksheetId = `worksheet${worksheets.get('length') + 1}`;
+      }
+      var isTabExisting = this.get("store").peekRecord('worksheet', savedQuery.id);
+      if(isTabExisting) {
+        self.sendAction('openWorksheet', savedQuery, true);
+        return;
+      }
+      this.get("savedQueries").fetchSavedQuery(savedQuery.get('queryFile')).then(function(response)
{
+        let localWs = {
+          id: savedQuery.get('id'),
+          title: savedQuery.get('title'),
+          queryFile: savedQuery.get('queryFile'),
+          query: response.file.fileContent,
+          selectedDb : savedQuery.get('dataBase'),
+          owner: savedQuery.get('owner'),
+          selected: true
+        };
+        self.sendAction('openWorksheet', localWs);
+      }, (error) => {
+        self.get('logger').danger('Failed to load the query', self.extractError(error));
+    });
+
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/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 7e24843..ae081de 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
@@ -93,6 +93,9 @@ export default Ember.Component.extend({
 
     clearTitleFilter() {
       this.set('titleFilter');
+    },
+    openWorksheet(worksheet, isExisitingWorksheet){
+      this.sendAction("openWorksheet", worksheet, isExisitingWorksheet);
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
index 3e88ac6..1b6351f 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/jobs.js
@@ -20,6 +20,7 @@ import Ember from 'ember';
 
 export default Ember.Route.extend({
   moment: Ember.inject.service(),
+  query: Ember.inject.service(),
   timeInitializedTo: null,
   queryParams: {
     startTime: {
@@ -63,6 +64,16 @@ export default Ember.Route.extend({
       this.controller.set('startTime', this.get('moment').moment(startTime, 'YYYY-MM-DD').startOf('day').valueOf());
       this.controller.set('endTime', this.get('moment').moment(endTime, 'YYYY-MM-DD').endOf('day').valueOf());
       this.refresh();
+    },
+    openWorksheet(worksheet, isExisitingWorksheet) {
+      if(isExisitingWorksheet) {
+       this.transitionTo('queries.query', worksheet.id);
+       return;
+      }
+      this.get("store").createRecord('worksheet', worksheet );
+      this.controllerFor('queries').set('worksheets', this.store.peekAll('worksheet'));
+      this.transitionTo('queries.query', worksheet.id);
+      this.controllerFor("queries.query").set('previewJobData', {id:worksheet.id, title:worksheet.title.toLowerCase()});
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
index 76a7439..1c4a7ba 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
@@ -43,5 +43,7 @@ export default Ember.Route.extend({
     existingWorksheets.setEach('selected', false);
     this.controllerFor('queries').set('worksheets', this.store.peekAll('worksheet'));
     this.transitionTo('queries.query', newWorksheetTitle);
+    this.controllerFor("queries.query").set('previewJobData', null);
+
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/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 f6256898..c9af257 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
@@ -53,8 +53,10 @@ export default Ember.Route.extend(UILoggerMixin, {
     console.log('lastResultRoute:: ', model.get('lastResultRoute'));
     let lastResultRoute = model.get('lastResultRoute');
 
+
+
     if(Ember.isEmpty(lastResultRoute)){
-      if(model.get('jobData').length > 0){
+      if(model.get('jobData') && model.get('jobData').length > 0){
         this.transitionTo('queries.query.results');
       } else {
         this.transitionTo('queries.query');
@@ -145,6 +147,22 @@ export default Ember.Route.extend(UILoggerMixin, {
     controller.set('worksheetModalSuccess',false);
     controller.set('worksheetModalFail',false);
     controller.set('tabs', tabs);
+    let previewJobData = this.get('controller').get('previewJobData'), ctrlr = this.get('controller'),
ctrlrModel = this.get('controller.model');
+
+
+    if(previewJobData) {
+
+      ctrlrModel.set('isJobSuccess', true);
+      ctrlrModel.set('isJobCancelled', false);
+      ctrlrModel.set('isJobCreated', false);
+      ctrlr.set('isJobSuccess', true);
+      ctrlr.set('isJobCancelled', false);
+      ctrlr.set('isJobCreated', false);
+      ctrlrModel.set('currentJobId', previewJobData.id);
+      this.get('controller.model').set('currentJobData', {job: previewJobData});
+
+      this.getJobResult({job: previewJobData}, previewJobData.title, Ember.Object.create({name:
'query'}), ctrlrModel, true);
+    }
   },
   checkIfDeafultDatabaseExists(alldatabases){
     if(this.get('controller.model').get('selectedDb')) {
@@ -172,6 +190,75 @@ export default Ember.Route.extend(UILoggerMixin, {
       this.send('closeWorksheet', tabDataToClose.index, tabDataToClose.id);
     }
   },
+
+  getJobResult(data, payloadTitle, jobDetails, ctrlrModel, isDataPreview){
+    let self = this;
+
+    let isVisualExplainQuery = this.get('controller').get('isVisualExplainQuery');
+
+    let jobId = data.job.id;
+
+    let currentPage = this.get('controller.model').get('currentPage');
+    let previousPage = this.get('controller.model').get('previousPage');
+    let nextPage = this.get('controller.model').get('nextPage');
+
+    this.get('query').getJob(jobId, true).then(function(data) {
+
+      let existingWorksheets = self.get('store').peekAll('worksheet');
+      let myWs = null;
+      if(existingWorksheets.get('length') > 0) {
+        if(isDataPreview) {
+          myWs = existingWorksheets.filterBy('id', jobId).get('firstObject');
+        } else {
+          myWs = existingWorksheets.filterBy('id', payloadTitle).get('firstObject');
+        }
+      }
+      if(!Ember.isBlank(jobDetails.get("dagId"))) {
+        let tezData = self.get("tezViewInfo").getTezViewData();
+        if(tezData && tezData.error) {
+          self.get('controller.model').set('tezError', tezData.errorMsg);
+        } else if(tezData.tezUrl) {
+          self.get('controller.model').set('tezUrl', tezData.tezUrl + jobDetails.get("dagId"));
+        }
+      }
+      myWs.set('queryResult', data);
+      myWs.set('isQueryRunning', false);
+      myWs.set('hasNext', data.hasNext);
+      self.get('controller.model').set('queryResult', data);
+
+
+      let localArr = myWs.get("jobData");
+      localArr.push(data);
+      myWs.set('jobData', localArr);
+      myWs.set('currentPage', currentPage+1);
+      myWs.set('previousPage', previousPage + 1 );
+      myWs.set('nextPage', nextPage + 1);
+
+      if(isVisualExplainQuery){
+        self.send('showVisualExplain', payloadTitle);
+      } else {
+        self.get('controller.model').set('visualExplainJson', null);
+
+        if( self.paramsFor('queries.query').worksheetId && (self.paramsFor('queries.query').worksheetId.toLowerCase()
=== payloadTitle) || (isDataPreview && self.paramsFor('queries.query').worksheetId
&& (self.paramsFor('queries.query').worksheetId.toLowerCase() === jobId))){
+          self.transitionTo('queries.query.loading');
+
+          Ember.run.later(() => {
+            self.transitionTo('queries.query.results');
+          }, 1 * 100);
+        }
+      }
+
+    }, function(error) {
+      console.log('error' , error);
+      if(!isDataPreview){
+        self.get('logger').danger('Failed to execute query.', self.extractError(error));
+      } else {
+        self.get('logger').danger('Query expired. Please execute the query again.', self.extractError(error));
+      }
+      self.send('resetDefaultWorksheet', ctrlrModel);
+    });
+  },
+
   actions: {
 
     resetDefaultWorksheet(currModel){
@@ -332,7 +419,7 @@ export default Ember.Route.extend(UILoggerMixin, {
             ctrlr.set('isJobCreated', false);
             let jobDetails = self.store.peekRecord('job', data.job.id);
             console.log(jobDetails);
-            self.send('getJobResult', data, payload.id, jobDetails, ctrlrModel);
+            self.getJobResult(data, payload.id, jobDetails, ctrlrModel);
             self.get('logger').success('Query has been submitted.');
 
           }, (error) => {
@@ -360,64 +447,6 @@ export default Ember.Route.extend(UILoggerMixin, {
         .then( data => this.get('controller').set('isJobCancelled', true));
     },
 
-    getJobResult(data, payloadTitle, jobDetails, ctrlrModel){
-      let self = this;
-
-      let isVisualExplainQuery = this.get('controller').get('isVisualExplainQuery');
-
-      let jobId = data.job.id;
-
-      let currentPage = this.get('controller.model').get('currentPage');
-      let previousPage = this.get('controller.model').get('previousPage');
-      let nextPage = this.get('controller.model').get('nextPage');
-
-      this.get('query').getJob(jobId, true).then(function(data) {
-
-        let existingWorksheets = self.get('store').peekAll('worksheet');
-        let myWs = null;
-        if(existingWorksheets.get('length') > 0) {
-          myWs = existingWorksheets.filterBy('id', payloadTitle).get('firstObject');
-        }
-        if(!Ember.isBlank(jobDetails.get("dagId"))) {
-          let tezData = self.get("tezViewInfo").getTezViewData();
-          if(tezData && tezData.error) {
-            self.get('controller.model').set('tezError', tezData.errorMsg);
-          } else if(tezData.tezUrl) {
-            self.get('controller.model').set('tezUrl', tezData.tezUrl + jobDetails.get("dagId"));
-          }
-        }
-        myWs.set('queryResult', data);
-        myWs.set('isQueryRunning', false);
-        myWs.set('hasNext', data.hasNext);
-
-        let localArr = myWs.get("jobData");
-        localArr.push(data);
-        myWs.set('jobData', localArr);
-        myWs.set('currentPage', currentPage+1);
-        myWs.set('previousPage', previousPage + 1 );
-        myWs.set('nextPage', nextPage + 1);
-
-        if(isVisualExplainQuery){
-          self.send('showVisualExplain', payloadTitle);
-        } else {
-          self.get('controller.model').set('visualExplainJson', null);
-
-          if( self.paramsFor('queries.query').worksheetId && (self.paramsFor('queries.query').worksheetId.toLowerCase()
=== payloadTitle)){
-            self.transitionTo('queries.query.loading');
-
-            Ember.run.later(() => {
-              self.transitionTo('queries.query.results');
-            }, 1 * 100);
-          }
-        }
-
-      }, function(error) {
-        console.log('error' , error);
-        self.get('logger').danger('Failed to execute query.', self.extractError(error));
-        self.send('resetDefaultWorksheet', ctrlrModel);
-      });
-    },
-
     showVisualExplain(payloadTitle){
        if( this.paramsFor('queries.query').worksheetId && this.paramsFor('queries.query').worksheetId.toLowerCase()
=== payloadTitle){
          this.transitionTo('queries.query.loading');
@@ -468,7 +497,12 @@ export default Ember.Route.extend(UILoggerMixin, {
       let existingWorksheets = this.get('store').peekAll('worksheet');
       let myWs = null;
       if(existingWorksheets.get('length') > 0) {
-        myWs = existingWorksheets.filterBy('id', payloadTitle.toLowerCase()).get('firstObject');
+        var previewJobData = this.get('controller').get('previewJobData');
+        if(previewJobData) {
+          myWs = existingWorksheets.filterBy('id', previewJobData.id).get('firstObject');
+        } else {
+          myWs = existingWorksheets.filterBy('id', payloadTitle.toLowerCase()).get('firstObject');
+        }
       }
 
       this.transitionTo('queries.query.loading');
@@ -497,7 +531,13 @@ export default Ember.Route.extend(UILoggerMixin, {
       let existingWorksheets = this.get('store').peekAll('worksheet');
       let myWs = null;
       if(existingWorksheets.get('length') > 0) {
-        myWs = existingWorksheets.filterBy('id', payloadTitle.toLowerCase()).get('firstObject');
+        var previewJobData = this.get('controller').get('previewJobData');
+        if(previewJobData) {
+          myWs = existingWorksheets.filterBy('id', previewJobData.id).get('firstObject');
+        } else {
+          myWs = existingWorksheets.filterBy('id', payloadTitle.toLowerCase()).get('firstObject');
+        }
+
       }
 
       this.transitionTo('queries.query.loading');

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/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 522b2d3..d7f14b0 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
@@ -1014,3 +1014,11 @@ rect.operator__box {
 .sort-icon {
   padding-left: 5px;
 }
+
+.jobs-table .table-striped td{
+  border: none;
+}
+
+.workflow-name {
+  cursor: pointer;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/contrib/views/hive20/src/main/resources/ui/app/templates/components/job-item.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/job-item.hbs
b/contrib/views/hive20/src/main/resources/ui/app/templates/components/job-item.hbs
index 16caad0..6ebdae0 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/job-item.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/job-item.hbs
@@ -18,7 +18,7 @@
 
 <tr>
   <td>{{job.id}}</td>
-  <td class="break-word">{{job.title}}</td>
+  <td class="break-word workflow-name"><a {{action "openAsWorksheet" job}}>{{job.title}}</a></td>
   <td>{{job.status}}</td>
   <td>{{moment-from-now job.dateSubmitted}}</td>
   <td>{{job.duration}}</td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/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 d29ca73..7ba3f22 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
@@ -94,7 +94,7 @@
       </thead>
       <tbody>
         {{#each filteredJobsSorted as |job| }}
-          {{job-item job=job}}
+          {{job-item model=jobs job=job openWorksheet="openWorksheet"}}
         {{/each}}
       </tbody>
     </table>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9e34f400/contrib/views/hive20/src/main/resources/ui/app/templates/jobs.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/jobs.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/jobs.hbs
index 4382b7a..ba8fccc 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/jobs.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/jobs.hbs
@@ -20,4 +20,5 @@
                startTime=startTimeText
                endTime=endTimeText
                filterChanged="dateFilterChanged"
+               openWorksheet="openWorksheet"
 }}


Mime
View raw message