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 2018/04/19 12:15:21 UTC

[ambari] 02/02: AMBARI-23597 Config's tags should be cached

This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit e5fbff1ca1759303350cb099c0e08dbfc9ad2694
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Wed Apr 18 13:59:41 2018 +0300

    AMBARI-23597 Config's tags should be cached
---
 ambari-web/app/mixins/common/serverValidator.js |  2 +-
 ambari-web/app/utils/config.js                  | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index f7b65eb..c44a6be 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -226,7 +226,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
     var dfd = $.Deferred();
     // check if we have configs from 'cluster-env', if not, then load them, as they are mandatory for validation request
     if (!serviceConfigs.findProperty('serviceName', 'MISC')) {
-      App.router.get('configurationController').getCurrentConfigsBySites(['cluster-env']).done(function(configs) {
+      App.config.getConfigsByTypes([{site: 'cluster-env', serviceName: 'MISC'}]).done(function(configs) {
         dfd.resolve(blueprintUtils.buildConfigsJSON(serviceConfigs.concat(configs)));
       });
     } else {
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index cd2a224..b3ec9ad 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1316,6 +1316,18 @@ App.config = Em.Object.create({
   },
 
   /**
+   * Load cluster-env configs mapped to array
+   * @return {*|{then}}
+   */
+  getConfigsByTypes: function (sites) {
+    const dfd = $.Deferred();
+    App.router.get('configurationController').getCurrentConfigsBySites(sites.mapProperty('site')).done((configs) => {
+      dfd.resolve(this.getMappedConfigs(configs, sites));
+    });
+    return dfd.promise();
+  },
+
+  /**
    *
    * @param configs
    * @param sites

-- 
To stop receiving notification emails like this one, please contact
atkach@apache.org.