Browse Source

AMBARI-4326. Move service stop start action buttons into Service Actions menu. (srimanth)

Srimanth Gunturi 11 years ago
parent
commit
44f4f91983

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

@@ -985,7 +985,7 @@ Em.I18n.translations = {
   'services.service.summary.historyServer': 'History Server Web UI',
   'services.service.actions.run.rebalancer':'Run Rebalancer',
   'services.service.actions.run.compaction':'Run Compaction',
-  'services.service.actions.run.smoke':'Run {0} Service Check',
+  'services.service.actions.run.smoke':'Run Service Check',
   'services.service.actions.reassign.master':'Move {0}',
   'services.service.actions.reassign.master.hive':'Move HiveServer2, WebHCat Server, MySQL Server',
   'services.service.actions.manage_configuration_groups':'Manage Configuration Groups...',

+ 6 - 0
ambari-web/app/styles/application.less

@@ -2147,6 +2147,12 @@ width:100%;
     a {
       cursor: pointer;
     }
+    .icon-play.enabled {
+      color: @green;
+    }
+    .icon-stop.enabled{
+      color: red;
+    }
   }
 }
 

+ 20 - 15
ambari-web/app/templates/main/service/item.hbs

@@ -48,6 +48,26 @@
       </a>
       <ul class="dropdown-menu">
         <!-- dropdown menu links -->
+
+        <!-- Start/Stop service actions -->
+        {{#if controller.isServiceRestartable}}
+          <li {{bindAttr class="controller.isStartDisabled:disabled"}}>
+            <a href="javascript:void(null)" {{bindAttr class="controller.isStartDisabled:disabled" }}
+              {{action "startService" target="controller"}}>
+              <i {{bindAttr class=":icon-play controller.isStartDisabled:disabled:enabled" }}></i>
+              {{t services.service.start}}
+            </a>
+          </li>
+          <li {{bindAttr class="controller.isStopDisabled:disabled"}}>
+            <a href="javascript:void(null)" {{bindAttr class="controller.isStopDisabled:disabled" }}
+              data-toggle="modal" {{action "stopService" target="controller"}}>
+              <i {{bindAttr class=":icon-stop controller.isStopDisabled:disabled:enabled" }}></i>
+              {{t services.service.stop}}
+            </a>
+          </li>
+        {{/if}}
+
+        <!-- Other service actions -->
         {{#each option in view.maintenance}}
         <li {{bindAttr class="option.disabled:disabled"}}>
           <a {{action "doAction" option target="controller" href=true}}>{{option.label}}</a>
@@ -56,21 +76,6 @@
       </ul>
     </div>
   {{/if}}
-  {{#if controller.isServiceRestartable}}
-	  <a href="javascript:void(null)" {{bindAttr class=":btn controller.isStartDisabled:disabled:btn-success" }}
-	     data-toggle="modal" {{action "startService" target="controller"}}>
-	    <i class="icon-play"></i>
-	    {{t services.service.start}}
-	  </a>
-	  <a href="javascript:void(null)" {{bindAttr class=":btn controller.isStopDisabled:disabled:btn-danger" }}
-	     data-toggle="modal" {{action "stopService" target="controller"}}>
-	    <i class="icon-stop icon-white"></i>
-	    {{t services.service.stop}}
-	  </a>
-	{{else}}
-	  <span>&nbsp;</span>
-	{{/if}}
-  </span>
 </div>
 {{/if}}
 {{outlet}}

+ 10 - 9
ambari-web/app/views/main/service/item.js

@@ -28,6 +28,15 @@ App.MainServiceItemView = Em.View.extend({
     var allMasters = this.get('controller.content.hostComponents').filterProperty('isMaster').mapProperty('componentName').uniq();
     var disabled = this.get('controller.isStopDisabled');
     var serviceName = service.get('serviceName');
+    // Restart All action
+    options.push({action:'restartAllHostComponents', context: serviceName, 'label': Em.I18n.t('restart.service.all'), disabled: false});
+    // Rolling Restart action
+    var rrComponentName = batchUtils.getRollingRestartComponentName(serviceName);
+    if (rrComponentName) {
+      var label = Em.I18n.t('rollingrestart.dialog.title').format(App.format.role(rrComponentName));
+      options.push({action:'rollingRestart', context: rrComponentName, 'label': label, disabled: false});
+    }
+    // Service Check and Reassign Master actions
     switch (serviceName) {
       case 'GANGLIA':
       case 'NAGIOS':
@@ -44,15 +53,7 @@ App.MainServiceItemView = Em.View.extend({
           })
         }
       default:
-        options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke').format(service.get('serviceName')), disabled:disabled});
-    }
-
-    options.push({action:'restartAllHostComponents', context: serviceName, 'label': Em.I18n.t('restart.service.all'), disabled: false});
-
-    var rrComponentName = batchUtils.getRollingRestartComponentName(serviceName);
-    if (rrComponentName) {
-      var label = Em.I18n.t('rollingrestart.dialog.title').format(App.format.role(rrComponentName));
-      options.push({action:'rollingRestart', context: rrComponentName, 'label': label, disabled: false});
+        options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke'), disabled:disabled});
     }
     return options;
   }.property('controller.content', 'controller.isStopDisabled'),