Browse Source

AMBARI-3833. Duplicate and Rename config-group action UI tweaks. (Denys Buzhor via srimanth)

Srimanth Gunturi 11 years ago
parent
commit
a1ae35eb55

+ 16 - 5
ambari-web/app/controllers/main/service/manage_config_groups_controller.js

@@ -222,16 +222,15 @@ App.ManageConfigGroupsController = Em.Controller.extend({
       secondary: Em.I18n.t('common.cancel'),
       header: Em.I18n.t('services.service.config_groups.rename_config_group_popup.header'),
       bodyClass: Ember.View.extend({
-        template: Ember.Handlebars.compile('' +
-          '<p>' +
-          '{{t services.service.config_groups_popup.group_name_lable }}: {{view Ember.TextField valueBinding="configGroupName"}}' +
-          '</p>')
+        templateName: require('templates/main/service/new_config_group')
       }),
       configGroupName: "",
       content: content,
       onPrimary: function () {
         this.get('content.selectedConfigGroup').set('name', this.get('configGroupName'));
+        this.get('content.selectedConfigGroup').set('description', this.get('configGroupDesc'));
         this.get('content.selectedConfigGroup.apiResponse').group_name = this.get('configGroupName');
+        this.get('content.selectedConfigGroup.apiResponse').description = this.get('configGroupDesc');
         var configGroup = {
           ConfigGroup: this.get('content.selectedConfigGroup.apiResponse')
         };
@@ -249,6 +248,8 @@ App.ManageConfigGroupsController = Em.Controller.extend({
         this.hide();
       }
     });
+    this.get('renameGroupPopup').set('configGroupName', this.get('selectedConfigGroup.name'));
+    this.get('renameGroupPopup').set('configGroupDesc', this.get('selectedConfigGroup.description'));
   },
 
   /**
@@ -329,7 +330,17 @@ App.ManageConfigGroupsController = Em.Controller.extend({
     var confGroup = this.get('configGroups').findProperty('id', data.ConfigGroup.id);
     confGroup.set('apiResponse', data.ConfigGroup);
   },
-  
+
+  /**
+   * duplicate config group
+   */
+  duplicateConfigGroup: function() {
+    this.addConfigGroup();
+    this.get('addGroupPopup').set('header',Em.I18n.t('services.service.config_groups.duplicate_config_group_popup.header'));
+    this.get('addGroupPopup').set('configGroupName', this.get('selectedConfigGroup.name') + ' Copy');
+    this.get('addGroupPopup').set('configGroupDesc', this.get('selectedConfigGroup.description') + ' (Copy)');
+  },
+
   hostsModifiedConfigGroups: function() {
     var groups = this.get('configGroups');
     var hostsRemovedGroup = [];

+ 2 - 2
ambari-web/app/messages.js

@@ -1130,8 +1130,8 @@ Em.I18n.translations = {
   'services.service.config_groups_popup.group_desc_lable':'Description',
   'services.service.config_groups_popup.properties':'Properties',
   'services.service.config_groups.add_config_group_popup.header':'Create New Configuration Group',
-  'services.service.config_groups.duplicate_config_group_popup.header':'Duplicate config group',
-  'services.service.config_groups.rename_config_group_popup.header':'Rename config group',
+  'services.service.config_groups.duplicate_config_group_popup.header':'Duplicate Configuration Group',
+  'services.service.config_groups.rename_config_group_popup.header':'Rename Configuration Group',
   'services.reassign.closePopup':'Reassign {0} wizard is in progress. It\'s necessary to complete the wizard for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to complete or revert reassign {0} wizard as documented in the Ambari User Guide. Are you sure you want to exit the wizard ?',
 
   'services.reassign.step1.header':'Get Started',

+ 1 - 1
ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs

@@ -41,7 +41,7 @@
                 <a {{action renameConfigGroup target="controller"}}>{{t services.service.config_groups_popup.rename}}</a>
               </li>
               <li>
-                <a {{action addConfigGroup target="controller"}}>{{t services.service.config_groups_popup.duplicate}}</a>
+                <a {{action duplicateConfigGroup target="controller"}}>{{t services.service.config_groups_popup.duplicate}}</a>
               </li>
             </ul>
           </div>