Procházet zdrojové kódy

AMBARI-13858 Clear configsCollection when it needed. (ababiichuk)

aBabiichuk před 9 roky
rodič
revize
77e402ef71

+ 9 - 6
ambari-web/app/controllers/main/service/info/configs.js

@@ -199,7 +199,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     var properties = [];
     App.Tab.find(this.get('content.serviceName') + '_settings').get('sections').forEach(function(s) {
       s.get('subSections').forEach(function(ss) {
-        properties = properties.concat(ss.get('configProperties').filterProperty('id'));
+        properties = properties.concat(ss.get('configProperties'));
       });
     });
     return properties;
@@ -431,11 +431,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
    * @method mergeWithStackProperties
    */
   mergeWithStackProperties: function (configs) {
-    this.get('settingsTabProperties').forEach(function (advanced) {
-      if (!configs.someProperty('name', advanced.name)) {
-        advanced.savedValue = null;
-        advanced.isNotSaved = true;
-        configs.pushObject(App.ServiceConfigProperty.create(advanced));
+    this.get('settingsTabProperties').forEach(function (advanced_id) {
+      if (!configs.someProperty('id', advanced_id)) {
+        var advanced = App.configsCollection.getConfig(advanced_id);
+        if (advanced) {
+          advanced.savedValue = null;
+          advanced.isNotSaved = true;
+          configs.pushObject(App.ServiceConfigProperty.create(advanced));
+        }
       }
     });
     return configs;

+ 2 - 1
ambari-web/app/controllers/wizard/step7_controller.js

@@ -995,7 +995,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
         var type = _config.filename ? App.config.getConfigTagFromFileName(_config.filename) : null;
         var mappedConfigValue = type && configsMap[type] ? configsMap[type][_config.name] : null;
         if (Em.isNone(mappedConfigValue)) {
-          return _config.serviceName == 'MISC';
+          //for now ranger plugin properties are not sending by recommendations if they are missed - it should be added
+          return _config.serviceName == 'MISC' || /^ranger-/.test(_config.filename);
         } else {
           if (_config.savedValue != mappedConfigValue) {
             _config.savedValue = App.config.formatPropertyValue(_config, mappedConfigValue);

+ 2 - 0
ambari-web/app/routes/add_service_routes.js

@@ -130,6 +130,7 @@ module.exports = App.WizardRoute.extend({
       wizardStep5Controller.clearRecommendations(); // Force reload recommendation between steps 1 and 2
       addServiceController.setDBProperty('recommendations', undefined);
       addServiceController.set('stackConfigsLoaded', false);
+      App.configsCollection.clearAll();
       router.transitionTo('step2');
     }
   }),
@@ -195,6 +196,7 @@ module.exports = App.WizardRoute.extend({
           addServiceController.setDBProperty('groupsToDelete', []);
           addServiceController.setDBProperty('recommendationsConfigs', null);
           router.get('wizardStep7Controller').set('recommendationsConfigs', null);
+          router.get('wizardStep7Controller').clearDependentConfigs();
           router.transitionTo('step4');
         });
       });

+ 1 - 0
ambari-web/app/routes/installer.js

@@ -240,6 +240,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         masterComponentHosts: undefined
       });
       controller.set('stackConfigsLoaded', false);
+      App.configsCollection.clearAll();
       router.transitionTo('step5');
       console.timeEnd('step4 next');
     }

+ 1 - 0
ambari-web/app/utils/config.js

@@ -267,6 +267,7 @@ App.config = Em.Object.create({
   createDefaultConfig: function(name, serviceName, fileName, definedInStack, coreObject) {
     var tpl = {
       /** core properties **/
+      id: this.configId(name, fileName),
       name: name,
       filename: fileName,
       value: '',

+ 1 - 1
ambari-web/app/utils/configs_collection.js

@@ -33,7 +33,7 @@ var App = require('app');
 var configsCollection = [],
   /**
    * this should be object with key - config id and value - config object
-   * @type {Object{}}
+   * @type {Object}
    */
   configsCollectionMap = {};
 

+ 1 - 0
ambari-web/test/utils/config_test.js

@@ -778,6 +778,7 @@ describe('App.config', function () {
 
     var res = {
       /** core properties **/
+      id: "pName__pFileName",
       name: 'pName',
       filename: 'pFileName',
       value: '',