You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/02/25 08:20:13 UTC

ambari git commit: AMBARI-15012. Set default database as selected db when hive view loads. (Gaurav Nagar via dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/trunk 198f31588 -> 4c8d75df6


AMBARI-15012. Set default database as selected db when hive view loads. (Gaurav Nagar via dipayanb)


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

Branch: refs/heads/trunk
Commit: 4c8d75df6fdb876b538f047f8fc8ab5dfaf1f689
Parents: 198f315
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Thu Feb 25 12:49:49 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Thu Feb 25 12:49:49 2016 +0530

----------------------------------------------------------------------
 .../resources/ui/hive-web/app/controllers/databases.js   | 11 ++++++++---
 .../main/resources/ui/hive-web/app/services/notify.js    |  4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c8d75df/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js
index f0378cd..2a69349 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/databases.js
@@ -26,6 +26,7 @@ export default Ember.Controller.extend({
 
   pageCount: 10,
 
+  previousSelectedDatabaseName : "" ,
   selectedDatabase: Ember.computed.alias('databaseService.selectedDatabase'),
   databases: Ember.computed.alias('databaseService.databases'),
 
@@ -99,8 +100,12 @@ export default Ember.Controller.extend({
 
     this.get('databaseService').getAllTables().then(function () {
       self.set('isLoading', false);
-    }, function (err) {
-      self._handleError(err);
+      self.set('previousSelectedDatabaseName',self.get('selectedDatabase').get('name'));
+      self.get('notifyService').info("Selected database : "+self.get('selectedDatabase').get('name'));
+    }, function (error) {
+      self.get('notifyService').pushError("Error while selecting database : "+self.get('selectedDatabase').get('name'),error.responseJSON.message+"\n"+error.responseJSON.trace);
+      self.get('databaseService').setDatabaseByName(self.get('previousSelectedDatabaseName'));
+      self.set('isLoading', false);
     });
   }.observes('selectedDatabase'),
 
@@ -150,7 +155,7 @@ export default Ember.Controller.extend({
 
   getDatabases: function () {
     var self = this;
-    var selectedDatabase = this.get('selectedDatabase.name');
+    var selectedDatabase = this.get('selectedDatabase.name') || 'default';
 
     this.set('isLoading', true);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4c8d75df/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
index 6ca4d11..04c13ff 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/services/notify.js
@@ -47,6 +47,10 @@ export default Ember.Service.extend({
     this.add(this.types.WARN, message, body);
   },
 
+  pushError: function (message, body) {
+    this.add(this.types.ERROR, message, body);
+  },
+
   error: function (error) {
     var message,
         body;