Forráskód Böngészése

AMBARI-3813. Can override config twice using config-groups.. (akovalenko)

Aleksandr Kovalenko 11 éve
szülő
commit
aad5c5aa8a

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

@@ -983,11 +983,22 @@ App.config = Em.Object.create({
    * @param callback  Callback function which is invoked when dialog
    *  is closed, cancelled or OK is pressed.
    */
-  launchConfigGroupSelectionCreationDialog : function(serviceId, configGroups, callback) {
+  launchConfigGroupSelectionCreationDialog : function(serviceId, configGroups, configProperty, callback) {
     var self = this;
     var availableConfigGroups = configGroups.slice();
     // delete Default Config Group
     availableConfigGroups.pop();
+    // delete Config Groups, that already have selected property overridden
+    if (configProperty.get('overrides')) {
+      var alreadyOverriddenGroups = configProperty.get('overrides').mapProperty('group.name');
+      var result = [];
+      availableConfigGroups.forEach(function (group) {
+        if (!alreadyOverriddenGroups.contains(group.name)) {
+          result.push(group);
+        }
+      }, this);
+      availableConfigGroups = result;
+    }
     var selectedConfigGroup = availableConfigGroups && availableConfigGroups.length > 0 ?
         availableConfigGroups[0] : null;
     App.ModalPopup.show({

+ 1 - 1
ambari-web/app/views/common/configs/services_config.js

@@ -503,7 +503,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
     if (selectedConfigGroup.get('isDefault')) {
       // Launch dialog to pick/create Config-group
       App.config.launchConfigGroupSelectionCreationDialog(this.get('service.serviceName'),
-          serviceConfigController.get('configGroups'), function (selectedGroupInPopup) {
+          serviceConfigController.get('configGroups'), serviceConfigProperty, function (selectedGroupInPopup) {
             console.log("launchConfigGroupSelectionCreationDialog(): Selected/Created:", selectedGroupInPopup);
             if (selectedGroupInPopup) {
               serviceConfigController.set('overrideToAdd', serviceConfigProperty);