You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/02/24 18:34:23 UTC

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

Repository: ambari
Updated Branches:
  refs/heads/trunk 84a88e5e4 -> 8ead12ba7


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


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ead12ba
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ead12ba
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ead12ba

Branch: refs/heads/trunk
Commit: 8ead12ba7f74a6ea3bae5da707c7b06fa8fb5472
Parents: 84a88e5
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Mon Feb 24 19:25:31 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Mon Feb 24 19:25:31 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 14 +++-
 ambari-web/app/messages.js                      |  4 ++
 ambari-web/app/models/service.js                | 12 ++--
 ambari-web/app/styles/application.less          | 10 +++
 ambari-web/app/templates.js                     |  2 +
 .../app/templates/main/service/info/summary.hbs |  6 ++
 ambari-web/app/templates/main/service/item.hbs  | 34 ++++-----
 ambari-web/app/views/main/dashboard/service.js  |  5 +-
 .../app/views/main/service/info/summary.js      |  6 +-
 ambari-web/app/views/main/service/item.js       | 75 +++++++++++---------
 ambari-web/app/views/main/service/menu.js       |  4 +-
 11 files changed, 112 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 1fb1e76..5b39f6d 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/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;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index d4850ac..31979fc 100644
--- a/ambari-web/app/messages.js
+++ b/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',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 0808934..714d9be 100644
--- a/ambari-web/app/models/service.js
+++ b/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 = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 038d908..b0418a0 100644
--- a/ambari-web/app/styles/application.less
+++ b/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 {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/templates.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates.js b/ambari-web/app/templates.js
index d139515..fe63695 100644
--- a/ambari-web/app/templates.js
+++ b/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');

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/templates/main/service/info/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs
index 65cc6e9..abcb475 100644
--- a/ambari-web/app/templates/main/service/info/summary.hbs
+++ b/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>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/templates/main/service/item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/item.hbs b/ambari-web/app/templates/main/service/item.hbs
index 05cd306..41c77da 100644
--- a/ambari-web/app/templates/main/service/item.hbs
+++ b/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}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/views/main/dashboard/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service.js b/ambari-web/app/views/main/dashboard/service.js
index 53508d6..95f73ab 100644
--- a/ambari-web/app/views/main/dashboard/service.js
+++ b/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();

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 47fa265..ef1dd3e 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/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() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index c375cee..76461f1 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/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() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ead12ba/ambari-web/app/views/main/service/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/menu.js b/ambari-web/app/views/main/service/menu.js
index e80e095..6247c44 100644
--- a/ambari-web/app/views/main/service/menu.js
+++ b/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'),