You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/04/16 14:27:14 UTC

git commit: AMBARI-5477. Flume host component should have stop/start/restart actions. (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 8b3983f12 -> a0f09837a


AMBARI-5477. Flume host component should have stop/start/restart actions. (akovalenko)


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

Branch: refs/heads/trunk
Commit: a0f09837aec41f9f18d75ad1bae7dba87ebb9e4e
Parents: 8b3983f
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Apr 16 14:26:22 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Apr 16 15:26:40 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/app.js                           |  1 +
 ambari-web/app/controllers/main/host/details.js | 53 ++++++++++++++++++++
 ambari-web/app/messages.js                      |  1 +
 .../app/models/stack_service_component.js       |  4 ++
 .../main/host/details/host_component.hbs        |  7 +++
 ambari-web/app/utils/ajax/ajax.js               | 18 +++++++
 .../main/host/details/host_component_view.js    |  8 +++
 7 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 6c08e9d..4466457 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -250,6 +250,7 @@ module.exports = Em.Application.create({
       deletable: this.StackServiceComponent.find().filterProperty('isDeletable',true).mapProperty('componentName'),
       rollinRestartAllowed: this.StackServiceComponent.find().filterProperty('isRollinRestartAllowed',true).mapProperty('componentName'),
       decommissionAllowed: this.StackServiceComponent.find().filterProperty('isDecommissionAllowed',true).mapProperty('componentName'),
+      refreshConfigsAllowed: this.StackServiceComponent.find().filterProperty('isRefreshConfigsAllowed',true).mapProperty('componentName'),
       addableToHost: this.StackServiceComponent.find().filterProperty('isAddableToHost',true).mapProperty('componentName'),
       slaves: this.StackServiceComponent.find().filterProperty('isMaster',false).filterProperty('isClient',false).mapProperty('componentName'),
       masters: this.StackServiceComponent.find().filterProperty('isMaster',true).mapProperty('componentName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index ca28de0..446e158 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -657,6 +657,59 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
+   * Send command to server to resfresh configs of selected component
+   * @param {object} event
+   * @method refreshComponentConfigs
+   */
+  refreshComponentConfigs: function (event) {
+    var self = this;
+    App.showConfirmationPopup(function() {
+      var component = event.context;
+      var context = Em.I18n.t('requestInfo.refreshComponentConfigs').format(component.get('displayName'));
+      self.sendRefreshComponentConfigsCommand(component, context);
+    });
+  },
+
+  /**
+   * PUTs a command to server to refresh configs of host component.
+   * @param {object} component
+   * @param {object} context Context under which this command is beign sent.
+   * @method sendRefreshComponentConfigsCommand
+   */
+  sendRefreshComponentConfigsCommand: function (component, context) {
+    resource_filters = [
+      {
+        service_name: component.get('service.serviceName'),
+        component_name: component.get('componentName'),
+        hosts: component.get('host.hostName')
+      }
+    ];
+    App.ajax.send({
+      name: 'host.host_component.refresh_configs',
+      sender: this,
+      data: {
+        resource_filters: resource_filters,
+        context: context
+      },
+      success: 'refreshComponentConfigsSuccessCallback'
+    });
+  },
+
+  /**
+   * Success callback for refresh host component configs request
+   * @method refreshComponentConfigsSuccessCallback
+   */
+  refreshComponentConfigsSuccessCallback: function() {
+    console.log('Send request for refresh configs successfully');
+    // load data (if we need to show this background operations popup) from persist
+    App.router.get('applicationController').dataLoading().done(function (showPopup) {
+      if (showPopup) {
+        App.router.get('backgroundOperationsController').showPopup();
+      }
+    });
+  },
+
+  /**
    * Load tags
    * @method checkZkConfigs
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index bc86cef..51e451d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -226,6 +226,7 @@ Em.I18n.translations = {
   'requestInfo.stopHostComponent':'Stop',
   'requestInfo.installHostComponent':'Install',
   'requestInfo.installNewHostComponent':'Install',
+  'requestInfo.refreshComponentConfigs':'Refresh {0} configs',
   'requestInfo.stop':'Stop {0}',
   'requestInfo.start':'Start {0}',
   'requestInfo.unspecified':'Request name not specified',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js b/ambari-web/app/models/stack_service_component.js
index 50175af..e855b31 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -58,6 +58,10 @@ App.StackServiceComponent = DS.Model.extend({
     return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER"].contains(this.get('componentName'));
   }.property('componentName'),
 
+  isRefreshConfigsAllowed: function() {
+    return ["FLUME_HANDLER"].contains(this.get('componentName'));
+  }.property('componentName'),
+
   isAddableToHost: function() {
     return ["DATANODE", "TASKTRACKER", "NODEMANAGER", "HBASE_REGIONSERVER", "HBASE_MASTER", "ZOOKEEPER_SERVER", "SUPERVISOR"].contains(this.get('componentName'));
   }.property('componentName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/templates/main/host/details/host_component.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/host_component.hbs b/ambari-web/app/templates/main/host/details/host_component.hbs
index f9d8c37..889e57b 100644
--- a/ambari-web/app/templates/main/host/details/host_component.hbs
+++ b/ambari-web/app/templates/main/host/details/host_component.hbs
@@ -115,6 +115,13 @@
                 </a>
             </li>
         {{/if}}
+        {{#if view.isRefreshConfigsAllowed}}
+            <li>
+                <a href="javascript:void(null)" data-toggle="modal" {{action "refreshComponentConfigs" view.content target="controller"}}>
+                  {{t hosts.host.details.refreshConfigs}}
+                </a>
+            </li>
+        {{/if}}
       </ul>
     </div>
   {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 3d372df..a35061c 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -603,6 +603,24 @@ var urls = {
       }
     }
   },
+
+  'host.host_component.refresh_configs': {
+    'real':'/clusters/{clusterName}/requests',
+    'mock':'',
+    'format': function(data) {
+      return {
+        type : 'POST',
+        data : JSON.stringify({
+          "RequestInfo": {
+            "command": "CONFIGURE",
+            "context": data.context
+          },
+          "Requests/resource_filters": data.resource_filters
+        })
+      }
+    }
+  },
+
   'host.delete': {
     'real': '/clusters/{clusterName}/hosts/{hostName}',
     'mock': '',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0f09837/ambari-web/app/views/main/host/details/host_component_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details/host_component_view.js b/ambari-web/app/views/main/host/details/host_component_view.js
index 6e438bd..9e1f3a4 100644
--- a/ambari-web/app/views/main/host/details/host_component_view.js
+++ b/ambari-web/app/views/main/host/details/host_component_view.js
@@ -232,6 +232,14 @@ App.HostComponentView = Em.View.extend({
     return ![App.HostComponentStatus.started].contains(this.get('workStatus'));
   }.property('workStatus'),
 
+  /**
+   * Check if component configs can be refreshed
+   * @type {bool}
+   */
+  isRefreshConfigsAllowed: function() {
+    return App.get('components.refreshConfigsAllowed').contains(this.get('content.componentName'));
+  }.property('content'),
+
   didInsertElement: function () {
     App.tooltip($('[rel=componentHealthTooltip]'));
     App.tooltip($('[rel=passiveTooltip]'));