ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-20009. HiveView2.0: Table list under DB panel on Query tab appears only if clicked on db name and Not clear how to set the database (Venkata Sairam via pallavkul)
Date Wed, 22 Feb 2017 13:42:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 569f5661d -> 7cc2a2052


AMBARI-20009. HiveView2.0: Table list under DB panel on Query tab appears only if clicked
on db name and Not clear how to set the database (Venkata Sairam via pallavkul)


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

Branch: refs/heads/trunk
Commit: 7cc2a20525881b329abe50d98ce871b6c9753742
Parents: 569f566
Author: pallavkul <pallav.kul@gmail.com>
Authored: Wed Feb 22 19:11:22 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Wed Feb 22 19:11:22 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/routes/queries/new.js |  1 -
 .../resources/ui/app/routes/queries/query.js    | 43 +++++++++++++-------
 2 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7cc2a205/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 5a869c2..7bd2214 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
@@ -27,7 +27,6 @@ export default Ember.Route.extend({
       id: newWorksheetName,
       title: newWorksheetTitle,
       //query: 'select 1;',
-      selectedDb : 'default',
       //owner: 'admin',
       selected: true
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7cc2a205/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 7860af1..64f38ab 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
@@ -75,6 +75,7 @@ export default Ember.Route.extend(UILoggerMixin, {
     } else {
       this.transitionTo('queries.query' + lastResultRoute);
     }
+    return dbmodel;
   },
 
   model(params) {
@@ -93,24 +94,22 @@ export default Ember.Route.extend(UILoggerMixin, {
     this._super(...arguments);
     this.get("tezViewInfo").getTezViewInfo();
 
-    let self = this;
-    let alldatabases = this.store.findAll('database');
+    let self = this, selectedDb;
+    let alldatabases = this.store.peekAll('database');
     controller.set('alldatabases',alldatabases);
 
-    let selecteDBName = model.get('selectedDb');
+    selectedDb = this.checkIfDeafultDatabaseExists(alldatabases);
 
     let selectedTablesModels =[];
     let selectedMultiDb = [];
-
-    selectedTablesModels.pushObject(
-      {
-        'dbname': selecteDBName ,
-        'tables': this.store.query('table', {databaseId: selecteDBName}),
+    if(selectedDb) {
+      selectedTablesModels.pushObject({
+        'dbname': selectedDb ,
+        'tables': this.store.query('table', {databaseId: selectedDb}),
         'isSelected': true
-      }
-    )
-
-    selectedMultiDb.pushObject(selecteDBName);
+      })
+      selectedMultiDb.pushObject(selectedDb);
+    }
 
     controller.set('worksheet', model);
 
@@ -139,7 +138,23 @@ export default Ember.Route.extend(UILoggerMixin, {
     controller.set('tabs', tabs);
 
   },
-
+  checkIfDeafultDatabaseExists(alldatabases){
+    let defaultDB = alldatabases.findBy('name', 'default'), selectedDb;
+    if(defaultDB) {
+      selectedDb = defaultDB.get("name");
+      this.get('controller.model').set('selectedDb', selectedDb);
+    }
+    return selectedDb;
+  },
+  setSelectedDB(selectedDBs) {
+    let selectedDb = this.get('controller.model').get('selectedDb');
+    if(selectedDBs && selectedDBs.indexOf(selectedDb) === -1) {
+      this.get('controller.model').set('selectedDb', selectedDBs[0]);
+    }
+    else if(selectedDBs.length === 0) {
+      this.get('controller.model').set('selectedDb', null);
+    }
+  },
   actions: {
 
     resetDefaultWorksheet(){
@@ -161,7 +176,7 @@ export default Ember.Route.extend(UILoggerMixin, {
       let self = this;
       let selectedTablesModels =[];
       let selectedMultiDb = [];
-
+      this.setSelectedDB(selectedDBs);
       selectedDBs.forEach(function(db, index){
         selectedTablesModels.pushObject(
           {


Mime
View raw message