ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-3776. Non-default config-group configs should have +Exception action. (akovalenko)
Date Fri, 15 Nov 2013 17:48:23 GMT
Updated Branches:
  refs/heads/trunk 68eef9663 -> 3b433e7ed


AMBARI-3776. Non-default config-group configs should have +Exception action. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 3b433e7ed13d22144efcf19d0f7a3f64915f23ad
Parents: 68eef96
Author: Aleksandr Kovalenko <oleksandr.kovalenko@ukr.net>
Authored: Fri Nov 15 19:45:01 2013 +0200
Committer: Aleksandr Kovalenko <oleksandr.kovalenko@ukr.net>
Committed: Fri Nov 15 19:45:01 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/models/service_config.js         | 11 ++--
 .../app/views/common/configs/services_config.js | 62 ++++++++++----------
 2 files changed, 38 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3b433e7e/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index a410b7c..a4094d8 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -176,12 +176,13 @@ App.ServiceConfigProperty = Ember.Object.extend({
    * No override capabilities for fields which are not edtiable
    * and fields which represent master hosts.
    */
-  isPropertyOverridable : function() {
+  isPropertyOverridable: function () {
     var overrideable = this.get('isOverridable');
-  	var editable = this.get('isEditable');
-  	var dt = this.get('displayType');
-  	return overrideable && editable && ("masterHost"!=dt);
-  }.property('isEditable', 'displayType', 'isOverridable'),
+    var editable = this.get('isEditable');
+    var overrides = this.get('overrides');
+    var dt = this.get('displayType');
+    return overrideable && (editable || !overrides || !overrides.length) &&
("masterHost" != dt);
+  }.property('isEditable', 'displayType', 'isOverridable', 'overrides.length'),
   isOverridden: function() {
     var overrides = this.get('overrides');
     return (overrides != null && overrides.get('length')>0) || !this.get('isOriginalSCP');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3b433e7e/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index aecff2d..0ffd5bf 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -487,37 +487,39 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
   },
 
   createOverrideProperty: function (event) {
-    var serviceConfigController = this.get('controller');
     var serviceConfigProperty = event.contexts[0];
-    // Launch dialog to pick/create Config-group
-    var serviceConfigGroups = serviceConfigController.get('configGroups');
-    App.config.launchConfigGroupSelectionCreationDialog(this.get('service.serviceName'),

-        serviceConfigGroups, function(selectedConfigGroup){
-      console.log("launchConfigGroupSelectionCreationDialog(): Selected/Created:", selectedConfigGroup);
-      if (selectedConfigGroup) {
-        serviceConfigController.set('selectedConfigGroup', selectedConfigGroup);
-        // TODO - show configurations for this new config-group
-//        var overrides = serviceConfigProperty.get('overrides');
-//        if (!overrides) {
-//          overrides = [];
-//          serviceConfigProperty.set('overrides', overrides);
-//        }
-//        // create new override with new value
-//        var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
-//        newSCP.set('value', '');
-//        newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
-//        newSCP.set('parentSCP', serviceConfigProperty);
-//        newSCP.set('selectedHostOptions', Ember.A([]));
-//        console.debug("createOverrideProperty(): Added:", newSCP, " to main-property:",
serviceConfigProperty);
-//        overrides.pushObject(newSCP);
-//
-//        // Launch override window
-//        var dummyEvent = {contexts: [newSCP]};
-//        this.showOverrideWindow(dummyEvent);
-      } else {
-        // Cancelled dialog
-      }
-    });
+    var self = this;
+    var serviceConfigController = this.get('controller');
+    var selectedConfigGroup = serviceConfigController.get('selectedConfigGroup');
+    if (selectedConfigGroup.get('isDefault')) {
+      // Launch dialog to pick/create Config-group
+      App.config.launchConfigGroupSelectionCreationDialog(this.get('service.serviceName'),
+          serviceConfigController.get('configGroups'), function (selectedGroupInPopup) {
+            console.log("launchConfigGroupSelectionCreationDialog(): Selected/Created:",
selectedGroupInPopup);
+            if (selectedGroupInPopup) {
+              serviceConfigController.set('selectedConfigGroup', selectedGroupInPopup);
+              self.addOverrideProperty(serviceConfigProperty);
+            }
+          });
+    } else {
+      this.addOverrideProperty(serviceConfigProperty);
+    }
+  },
+
+  addOverrideProperty: function(serviceConfigProperty) {
+    var overrides = serviceConfigProperty.get('overrides');
+    if (!overrides) {
+      overrides = [];
+      serviceConfigProperty.set('overrides', overrides);
+    }
+    // create new override with new value
+    var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
+    newSCP.set('value', '');
+    newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
+    newSCP.set('parentSCP', serviceConfigProperty);
+    newSCP.set('isEditable', true);
+    console.debug("createOverrideProperty(): Added:", newSCP, " to main-property:", serviceConfigProperty);
+    overrides.pushObject(newSCP);
   },
 
   showOverrideWindow: function (event) {


Mime
View raw message