You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2013/12/04 18:46:38 UTC

git commit: AMBARI-3974. When a custom-config is added, and it has not been saved, should not allow override (alexantonenko)

Updated Branches:
  refs/heads/trunk 88d3a1a77 -> 6d5b66759


AMBARI-3974. When a custom-config is added, and it has not been saved, should not allow override (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 6d5b66759c7be4f42c79cc7a0e9b3c357fbd0471
Parents: 88d3a1a
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Dec 4 19:26:12 2013 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Dec 4 19:26:12 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js                            |  2 ++
 ambari-web/app/models/service_config.js               |  1 +
 .../app/views/common/configs/services_config.js       | 14 ++++++++++++++
 3 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6d5b6675/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 3f864c3..6dab8aa 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1115,6 +1115,8 @@ Em.I18n.translations = {
   'services.service.config.stopService.runningHostComponents':'{0} components on {1} hosts are still running',
   'services.service.config.stopService.unknownHostComponents':'{0} components on {1} hosts are in unknown state.  These components might actually be running and need restarting later to make the changes effective.',
   'services.service.config.confirmDirectoryChange':'You are about to make changes to service directories that are core to {0}. Before you proceed, be absolutely certain of the implications and that you have taken necessary manual steps, if any, for the changes. Are you sure you want to proceed?',
+  'services.service.config.configOverride.head':'Config Override',
+  'services.service.config.configOverride.body':'Cannot override a config that has not been saved yet.',
 
   'services.add.header':'Add Service Wizard',
   'services.reassign.header':'Move Master Wizard',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d5b6675/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 834a4dd..a0eb8f1 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -166,6 +166,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
   index: null, //sequence number in category
   editDone: false, //Text field: on focusOut: true, on focusIn: false
   serviceValidator: null,
+  isNotSaved: false, // user property was added but not saved
 
   /**
    * On Overridable property error message, change overrideErrorTrigger value to recount number of errors service have

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d5b6675/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 0778a00..942b79c 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -429,6 +429,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
       filename: '',
       isUserProperty: true,
       isKeyError: false,
+      isNotSaved: true,
       errorMessage: "",
       observeAddPropertyValue: function () {
         var name = this.get('name');
@@ -536,6 +537,19 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
     var selectedConfigGroup = serviceConfigController.get('selectedConfigGroup');
     var isInstaller = (this.get('controller.name') === 'wizardStep7Controller');
     var configGroups = (isInstaller) ? serviceConfigController.get('selectedService.configGroups') : serviceConfigController.get('configGroups');
+
+    //user property is added, and it has not been saved, not allow override
+    if(serviceConfigProperty.get('isUserProperty') && serviceConfigProperty.get('isNotSaved') && !isInstaller){
+      App.ModalPopup.show({
+        header: Em.I18n.t('services.service.config.configOverride.head'),
+        body: Em.I18n.t('services.service.config.configOverride.body'),
+        onPrimary: function () {
+          this.hide();
+        },
+        secondary: false
+      });
+      return;
+    }
     if (selectedConfigGroup.get('isDefault')) {
       // Launch dialog to pick/create Config-group
       App.config.launchConfigGroupSelectionCreationDialog(this.get('service.serviceName'),