Bläddra i källkod

AMBARI-4808 Client-only Services should not show all Services commands in UI. (ababiichuk)

aBabiichuk 11 år sedan
förälder
incheckning
8ead12ba7f

+ 12 - 2
ambari-web/app/controllers/main/service/item.js

@@ -285,6 +285,18 @@ App.MainServiceItemController = Em.Controller.extend({
     }
   },
 
+  /**
+   * Restart clients host components to apply config changes
+   */
+  refreshConfigs: function() {
+    var self = this;
+    if (this.get('content.isClientsOnly')) {
+      App.showConfirmationPopup(function() {
+        batchUtils.restartHostComponents(self.get('content.hostComponents'));
+      });
+    }
+  },
+
   setStartStopState: function () {
     var serviceName = this.get('content.serviceName');
     var backgroundOperations = App.router.get('backgroundOperationsController.services');
@@ -309,13 +321,11 @@ App.MainServiceItemController = Em.Controller.extend({
 
   isStartDisabled: function () {
     if(this.get('isPending')) return true;
-    if (this.get('content.serviceName') == 'TEZ') return true;
     return !(this.get('content.healthStatus') == 'red');
   }.property('content.healthStatus','isPending'),
 
   isStopDisabled: function () {
     if(this.get('isPending')) return true;
-    if (this.get('content.serviceName') == 'TEZ') return true;
     if (App.get('isHaEnabled') && this.get('content.serviceName') == 'HDFS' && this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
       return false;
     }

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

@@ -1350,6 +1350,10 @@ Em.I18n.translations = {
 
   'services.tez.client': 'Tez client',
   'services.tez.clients': 'Tez clients',
+  'services.pig.client': 'Pig client',
+  'services.pig.clients': 'Pig clients',
+  'services.sqoop.client': 'Sqoop client',
+  'services.sqoop.clients': 'Sqoop clients',
 
   'services.hbase.master.error':'None of the HBase masters is active',
 

+ 8 - 4
ambari-web/app/models/service.js

@@ -60,6 +60,11 @@ App.Service = DS.Model.extend({
     return this.get('workStatus') === 'STARTED';
   }.property('workStatus'),
 
+  isClientsOnly: function() {
+    var clientsOnly = ['SQOOP','PIG','TEZ'];
+    return clientsOnly.contains(this.get('serviceName'));
+  }.property('serviceName'),
+
   isConfigurable: function () {
     var configurableServices = [
       "HDFS",
@@ -72,7 +77,6 @@ App.Service = DS.Model.extend({
       "WEBHCAT",
       "ZOOKEEPER",
       "PIG",
-      "SQOOP",
       "NAGIOS",
       "GANGLIA",
       "HUE",
@@ -198,15 +202,15 @@ App.Service.servicesSortOrder = [
   'HCATALOG',
   'WEBHCAT',
   'FLUME',
+  'FALCON',
+  'STORM',
   'OOZIE',
   'GANGLIA',
   'NAGIOS',
   'ZOOKEEPER',
   'PIG',
   'SQOOP',
-  'HUE',
-  'FALCON',
-  'STORM'
+  'HUE'
 ];
 
 App.Service.FIXTURES = [];

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

@@ -2149,6 +2149,16 @@ width:100%;
         padding-left: 37px;
       }
     }
+    .icon-laptop {
+      color: #555;
+      padding-left: 5px;
+    }
+    .active {
+      .icon-laptop {
+        color: #f0f0f0;
+      }
+    }
+
   }
 
   .add-service-button {

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

@@ -28,4 +28,6 @@ require('templates/main/service/info/summary/hive');
 require('templates/main/service/info/summary/hue');
 require('templates/main/service/info/summary/falcon');
 require('templates/main/service/info/summary/tez');
+require('templates/main/service/info/summary/pig');
+require('templates/main/service/info/summary/sqoop');
 require('templates/main/admin/highAvailability/progress');

+ 6 - 0
ambari-web/app/templates/main/service/info/summary.hbs

@@ -71,6 +71,12 @@
             {{#if view.serviceStatus.tez}}
               {{template "templates/main/service/info/summary/tez"}}
             {{/if}}
+            {{#if view.serviceStatus.pig}}
+              {{template "templates/main/service/info/summary/pig"}}
+            {{/if}}
+            {{#if view.serviceStatus.sqoop}}
+              {{template "templates/main/service/info/summary/sqoop"}}
+            {{/if}}
           </tbody>
         </table>
       </div>

+ 18 - 16
ambari-web/app/templates/main/service/item.hbs

@@ -50,22 +50,24 @@
         <!-- 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}}
+        {{#unless controller.content.isClientsOnly}}
+          {{#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}}
+        {{/unless}}
 
         <!-- Other service actions -->
         {{#each option in view.maintenance}}

+ 4 - 1
ambari-web/app/views/main/dashboard/service.js

@@ -59,6 +59,9 @@ App.MainDashboardServiceHealthView = Em.View.extend({
   },
 
   healthStatus: function () {
+    if (this.get('service.isClientsOnly')) {
+      return 'icon-laptop';
+    }
     if (this.get('service.passiveState') != 'ACTIVE') {
       return 'icon-medkit';
     }
@@ -86,7 +89,7 @@ App.MainDashboardServiceHealthView = Em.View.extend({
     }
 
     return 'health-status-' + status;
-  }.property('service.healthStatus','service.passiveState'),
+  }.property('service.healthStatus','service.passiveState','service.isClientsOnly'),
 
   didInsertElement: function () {
     this.updateToolTip();

+ 4 - 2
ambari-web/app/views/main/service/info/summary.js

@@ -49,10 +49,12 @@ App.MainServiceInfoSummaryView = Em.View.extend({
     flume: false,
     falcon: false,
     storm: false,
-    tez: false
+    tez: false,
+    pig :false,
+    sqoop: false
   },
 
-  servicesHaveClients: ["OOZIE", "ZOOKEEPER", "HIVE", "MAPREDUCE2", "TEZ"],
+  servicesHaveClients: ["OOZIE", "ZOOKEEPER", "HIVE", "MAPREDUCE2", "TEZ", "SQOOP", "PIG"],
 
   sumMasterComponentView : Em.View.extend({
     didInsertElement: function() {

+ 42 - 33
ambari-web/app/views/main/service/item.js

@@ -28,40 +28,49 @@ 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', cssClass: 'icon-forward', 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', cssClass: 'icon-time', context: rrComponentName, 'label': label, disabled: false});
-    }
-    // Service Check and Reassign Master actions
-    switch (serviceName) {
-      case 'GANGLIA':
-      case 'NAGIOS':
-        break;
-      case 'YARN':
-      case 'HDFS':
-      case 'MAPREDUCE':
-        if (App.supports.reassignMaster && hosts > 1) {
-          allMasters.forEach(function (hostComponent) {
-            if (App.get('components.reassignable').contains(hostComponent)) {
-              options.push({action: 'reassignMaster', context: hostComponent, cssClass: 'icon-share-alt', 
-                'label': Em.I18n.t('services.service.actions.reassign.master').format(App.format.role(hostComponent)), disabled: false});
-            }
-          })
-        }
-      default:
-        options.push({action: 'runSmokeTest', cssClass: 'icon-thumbs-up-alt', 'label': Em.I18n.t('services.service.actions.run.smoke'), disabled:disabled});
+
+    if (service.get('isClientsOnly')) {
+      var disableRefreshConfgis = !service.get('isRestartRequired');
+      if (serviceName != 'TEZ') {
+        options.push({action: 'runSmokeTest', cssClass: 'icon-thumbs-up-alt', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+      }
+      options.push({action: 'refreshConfigs', cssClass: 'icon-refresh', 'label': Em.I18n.t('hosts.host.details.refreshConfigs'), disabled: disableRefreshConfgis});
+    } else {
+      // Restart All action
+      options.push({action:'restartAllHostComponents', cssClass: 'icon-forward', 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', cssClass: 'icon-time', context: rrComponentName, 'label': label, disabled: false});
+      }
+      // Service Check and Reassign Master actions
+      switch (serviceName) {
+        case 'GANGLIA':
+        case 'NAGIOS':
+          break;
+        case 'YARN':
+        case 'HDFS':
+        case 'MAPREDUCE':
+          if (App.supports.reassignMaster && hosts > 1) {
+            allMasters.forEach(function (hostComponent) {
+              if (App.get('components.reassignable').contains(hostComponent)) {
+                options.push({action: 'reassignMaster', context: hostComponent, cssClass: 'icon-share-alt',
+                  'label': Em.I18n.t('services.service.actions.reassign.master').format(App.format.role(hostComponent)), disabled: false});
+              }
+            })
+          }
+        default:
+          options.push({action: 'runSmokeTest', cssClass: 'icon-thumbs-up-alt', 'label': Em.I18n.t('services.service.actions.run.smoke'), disabled:disabled});
+      }
+      var requestLabel = service.get('passiveState') === "ACTIVE" ?
+          Em.I18n.t('passiveState.turnOnFor').format(App.Service.DisplayNames[serviceName]) :
+          Em.I18n.t('passiveState.turnOffFor').format(App.Service.DisplayNames[serviceName]);
+      var passiveLabel = service.get('passiveState') === "ACTIVE" ?
+          Em.I18n.t('passiveState.turnOn') :
+          Em.I18n.t('passiveState.turnOff');
+      options.push({action:'turnOnOffPassive', cssClass: 'icon-medkit', context:requestLabel, 'label':passiveLabel , disabled: false});
     }
-    var requestLabel = service.get('passiveState') === "ACTIVE" ?
-      Em.I18n.t('passiveState.turnOnFor').format(App.Service.DisplayNames[serviceName]) :
-      Em.I18n.t('passiveState.turnOffFor').format(App.Service.DisplayNames[serviceName]);
-    var passiveLabel = service.get('passiveState') === "ACTIVE" ?
-      Em.I18n.t('passiveState.turnOn') :
-      Em.I18n.t('passiveState.turnOff');
-    options.push({action:'turnOnOffPassive', cssClass: 'icon-medkit', context:requestLabel, 'label':passiveLabel , disabled: false});
     return options;
   }.property('controller.content', 'controller.isStopDisabled'),
   isMaintenanceActive: function() {

+ 2 - 2
ambari-web/app/views/main/service/menu.js

@@ -20,7 +20,7 @@ var App = require('app');
 var misc = require('utils/misc');
 
 App.MainServiceMenuView = Em.CollectionView.extend({
-  disabledServices: ['PIG', 'SQOOP', 'HCATALOG'],
+  disabledServices: ['HCATALOG'],
 
   content:function () {
     var items = App.router.get('mainServiceController.content').filter(function(item){
@@ -75,7 +75,7 @@ App.MainServiceMenuView = Em.CollectionView.extend({
 
     link: function() {
       var stateName = (['summary','configs'].contains(App.router.get('currentState.name')))
-        ? App.router.get('currentState.name')
+        ? this.get('content.isConfigurable') ?  App.router.get('currentState.name') : 'summary'
         : 'summary';
       return "#/main/services/" + this.get('content.id') + "/" + stateName;
     }.property('App.router.currentState.name', 'parentView.activeServiceId'),