Browse Source

AMBARI-6348. Switching to host config group should spin since it takes a while.(xiwang)

Xi Wang 11 years ago
parent
commit
3ed90ad248

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

@@ -1336,6 +1336,8 @@ Em.I18n.translations = {
   'services.service.config_groups.add_config_group_popup.header':'Create New Configuration Group',
   'services.service.config_groups.add_config_group_popup.header':'Create New Configuration Group',
   'services.service.config_groups.duplicate_config_group_popup.header':'Duplicate Configuration 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.service.config_groups.rename_config_group_popup.header':'Rename Configuration Group',
+  'services.service.config_groups.switchGroupTextFull':'Switch to \'{0}\' host config group',
+  'services.service.config_groups.switchGroupTextShort':'Switch to \'{0}\'',
   'services.reassign.closePopup':'Move {0} wizard is in progress. You must allow the wizard to complete for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to complete or revert move {0} wizard as documented in the Ambari User Guide. Are you sure you want to exit the wizard?',
   'services.reassign.closePopup':'Move {0} wizard is in progress. You must allow the wizard to complete for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to complete or revert move {0} wizard as documented in the Ambari User Guide. Are you sure you want to exit the wizard?',
 
 
   'services.reassign.step1.header':'Get Started',
   'services.reassign.step1.header':'Get Started',

+ 19 - 14
ambari-web/app/templates/common/configs/overriddenProperty.hbs

@@ -16,22 +16,27 @@
 * limitations under the License.
 * limitations under the License.
 }}
 }}
 {{#each overriddenSCP in view.serviceConfigProperty.overrides}}
 {{#each overriddenSCP in view.serviceConfigProperty.overrides}}
-    {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
-    <div {{bindAttr class="overriddenSCP.errorMessage:error: :control-group :overrideField"}}>
-      {{view overriddenSCP.viewClass serviceConfigBinding="overriddenSCP" categoryConfigsBinding="view.categoryConfigs"}}
-      {{#if view.isDefaultGroupSelected}}
-        {{#if overriddenSCP.group}}
-            <a class="action" {{action selectConfigGroup overriddenSCP.group target="controller"}}>{{overriddenSCP.group.displayName}}</a>
-        {{/if}}
+  {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
+  <div {{bindAttr class="overriddenSCP.errorMessage:error: :control-group :overrideField"}}>
+    {{view overriddenSCP.viewClass serviceConfigBinding="overriddenSCP" categoryConfigsBinding="view.categoryConfigs"}}
+    {{#if view.isDefaultGroupSelected}}
+      {{#if overriddenSCP.group}}
+        <a rel='SwitchGroupTooltip' {{bindAttr data-original-title="overriddenSCP.group.switchGroupTextFull" }} class="action" {{action selectConfigGroup overriddenSCP.group target="controller"}}>
+          {{overriddenSCP.group.switchGroupTextShort}}
+        </a>
       {{/if}}
       {{/if}}
+    {{else}}
       {{#if overriddenSCP.isEditable}}
       {{#if overriddenSCP.isEditable}}
-	      {{#if isNotDefaultValue}}
-	        <a class="action" {{action "doRestoreDefaultValue" this target="view" }} ><i class="icon-undo"></i>{{t common.undo}}</a>
-	      {{/if}}
+        {{#if isNotDefaultValue}}
+          <a class="action" {{action "doRestoreDefaultValue" this target="view" }} ><i class="icon-undo"></i>{{t common.undo}}</a>
+        {{/if}}
         {{#if App.isAdmin}}
         {{#if App.isAdmin}}
-	        <a class="action" {{action "removeOverride" overriddenSCP target="view" }} ><i class="icon-minus-sign"></i>{{t common.remove}}</a>
+          <a class="action" {{action "removeOverride" overriddenSCP target="view" }} ><i class="icon-minus-sign"></i>{{t common.remove}}</a>
         {{/if}}
         {{/if}}
-	      <span class="help-inline">{{overriddenSCP.errorMessage}}</span>
-	    {{/if}}
-    </div>
+          <span class="help-inline">{{overriddenSCP.errorMessage}}</span>
+      {{else}}
+        <a class="action">{{overriddenSCP.group.switchGroupTextShort}}</a> <i class="icon-spinner"></i>
+      {{/if}}
+    {{/if}}
+  </div>
 {{/each}}
 {{/each}}

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

@@ -23,7 +23,21 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({
   serviceConfigProperty: null, // is passed dynamically at runtime where ever
   serviceConfigProperty: null, // is passed dynamically at runtime where ever
   // we are declaring this from configs.hbs ( we are initializing this from UI )
   // we are declaring this from configs.hbs ( we are initializing this from UI )
   categoryConfigs: null, // just declared as viewClass need it
   categoryConfigs: null, // just declared as viewClass need it
-  
+
+  didInsertElement: function (){
+    if (this.get('isDefaultGroupSelected')) {
+      var overrides = this.get('serviceConfigProperty.overrides');
+      overrides.forEach(function(overriddenSCP) {
+        overriddenSCP.get('group').set('switchGroupTextShort',
+          Em.I18n.t('services.service.config_groups.switchGroupTextShort').format(overriddenSCP.get('group.displayName')));
+        overriddenSCP.get('group').set('switchGroupTextFull',
+          Em.I18n.t('services.service.config_groups.switchGroupTextFull').format(overriddenSCP.get('group.displayName')));
+      })
+      this.set('serviceConfigProperty.overrides', overrides);
+      App.tooltip(this.$("[rel='SwitchGroupTooltip']"));
+    }
+  },
+
   removeOverride: function (event) {
   removeOverride: function (event) {
     // arg 1 SCP means ServiceConfigProperty
     // arg 1 SCP means ServiceConfigProperty
     var scpToBeRemoved = event.contexts[0];
     var scpToBeRemoved = event.contexts[0];