Author: srimanth
Date: Tue Apr 16 00:38:29 2013
New Revision: 1468285

URL: http://svn.apache.org/r1468285
Log:
AMBARI-1939. Make service restart feedback based on supports functionality. 
(srimanth)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
    incubator/ambari/trunk/ambari-web/app/messages.js
    
incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
    
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
    incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs
    incubator/ambari/trunk/ambari-web/app/views/main/host/menu.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Apr 16 00:38:29 2013
@@ -739,6 +739,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1939. Make service restart feedback based on supports functionality. 
+ (srimanth)
+
  AMBARI-1943. Properties that do not map to any global property are not being
  sent to server. (jaimin)
 

Modified: 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js 
Tue Apr 16 00:38:29 2013
@@ -589,16 +589,31 @@ App.MainServiceInfoConfigsController = E
     var header;
     var message;
     var value;
-    var result = this.saveServiceConfigProperties();
-    App.router.get('clusterController').updateClusterData();
-    if (result.flag === true) {
-      header = Em.I18n.t('services.service.config.restartService');
-      message = Em.I18n.t('services.service.config.saveConfig');
+    var flag = false;
+    if (App.supports.hostOverrides || 
+        (this.get('content.serviceName') !== 'HDFS' && 
this.get('content.isStopped') === true) || 
+        ((this.get('content.serviceName') === 'HDFS') && 
this.get('content.isStopped') === true && 
(!App.Service.find().someProperty('id', 'MAPREDUCE') || 
App.Service.find('MAPREDUCE').get('isStopped')))) {
+      var result = this.saveServiceConfigProperties();
+      App.router.get('clusterController').updateClusterData();
+      flag = result.flag;
+      if (result.flag === true) {
+        header = App.supports.hostOverrides ? 
Em.I18n.t('services.service.config.restartService') : 
Em.I18n.t('services.service.config.startService');
+        message = Em.I18n.t('services.service.config.saveConfig');
+      } else {
+        header = Em.I18n.t('common.failure');
+        message = result.message;
+        value = result.value;
+      }
     } else {
-      header = Em.I18n.t('common.failure');
-      message = result.message;
-      value = result.value;
+      if (this.get('content.serviceName') !== 'HDFS' || 
(this.get('content.serviceName') === 'HDFS' && 
!App.Service.find().someProperty('id', 'MAPREDUCE'))) {
+        header = Em.I18n.t('services.service.config.stopService');
+        message = Em.I18n.t('services.service.config.msgServiceStop');
+      } else {
+        header = Em.I18n.t('services.service.config.stopService');
+        message = Em.I18n.t('services.service.config.msgHDFSMapRServiceStop');
+      }
     }
+    
     var self = this;
     App.ModalPopup.show({
       header: header,
@@ -606,10 +621,12 @@ App.MainServiceInfoConfigsController = E
       secondary: null,
       onPrimary: function () {
         this.hide();
-        self.loadStep();
+        if (App.supports.hostOverrides) {
+          self.loadStep();
+        }
       },
       bodyClass: Ember.View.extend({
-        flag: result.flag,
+        flag: flag,
         message: message,
         siteProperties: value,
         getDisplayMessage: function () {

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Tue Apr 16 00:38:29 2013
@@ -731,6 +731,7 @@ Em.I18n.translations = {
   'services.service.info.summary.nagios.noAlerts':'No alerts',
   'services.service.info.summary.nagios.alerts':'Nagios service required for 
viewing alerts',
 
+  'services.service.config.startService':'Start Service',
   'services.service.config.restartService':'Restart Service',
   'services.service.config.restartService.TooltipMessage':'<b>Restart 
Service</b><br>Stale configuration used by {0} components on {1} hosts:{2}',
   'services.service.config.saveConfig':'Service configuration applied 
successfully',

Modified: 
incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
 (original)
+++ 
incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
 Tue Apr 16 00:38:29 2013
@@ -16,32 +16,34 @@
 * limitations under the License.
 }}
 
-{{#if selectedService.restartRequired}}
-<div class="alert">
-  <div class="clearfix like_pointer collapsable" {{action 
toggleRestartMessageView target="view"}}>
-      {{#if view.isRestartMessageCollapsed}}
-        <i class="icon-caret-down pull-left"></i>
-      {{else}}
-        <i class="icon-caret-right pull-left"></i>
-      {{/if}}
-      <i class="icon-refresh"></i>
-      <strong>Restart Service</strong> 
{{selectedService.restartRequiredMessage}}
-  </div>
-  <div class="service-body">
-    <ul>
-    {{#each host in selectedService.restartRequiredHostsAndComponents}}
-      <li>
-        <a href="#" {{action showDetails 
host.hostData}}>{{host.hostData.publicHostName}}</a>
-        <ul>
-          {{#each component in host.components}}
-            <li>{{component.name}}</li>
-          {{/each}}
-        </ul>
-      </li>
-    {{/each}}
-    </ul>
-  </div>
-</div>
+{{#if App.supports.hostOverrides}}
+  {{#if selectedService.restartRequired}}
+       <div class="alert">
+         <div class="clearfix like_pointer collapsable" {{action 
toggleRestartMessageView target="view"}}>
+             {{#if view.isRestartMessageCollapsed}}
+               <i class="icon-caret-down pull-left"></i>
+             {{else}}
+               <i class="icon-caret-right pull-left"></i>
+             {{/if}}
+             <i class="icon-refresh"></i>
+             <strong>Restart Service</strong> 
{{selectedService.restartRequiredMessage}}
+         </div>
+         <div class="service-body">
+           <ul>
+           {{#each host in selectedService.restartRequiredHostsAndComponents}}
+             <li>
+               <a href="#" {{action showDetails 
host.hostData}}>{{host.hostData.publicHostName}}</a>
+               <ul>
+                 {{#each component in host.components}}
+                   <li>{{component.name}}</li>
+                 {{/each}}
+               </ul>
+             </li>
+           {{/each}}
+           </ul>
+         </div>
+       </div>
+       {{/if}}
 {{/if}}
           
 <div class="accordion">
@@ -66,9 +68,11 @@
                       <div {{bindAttr class=":entry-row 
isOverridden:overridden-property"}}>
                           <span {{bindAttr class="errorMessage:error: 
:control-group :control-label-span"}}>
                             <label class="control-label">
-                                   {{#if isRestartRequired}}
-                                     <i class="icon-refresh 
restart-required-property" rel="tooltip" {{bindAttr 
title="restartRequiredMessage"}}></i>
-                                   {{/if}}
+                              {{#if App.supports.hostOverrides}}
+                                           {{#if isRestartRequired}}
+                                             <i class="icon-refresh 
restart-required-property" rel="tooltip" {{bindAttr 
title="restartRequiredMessage"}}></i>
+                                           {{/if}}
+                                         {{/if}}
                               {{displayName}}
                             </label>
                           </span>

Modified: 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs 
Tue Apr 16 00:38:29 2013
@@ -18,9 +18,11 @@
 
 <div id="serviceConfig">
   {{#if dataIsLoaded}}
-    <div class="pull-right">
-      {{view App.FilterComboboxView filterBinding="controller.filter" 
columnsBinding="controller.filterColumns" }}
-    </div>
+    {{#if App.supports.hostOverrides}}
+           <div class="pull-right">
+             {{view App.FilterComboboxView filterBinding="controller.filter" 
columnsBinding="controller.filterColumns" }}
+           </div>
+         {{/if}}
     <div class="clearfix"></div>
     {{view App.ServiceConfigView filterBinding="controller.filter" 
columnsBinding="controller.filterColumns"}}
     {{#if App.isAdmin}}

Modified: 
incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs 
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service/menu_item.hbs 
Tue Apr 16 00:38:29 2013
@@ -24,7 +24,9 @@
       {{view.alertsCount}}
     </span>
   {{/if}}
-  {{#if view.content.isRestartRequired}}
-    <i class="icon-refresh restart-required-service" rel="tooltip" 
title="{{unbound view.content.restartRequiredMessage}}"></i>
-  {{/if}}
+  {{#if App.supports.hostOverrides}}
+         {{#if view.content.isRestartRequired}}
+           <i class="icon-refresh restart-required-service" rel="tooltip" 
title="{{unbound view.content.restartRequiredMessage}}"></i>
+         {{/if}}
+       {{/if}}
 </a>

Modified: incubator/ambari/trunk/ambari-web/app/views/main/host/menu.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host/menu.js?rev=1468285&r1=1468284&r2=1468285&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host/menu.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host/menu.js Tue Apr 16 
00:38:29 2013
@@ -21,11 +21,21 @@ var App = require('app');
 App.MainHostMenuView = Em.CollectionView.extend({
   tagName: 'ul',
   classNames: ["nav", "nav-tabs"],
-  content:[
-    { label:'Summary', routing:'summary'},
-    { label:'Configs', routing:'configs'}
-    /*{ label:'Audit', routing:'audit'}*/
-  ],
+  content: function () {
+    var array = [ {
+      label: 'Summary',
+      routing: 'summary'
+    }
+    /* { label:'Audit', routing:'audit'} */
+    ];
+    if (App.supports.hostOverrides) {
+      array.push({
+        label: 'Configs',
+        routing: 'configs'
+      });
+    }
+    return array;
+  }.property(''),
 
   init: function(){ this._super(); this.activateView(); },
 


Reply via email to