You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/06/12 14:19:27 UTC

[1/2] ambari git commit: AMBARI-11812 Perf cluster: Prevent make a call for service metric when it's already called. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 ade1a4795 -> ed9360453


AMBARI-11812 Perf cluster: Prevent make a call for service metric when it's already called. (atkach)


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

Branch: refs/heads/branch-2.1
Commit: b1da8978226ee538297dff6b54b6c853b834daa4
Parents: ade1a47
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Tue Jun 9 16:58:58 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Fri Jun 12 15:18:26 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js | 26 +++++++++++++++-----
 ambari-web/app/routes/main.js                   |  2 +-
 2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1da8978/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index af7b69e..7246c37 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -41,6 +41,14 @@ App.UpdateController = Em.Controller.extend({
 
   paginationKeys: ['page_size', 'from'],
 
+  /**
+   * map which track status of requests, whether it's running or completed
+   * @type {object}
+   */
+  requestsRunningStatus: {
+    "updateServiceMetric": false
+  },
+
   getUrl: function (testUrl, url) {
     return (App.get('testMode')) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
   },
@@ -362,6 +370,7 @@ App.UpdateController = Em.Controller.extend({
     var isATSPresent = App.StackServiceComponent.find().findProperty('componentName','APP_TIMELINE_SERVER');
 
     var conditionalFields = this.getConditionalFields(),
+      requestsRunningStatus = this.get('requestsRunningStatus'),
       conditionalFieldsString = conditionalFields.length > 0 ? ',' + conditionalFields.join(',') : '',
       testUrl = '/data/dashboard/HDP2/master_components.json',
       isFlumeInstalled = App.cache['services'].mapProperty('ServiceInfo.service_name').contains('FLUME'),
@@ -405,12 +414,17 @@ App.UpdateController = Em.Controller.extend({
     callback = callback || function () {
       self.set('isUpdated', true);
     };
-    App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, {
-      complete: function () {
-        App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded'));
-        callback();
-      }
-    });
+
+    if (!requestsRunningStatus["updateServiceMetric"]) {
+      requestsRunningStatus["updateServiceMetric"] = true;
+      App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, {
+        complete: function () {
+          App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded'));
+          callback();
+          requestsRunningStatus["updateServiceMetric"] = false;
+        }
+      });
+    }
   },
   /**
    * construct conditional parameters of query, depending on which services are installed

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1da8978/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 53482b6..78d8243 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -636,7 +636,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         route: '/summary',
         connectOutlets: function (router, context) {
           var item = router.get('mainServiceItemController.content');
-          router.get('updateController').updateServiceMetric(Em.K);
+          if (router.get('clusterController.isLoaded')) router.get('updateController').updateServiceMetric(Em.K);
           //if service is not existed then route to default service
           if (item.get('isLoaded')) {
             router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary', item);


[2/2] ambari git commit: AMBARI-11875 Yarn config tab doesn't load with Oracle 12. (atkach)

Posted by at...@apache.org.
AMBARI-11875 Yarn config tab doesn't load with Oracle 12. (atkach)


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

Branch: refs/heads/branch-2.1
Commit: ed93604537fb6c0f6b6024586c60d46f762ad067
Parents: b1da897
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Fri Jun 12 15:03:45 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Fri Jun 12 15:18:48 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/configs/database.js       |  5 +++--
 ambari-web/app/utils/string_utils.js           | 10 ++++++++++
 ambari-web/test/utils/configs/database_test.js | 12 ++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ed936045/ambari-web/app/utils/configs/database.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/database.js b/ambari-web/app/utils/configs/database.js
index 2ee3f65..6dde0fa 100644
--- a/ambari-web/app/utils/configs/database.js
+++ b/ambari-web/app/utils/configs/database.js
@@ -17,6 +17,7 @@
  */
 
 var validators = require('utils/validator');
+var stringUtils = require('utils/string_utils');
 /**
  * Helper methods to process database values and properties
  * @module utils/configs/database
@@ -53,7 +54,7 @@ module.exports = {
     mssql: 'jdbc:sqlserver://{0};databaseName={1}',
     postgres: 'jdbc:postgresql://{0}:5432/{1}',
     derby: 'jdbc:derby:{0}/{1}',
-    oracle: 'jdbc:oracle:thin:@//{0}:1521/{1}'
+    oracle: 'jdbc:oracle:thin:@(?:\/?\/?){0}:1521(\:|\/){1}'
   },
 
   /**
@@ -180,7 +181,7 @@ module.exports = {
 
     result.location = this.getDBLocationFromJDBC(jdbcUrl);
     if (!jdbcUrl.endsWith('{1}')) {
-      dbName = jdbcUrl.replace(this.DB_JDBC_PATTERNS[result.dbType].format(result.location,''), '');
+      dbName = jdbcUrl.replace(new RegExp(this.DB_JDBC_PATTERNS[result.dbType].format(stringUtils.escapeRegExp(result.location),'')), '');
       if (dbName) {
         result.databaseName = dbName.split(/[;|?]/)[0];
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed936045/ambari-web/app/utils/string_utils.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/string_utils.js b/ambari-web/app/utils/string_utils.js
index d38fb29..48f8e52 100644
--- a/ambari-web/app/utils/string_utils.js
+++ b/ambari-web/app/utils/string_utils.js
@@ -214,5 +214,15 @@ module.exports = {
   htmlEntities: function (string) {
     if (typeof string !== 'string') return "";
     return $("<div/>").text(string).html();
+  },
+
+  /**
+   * Escaping user input to be treated as a literal string within a regular expression
+   * get from https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
+   * @param {string} str
+   * @returns {*}
+   */
+  escapeRegExp: function (str) {
+    return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
   }
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed936045/ambari-web/test/utils/configs/database_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/database_test.js b/ambari-web/test/utils/configs/database_test.js
index de95750..85ed35c 100644
--- a/ambari-web/test/utils/configs/database_test.js
+++ b/ambari-web/test/utils/configs/database_test.js
@@ -47,6 +47,10 @@ describe('Database Utils', function() {
         e: 'localhost.com'
       },
       {
+        jdbcUrl: 'jdbc:oracle:thin:@ec2-52-5-27-33.compute-1.amazonaws.com:1521:ORCL',
+        e: 'ec2-52-5-27-33.compute-1.amazonaws.com'
+      },
+      {
         jdbcUrl: 'jdbc:oracle:thin:@//{0}:1521/{1}',
         e: null
       }
@@ -116,6 +120,14 @@ describe('Database Utils', function() {
         }
       },
       {
+        jdbcUrl: 'jdbc:oracle:thin:@localhost.com:1521:someDb',
+        e: {
+          dbType: 'oracle',
+          location: 'localhost.com',
+          databaseName: 'someDb'
+        }
+      },
+      {
         jdbcUrl: 'jdbc:oracle:thin:@//{0}:1521/{1}',
         e: {
           dbType: 'oracle',