ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-16260. Hive View: Prevent multiple /database calls when the first call takes time or fails. (dipayanb)
Date Thu, 05 May 2016 14:23:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 5c782dd84 -> e04bca9ba


AMBARI-16260. Hive View: Prevent multiple /database calls when the first call takes time or
fails. (dipayanb)


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

Branch: refs/heads/trunk
Commit: e04bca9ba04b86c93670b9333dbccd81f5eeb8a9
Parents: 5c782dd
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Thu May 5 19:52:40 2016 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Thu May 5 19:52:40 2016 +0530

----------------------------------------------------------------------
 .../ui/hive-web/app/controllers/databases.js    | 25 +++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e04bca9b/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 a841e3b..b76bca3 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
@@ -32,6 +32,8 @@ export default Ember.Controller.extend({
 
   tableSearchResults: Ember.Object.create(),
 
+  isDatabaseRefreshInProgress: false,
+
   tableControls: [
     {
       icon: 'fa-list',
@@ -157,6 +159,8 @@ export default Ember.Controller.extend({
     var self = this;
     var selectedDatabase = this.get('selectedDatabase.name') || 'default';
 
+    this.set('isDatabaseRefreshInProgress', true);
+
     this.set('isLoading', true);
 
     this.get('databaseService').getDatabases().then(function (databases) {
@@ -168,12 +172,13 @@ export default Ember.Controller.extend({
       if(error.status == 401) {
          self.send('passwordLDAPDB');
       }
-
-
+    }).finally(function() {
+      self.set('isDatabaseRefreshInProgress', false);
     });
   }.on('init'),
 
   syncDatabases: function() {
+    this.set('isDatabaseRefreshInProgress', true);
     var oldDatabaseNames = this.store.all('database').mapBy('name');
     var self = this;
     return this.get('databaseService').getDatabasesFromServer().then(function(data) {
@@ -194,6 +199,8 @@ export default Ember.Controller.extend({
           });
         }
       });
+    }).finally(function() {
+      self.set('isDatabaseRefreshInProgress', false);
     });
   },
 
@@ -201,8 +208,10 @@ export default Ember.Controller.extend({
     // This was required so that the unit test would not stall
     if(ENV.environment !== "test") {
       Ember.run.later(this, function() {
-        this.syncDatabases();
-        this.initiateDatabaseSync();
+        if (this.get('isDatabaseRefreshInProgress') === false) {
+          this.syncDatabases();
+          this.initiateDatabaseSync();
+        }
       }, 15000);
     }
   }.on('init'),
@@ -222,8 +231,12 @@ export default Ember.Controller.extend({
 
   actions: {
     refreshDatabaseExplorer: function () {
-      this.getDatabases();
-      this.resetSearch();
+      if (this.get('isDatabaseRefreshInProgress') === false) {
+        this.getDatabases();
+        this.resetSearch();
+      } else {
+        console.log("Databases refresh is in progress. Skipping this request.");
+      }
     },
 
     passwordLDAPDB: function(){


Mime
View raw message