You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/06/14 19:50:33 UTC
svn commit: r1493188 -
/incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
Author: yusaku
Date: Fri Jun 14 17:50:32 2013
New Revision: 1493188
URL: http://svn.apache.org/r1493188
Log:
AMBARI-2378. Host Details page, Add Component: show info about manual steps required on a secure cluster. (Oleg Nechiporenko via yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js?rev=1493188&r1=1493187&r2=1493188&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js Fri Jun 14 17:50:32 2013
@@ -219,71 +219,86 @@ App.MainHostDetailsController = Em.Contr
var componentName = component.get('componentName').toUpperCase().toString();
var displayName = component.get('displayName');
- App.ModalPopup.show({
- primary: Em.I18n.t('yes'),
- secondary: Em.I18n.t('no'),
- header: Em.I18n.t('popup.confirmation.commonHeader'),
- bodyClass: Ember.View.extend({
- template: Ember.Handlebars.compile([
- '{{t hosts.delete.popup.body}}<br><br>',
- '{{t hosts.host.addComponent.note}}'
- ].join(''))
- }),
- onPrimary: function () {
- this.hide();
- self.sendCommandToServer('/hosts?Hosts/host_name=' + self.get('content.hostName'), {
+ var securityEnabled = App.router.get('mainAdminSecurityController').getUpdatedSecurityStatus();
+
+ if (securityEnabled) {
+ App.showConfirmationPopup(function() {
+ self.primary(component);
+ }, Em.I18n.t('hosts.host.addComponent.securityNote').format(componentName,self.get('content.hostName')));
+ }
+ else {
+ App.ModalPopup.show({
+ primary: Em.I18n.t('yes'),
+ secondary: Em.I18n.t('no'),
+ header: Em.I18n.t('popup.confirmation.commonHeader'),
+ bodyClass: Ember.View.extend({
+ template: Ember.Handlebars.compile([
+ '{{t hosts.delete.popup.body}}<br><br>',
+ '{{t hosts.host.addComponent.note}}'
+ ].join(''))
+ }),
+ onPrimary: function () {
+ this.hide();
+ this.primary(component);
+ }
+ });
+ }
+ },
+ primary: function(component) {
+ var self = this;
+ var componentName = component.get('componentName').toUpperCase().toString();
+ var displayName = component.get('displayName');
+
+ self.sendCommandToServer('/hosts?Hosts/host_name=' + self.get('content.hostName'), {
+ RequestInfo: {
+ "context": Em.I18n.t('requestInfo.installHostComponent') + " " + displayName
+ },
+ Body: {
+ host_components: [
+ {
+ HostRoles: {
+ component_name: componentName
+ }
+ }
+ ]
+ }
+ },
+ 'POST',
+ function (requestId) {
+
+ console.log('Send request for ADDING NEW COMPONENT successfully');
+
+ self.sendCommandToServer('/host_components?HostRoles/host_name=' + self.get('content.hostName') + '\&HostRoles/component_name=' + componentName + '\&HostRoles/state=INIT', {
RequestInfo: {
- "context": Em.I18n.t('requestInfo.installHostComponent') + " " + displayName
+ "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + displayName
},
Body: {
- host_components: [
- {
- HostRoles: {
- component_name: componentName
- }
- }
- ]
+ HostRoles: {
+ state: 'INSTALLED'
+ }
}
},
- 'POST',
+ 'PUT',
function (requestId) {
+ if (!requestId) {
+ return;
+ }
- console.log('Send request for ADDING NEW COMPONENT successfully');
+ console.log('Send request for INSTALLING NEW COMPONENT successfully');
- self.sendCommandToServer('/host_components?HostRoles/host_name=' + self.get('content.hostName') + '\&HostRoles/component_name=' + componentName + '\&HostRoles/state=INIT', {
- RequestInfo: {
- "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + displayName
- },
- Body: {
- HostRoles: {
- state: 'INSTALLED'
- }
- }
- },
- 'PUT',
- function (requestId) {
- if (!requestId) {
- return;
- }
-
- console.log('Send request for INSTALLING NEW COMPONENT successfully');
-
- if (App.testMode) {
- component.set('workStatus', App.HostComponentStatus.installing);
- setTimeout(function () {
- component.set('workStatus', App.HostComponentStatus.stopped);
- }, App.testModeDelayForActions);
- } else {
- App.router.get('clusterController').loadUpdatedStatusDelayed(500);
- }
+ if (App.testMode) {
+ component.set('workStatus', App.HostComponentStatus.installing);
+ setTimeout(function () {
+ component.set('workStatus', App.HostComponentStatus.stopped);
+ }, App.testModeDelayForActions);
+ } else {
+ App.router.get('clusterController').loadUpdatedStatusDelayed(500);
+ }
- App.router.get('backgroundOperationsController').showPopup();
+ App.router.get('backgroundOperationsController').showPopup();
- });
- return;
});
- }
- });
+ });
},
/**
* send command to server to install selected host component