Repository: ambari Updated Branches: refs/heads/trunk fcc87a60a -> 84e13aabd
AMBARI-6373 Add operation level info to most PUT requests issued by UI part 2. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/84e13aab Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/84e13aab Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/84e13aab Branch: refs/heads/trunk Commit: 84e13aabd2abb141af9d39eb7186b0dc5a69ed92 Parents: fcc87a6 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Tue Jul 8 14:00:08 2014 +0300 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Tue Jul 8 14:00:08 2014 +0300 ---------------------------------------------------------------------- .../highAvailability/progress_controller.js | 2 +- .../highAvailability/rollback_controller.js | 4 +- .../admin/highAvailability/step9_controller.js | 2 +- .../main/admin/security/add/step4.js | 2 +- ambari-web/app/controllers/main/host.js | 19 +- .../app/controllers/main/host/add_controller.js | 19 +- ambari-web/app/controllers/main/host/details.js | 31 ++- .../controllers/main/service/add_controller.js | 43 ++-- .../main/service/reassign/step4_controller.js | 2 +- .../main/service/reassign/step6_controller.js | 2 +- ambari-web/app/controllers/wizard.js | 26 +- .../app/controllers/wizard/step8_controller.js | 6 +- .../app/controllers/wizard/step9_controller.js | 74 +++--- ambari-web/app/utils/ajax/ajax.js | 246 ++++--------------- ambari-web/app/views/main/host/summary.js | 2 +- 15 files changed, 149 insertions(+), 331 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js index 39a17d7..dfb3b5d 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js @@ -307,7 +307,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle var state = context.toLowerCase() == "start" ? "STARTED" : "INSTALLED"; for (var i = 0; i < hostName.length; i++) { App.ajax.send({ - name: 'common.host_component.update', + name: 'common.host.host_components.update', sender: this, data: { context: context + " " + App.format.role(componentName), http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js index 5b1ad66..1050c9c 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js @@ -374,7 +374,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl var hostName = this.get("content.hdfsClientHostNames"); for (var i = 0; i < hostName.length; i++) { App.ajax.send({ - name: 'admin.delete_component', + name: 'common.delete.host_component', sender: this, data: { componentName: 'HDFS_CLIENT', @@ -466,7 +466,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl this.set('numOfDelOperations', hostName.length); for (var i = 0; i < hostName.length; i++) { App.ajax.send({ - name: 'admin.delete_component', + name: 'common.delete.host_component', sender: this, data: { componentName: componentName, http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js index bd53b01..f490681 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/step9_controller.js @@ -94,7 +94,7 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont deleteSNameNode: function () { var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName; App.ajax.send({ - name: 'admin.delete_component', + name: 'common.delete.host_component', sender: this, data: { componentName: 'SECONDARY_NAMENODE', http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/admin/security/add/step4.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/security/add/step4.js b/ambari-web/app/controllers/main/admin/security/add/step4.js index bbd1b86..3897cc0 100644 --- a/ambari-web/app/controllers/main/admin/security/add/step4.js +++ b/ambari-web/app/controllers/main/admin/security/add/step4.js @@ -507,7 +507,7 @@ App.MainAdminSecurityAddStep4Controller = App.MainAdminSecurityProgressControlle */ deleteComponents: function(componentName, hostName) { App.ajax.send({ - name: 'admin.delete_component', + name: 'common.delete.host_component', sender: this, data: { componentName: componentName, http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js index 3cfaf44..e6cf3b7 100644 --- a/ambari-web/app/controllers/main/host.js +++ b/ambari-web/app/controllers/main/host.js @@ -659,12 +659,14 @@ App.MainHostController = Em.ArrayController.extend({ if (query.length) { query = query.join('|'); App.ajax.send({ - name: 'bulk_request.hosts.all_components', + name: 'common.host_components.update', sender: this, data: { query: query, - state: operationData.action, - requestInfo: operationData.message, + HostRoles: { + state: operationData.action + }, + context: operationData.message, hostName: hostNames }, success: 'bulkOperationForHostComponentsSuccessCallback' @@ -762,13 +764,14 @@ App.MainHostController = Em.ArrayController.extend({ if (data.items.length) { var hostsWithComponentInProperState = data.items.mapProperty('Hosts.host_name'); App.ajax.send({ - name: 'bulk_request.host_components', + name: 'common.host_components.update', sender: self, data: { - hostNames: hostsWithComponentInProperState.join(','), - state: operationData.action, - requestInfo: operationData.message + ' ' + operationData.componentNameFormatted, - componentName: operationData.componentName + HostRoles: { + state: operationData.action + }, + query: 'HostRoles/component_name=' + operationData.componentName + '&HostRoles/host_name.in(' + hostsWithComponentInProperState.join(',') + ')&HostRoles/maintenance_state=OFF', + context: operationData.message + ' ' + operationData.componentNameFormatted }, success: 'bulkOperationForHostComponentsSuccessCallback' }); http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/host/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js index ec70f35..cbce650 100644 --- a/ambari-web/app/controllers/main/host/add_controller.js +++ b/ambari-web/app/controllers/main/host/add_controller.js @@ -393,24 +393,13 @@ App.AddHostController = App.WizardController.extend({ } if(!clusterName || hostNames.length === 0) return false; - var name = 'wizard.install_services.add_host_controller.'; - name += (isRetry) ? 'is_retry' : 'not_is_retry'; - - var data = JSON.stringify({ - "RequestInfo": { - "context": Em.I18n.t('requestInfo.installComponents'), - "query": "HostRoles/host_name.in(" + hostNames.join(',') + ")" - }, - "Body": { - "HostRoles": {"state": "INSTALLED"} - } - }); App.ajax.send({ - name: name, + name: "common.host_components.update", sender: this, data: { - data: data, - cluster: clusterName + "context": Em.I18n.t('requestInfo.installComponents'), + "query": "HostRoles/host_name.in(" + hostNames.join(',') + ")", + "HostRoles": {"state": "INSTALLED"} }, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/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 a41f761..9a45a93 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -126,7 +126,7 @@ App.MainHostDetailsController = Em.Controller.extend({ data.serviceName = component.get('service.serviceName'); } App.ajax.send({ - name: (Array.isArray(component)) ? 'common.host_components.update' : 'common.host_component.update', + name: (Array.isArray(component)) ? 'common.host.host_components.update' : 'common.host.host_component.update', sender: this, data: data, success: 'sendComponentCommandSuccessCallback', @@ -269,7 +269,7 @@ App.MainHostDetailsController = Em.Controller.extend({ _doDeleteHostComponent: function (component, callback) { callback = callback || Em.K; App.ajax.send({ - name: (Em.isNone(component)) ? 'host.host_components.delete' : 'host.host_component.delete', + name: (Em.isNone(component)) ? 'common.delete.host' : 'common.delete.host_component', sender: this, data: { componentName: (component) ? component.get('componentName') : '', @@ -442,7 +442,8 @@ App.MainHostDetailsController = Em.Controller.extend({ scs.forEach(function (sc) { var c = Em.Object.create({ displayName: App.format.role(sc), - componentName: sc + componentName: sc, + serviceName: sc.replace("_CLIENT", "") }); self.primary(c); }); @@ -515,23 +516,19 @@ App.MainHostDetailsController = Em.Controller.extend({ addNewComponentSuccessCallback: function (data, opt, params) { console.log('Send request for ADDING NEW COMPONENT successfully'); App.ajax.send({ - name: 'host.host_component.install_new_component', + name: 'common.host.host_component.update', sender: this, data: { hostName: this.get('content.hostName'), componentName: params.component.get('componentName'), + serviceName: params.component.get('serviceName'), component: params.component, - data: JSON.stringify({ - RequestInfo: { - "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + params.component.get('displayName') - }, - Body: { - HostRoles: { - state: 'INSTALLED' - } - } - }) - }, + "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + params.component.get('displayName'), + HostRoles: { + state: 'INSTALLED' + }, + urlParams: "HostRoles/state=INIT" + } , success: 'installNewComponentSuccessCallback', error: 'ajaxErrorCallback' }); @@ -798,7 +795,7 @@ App.MainHostDetailsController = Em.Controller.extend({ this.hide(); App.ajax.send({ - name: 'common.host_component.update', + name: 'common.host.host_component.update', sender: self, data: { hostName: self.get('content.hostName'), @@ -1438,7 +1435,7 @@ App.MainHostDetailsController = Em.Controller.extend({ dfd.done(function () { if (!deleteError) { App.ajax.send({ - name: 'host.delete', + name: 'common.delete.host', sender: popup, data: { hostName: self.get('content.hostName') http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/service/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js index ce3a9aa..2f353c8 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -384,22 +384,22 @@ App.AddServiceController = App.WizardController.extend({ this.getFailedHostComponents(callback); } else { - var clusterName = this.get('content.cluster.name'); - var name = 'wizard.install_services.installer_controller.not_is_retry'; - var data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; - this.installServicesRequest(clusterName, name, data, callback); + var name = 'common.services.update'; + var data = { + "context": Em.I18n.t('requestInfo.installServices'), + "ServiceInfo": {"state": "INSTALLED"}, + "urlParams": "ServiceInfo/state=INIT" + }; + this.installServicesRequest(name, data, callback); } }, - installServicesRequest: function (clusterName, name, data, callback) { + installServicesRequest: function (name, data, callback) { callback = callback || Em.K; App.ajax.send({ name: name, sender: this, - data: { - data: data, - cluster: clusterName - }, + data: data, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' }).then(callback, callback); @@ -413,7 +413,7 @@ App.AddServiceController = App.WizardController.extend({ installAdditionalClients: function () { this.get('content.additionalClients').forEach(function (c) { App.ajax.send({ - name: 'common.host_component.update', + name: 'common.host.host_component.update', sender: this, data: { hostName: c.hostName, @@ -464,24 +464,17 @@ App.AddServiceController = App.WizardController.extend({ }, sendInstallServicesRequest: function (callback) { - var name; - var data; - var clusterName = this.get('content.cluster.name'); console.log('failedHostComponents', this.get('failedHostComponents')); - name = 'wizard.install_services.installer_controller.is_retry'; - data = { - "RequestInfo": { - "context" : Em.I18n.t('requestInfo.installComponents'), - "query": "HostRoles/component_name.in(" + this.get('failedHostComponents').join(',') + ")" + var name = 'common.host_components.update'; + var data = { + "context" : Em.I18n.t('requestInfo.installComponents'), + "query": "HostRoles/component_name.in(" + this.get('failedHostComponents').join(',') + ")", + "HostRoles": { + "state": "INSTALLED" }, - "Body": { - "HostRoles": { - "state": "INSTALLED" - } - } + "urlParams": "HostRoles/state=INSTALLED" }; - data = JSON.stringify(data); - this.installServicesRequest(clusterName, name, data, callback); + this.installServicesRequest(name, data, callback); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/service/reassign/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index 5087c9b..b809f05 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -383,7 +383,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro var hostName = this.get('content.reassignHosts.source'); for (var i = 0; i < hostComponents.length; i++) { App.ajax.send({ - name: 'reassign.remove_component', + name: 'common.delete.host_component', sender: this, data: { hostName: hostName, http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/main/service/reassign/step6_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step6_controller.js b/ambari-web/app/controllers/main/service/reassign/step6_controller.js index ddc2024..a189a27 100644 --- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step6_controller.js @@ -101,7 +101,7 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro var hostName = this.get('content.reassignHosts.source'); for (var i = 0; i < hostComponents.length; i++) { App.ajax.send({ - name: 'reassign.remove_component', + name: 'common.delete.host_component', sender: this, data: { hostName: hostName, http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index 2cb6d6b..b48b6d9 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -315,26 +315,26 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, { // clear requests since we are installing services // and we don't want to get tasks for previous install attempts this.set('content.cluster.oldRequestsId', []); - var clusterName = this.get('content.cluster.name'); var data; - var name; callback = callback || Em.K; if (isRetry) { - name = 'wizard.install_services.installer_controller.is_retry'; - data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installComponents') + '"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}'; - } - else { - name = 'wizard.install_services.installer_controller.not_is_retry'; - data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'; + data = { + context: Em.I18n.t('requestInfo.installComponents'), + HostRoles: {"state": "INSTALLED"}, + urlParams: "HostRoles/state=INSTALLED" + } + } else { + data = { + context: Em.I18n.t('requestInfo.installServices'), + ServiceInfo: {"state": "INSTALLED"}, + urlParams: "ServiceInfo/state=INIT" + } } App.ajax.send({ - name: name, + name: isRetry ? 'common.host_components.update' : 'common.services.update', sender: this, - data: { - data: data, - cluster: clusterName - }, + data: data, success: 'installServicesSuccessCallback', error: 'installServicesErrorCallback' }).then(callback, callback); http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index 5f438e3..d4ef1e0 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -1027,9 +1027,13 @@ App.WizardStep8Controller = Em.Controller.extend({ name: 'wizard.step8.create_cluster', data: { data: JSON.stringify({ "Clusters": {"version": stackVersion }}) - } + }, + success: 'createClusterSuccess' }); + }, + createClusterSuccess: function(data, xhr, params) { + App.set('clusterName', params.cluster) }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/controllers/wizard/step9_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js index b12eef0..d9300c4 100644 --- a/ambari-web/app/controllers/wizard/step9_controller.js +++ b/ambari-web/app/controllers/wizard/step9_controller.js @@ -461,60 +461,48 @@ App.WizardStep9Controller = Em.Controller.extend({ launchStartServices: function (callback) { var data = {}; var name = ''; - var servicesList = []; callback = callback || Em.K; - if (this.get('content.controllerName') === 'addHostController') { - name = 'wizard.step9.add_host.launch_start_services'; - var hostnames = []; - for (var hostname in this.get('wizardController').getDBProperty('hosts')) { - if(this.get('hosts').findProperty('name', hostname)){ - hostnames.push(hostname); + switch(this.get('content.controllerName')) { + case 'addHostController': + name = 'common.host_components.update'; + var hostnames = []; + for (var hostname in this.get('wizardController').getDBProperty('hosts')) { + if(this.get('hosts').findProperty('name', hostname)){ + hostnames.push(hostname); + } } - } - data = { - "RequestInfo": { + data = { "context": Em.I18n.t("requestInfo.startHostComponents"), - "query": "HostRoles/component_name.in(" + App.get('components.slaves').join(',') + ")&HostRoles/state=INSTALLED&HostRoles/host_name.in(" + hostnames.join(',') + ")" - }, - "Body": { + "query": "HostRoles/component_name.in(" + App.get('components.slaves').join(',') + ")&HostRoles/state=INSTALLED&HostRoles/host_name.in(" + hostnames.join(',') + ")", "HostRoles": { "state": "STARTED" } - } - }; - } else if (this.get('content.controllerName') === 'addServiceController') { - servicesList = this.get('content.services').filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName'); - name = 'wizard.step9.add_service.launch_start_services'; - data = { - "RequestInfo": { - "context": Em.I18n.t("requestInfo.startAddedServices") - }, - "Body": { - "ServiceInfo": { "state": "STARTED" } - } - }; - } else { - name = 'wizard.step9.installer.launch_start_services'; - data = { - "RequestInfo": { - "context": Em.I18n.t("requestInfo.startServices") - }, - "Body": { - "ServiceInfo": { "state": "STARTED" } - } - }; + }; + break; + case 'addServiceController': + var servicesList = this.get('content.services').filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName').join(","); + name = 'common.services.update'; + data = { + "context": Em.I18n.t("requestInfo.startAddedServices"), + "ServiceInfo": { "state": "STARTED" }, + "urlParams": "ServiceInfo/state=INSTALLED&ServiceInfo/service_name.in(" + servicesList + ")¶ms/reconfigure_client=false" + }; + break; + default: + name = 'common.services.update'; + data = { + "context": Em.I18n.t("requestInfo.startServices"), + "ServiceInfo": { "state": "STARTED" }, + "urlParams": "ServiceInfo/state=INSTALLED¶ms/run_smoke_test=true¶ms/reconfigure_client=false" + }; } - data = JSON.stringify(data); - if (App.testMode) { + + if (App.get('testMode')) { this.set('numPolls', 6); } return App.ajax.send({ name: name, sender: this, - data: { - data: data, - cluster: this.get('content.cluster.name'), - servicesList: servicesList // used only for Add Service wizard - }, + data: data, success: 'launchStartServicesSuccessCallback', error: 'launchStartServicesErrorCallback' }).then(callback, callback); http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/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 72b7dd1..bbb21bf 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -76,7 +76,7 @@ var urls = { } }, - 'common.host_components.update': { + 'common.host.host_components.update': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components?{urlParams}', 'mock': '', 'type': 'PUT', @@ -100,8 +100,8 @@ var urls = { } }, - 'common.host_component.update': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'common.host.host_component.update': { + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?{urlParams}', 'mock': '/data/wizard/deploy/poll_1.json', 'type': 'PUT', 'format': function (data) { @@ -124,6 +124,39 @@ var urls = { } }, + 'common.host_components.update': { + 'real': '/clusters/{clusterName}/host_components?{urlParams}', + 'mock': '/data/wizard/deploy/poll_1.json', + 'type': 'PUT', + 'format': function (data) { + return { + data: JSON.stringify({ + RequestInfo: { + "context": data.context, + "operation_level": { + level: "CLUSTER", + cluster_name: data.clusterName + }, + query: data.query + }, + Body: { + "HostRoles": data.HostRoles + } + }) + } + } + }, + + 'common.delete.host': { + 'real': '/clusters/{clusterName}/hosts/{hostName}', + 'type': 'DELETE' + }, + + 'common.delete.host_component': { + 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', + 'type': 'DELETE' + }, + 'alerts.get_by_service': { 'real': '/clusters/{clusterName}/services/{serviceName}?fields=alerts', 'mock': '/data/alerts/HDP2/service_alerts.json' @@ -222,12 +255,6 @@ var urls = { } } }, - 'reassign.remove_component': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', - 'mock': '', - 'type': 'DELETE' - }, - 'reassign.load_configs': { 'real': '/clusters/{clusterName}/configurations?{urlParams}', 'mock': '' @@ -346,26 +373,6 @@ var urls = { 'mock': '/data/configurations/host_level_overrides_configs.json?{params}' }, - 'host.host_component.delete': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', - 'mock': '', - 'format': function() { - return { - type: 'DELETE' - } - } - }, - - 'host.host_components.delete': { - 'real': '/clusters/{clusterName}/hosts/{hostName}', - 'mock': '', - 'format': function() { - return { - type: 'DELETE' - } - } - }, - 'host.host_component.add_new_component': { 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}', 'mock': '/data/wizard/deploy/poll_1.json', @@ -377,17 +384,6 @@ var urls = { } }, - 'host.host_component.install_new_component': { - 'real': '/clusters/{clusterName}/host_components?HostRoles/host_name={hostName}\&HostRoles/component_name={componentName}\&HostRoles/state=INIT', - 'mock': '/data/wizard/deploy/poll_1.json', - 'format': function(data) { - return { - type: 'PUT', - data: data.data - } - } - }, - 'host.host_component.slave_desired_admin_state': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}/?fields=HostRoles/desired_admin_state', 'mock': '' @@ -479,11 +475,6 @@ var urls = { } }, - 'host.delete': { - 'real': '/clusters/{clusterName}/hosts/{hostName}', - 'mock': '', - 'type': 'DELETE' - }, 'hosts.metrics': { 'real': '/clusters/{clusterName}/hosts?fields={metricName}', 'mock': '/data/cluster_metrics/cpu_1hr.json' @@ -824,7 +815,6 @@ var urls = { 'cluster.load_repositories': { 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems?fields=repositories/*', 'mock': '', - 'type': 'GET', 'format': function (data) { return { data: data.data @@ -833,13 +823,11 @@ var urls = { }, 'admin.high_availability.polling': { 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/*,Requests/*', - 'mock': '', - 'type': 'GET' + 'mock': '' }, 'admin.high_availability.getNnCheckPointStatus': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE', - 'mock': '', - 'type': 'GET' + 'mock': '' }, 'admin.high_availability.getJnCheckPointStatus': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics', @@ -883,8 +871,7 @@ var urls = { }, 'admin.high_availability.load_configs': { 'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})', - 'mock': '', - 'type': 'GET' + 'mock': '' }, 'admin.high_availability.save_configs': { 'real': '/clusters/{clusterName}', @@ -907,13 +894,7 @@ var urls = { }, 'admin.high_availability.load_hbase_configs': { 'real': '/clusters/{clusterName}/configurations?type=hbase-site&tag={hbaseSiteTag}', - 'mock': '', - 'type': 'GET' - }, - 'admin.delete_component': { - 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', - 'mock': '', - 'type': 'DELETE' + 'mock': '' }, 'admin.security.cluster_configs': { 'real': '/clusters/{clusterName}', @@ -924,11 +905,6 @@ var urls = { }; } }, - 'admin.delete_host': { - 'real': '/clusters/{clusterName}/hosts/{hostName}', - 'mock': '', - 'type': 'DELETE' - }, 'admin.get.all_configurations': { 'real': '/clusters/{clusterName}/configurations?{urlParams}', 'mock': '', @@ -1026,55 +1002,6 @@ var urls = { } } }, - 'wizard.install_services.add_host_controller.is_retry': { - 'real': '/clusters/{cluster}/host_components', - 'mock': '', - 'format': function (data) { - return { - type: 'PUT', - data: data.data - }; - } - }, - 'wizard.install_services.add_host_controller.not_is_retry': { - 'real': '/clusters/{cluster}/host_components', - 'mock': '', - 'format': function(data) { - return { - type: 'PUT', - data: data.data - }; - } - }, - 'wizard.install_services.installer_controller.is_retry': { - 'real': '/clusters/{cluster}/host_components?HostRoles/state=INSTALLED', - 'mock': '/data/wizard/deploy/2_hosts/poll_1.json', - 'type': 'PUT', - 'format': function (data) { - return { - data: data.data - }; - } - }, - 'wizard.install_services.installer_controller.not_is_retry': { - 'real': '/clusters/{cluster}/services?ServiceInfo/state=INIT', - 'mock': '/data/wizard/deploy/2_hosts/poll_1.json', - 'type': 'PUT', - 'format': function (data) { - return { - data: data.data - }; - } - }, - 'wizard.install_services.add_service_controller.get_failed_host_components': { - 'real': '/clusters/{clusterName}/host_components?fields=HostRoles/state,component/ServiceComponentInfo/service_name', - 'mock': '', - 'format': function() { - return { - async: false - }; - } - }, 'wizard.service_components': { 'real': '{stackUrl}/services?fields=StackServices/comments,StackServices/service_version,serviceComponents/*', 'mock': '/data/stacks/HDP-2.1/service_components.json', @@ -1094,51 +1021,11 @@ var urls = { }; } }, - 'wizard.step9.installer.launch_start_services': { - 'real': '/clusters/{cluster}/services?ServiceInfo/state=INSTALLED¶ms/run_smoke_test=true¶ms/reconfigure_client=false', - 'mock': '/data/wizard/deploy/5_hosts/poll_6.json', - 'format': function (data) { - var d = { - type: 'PUT', - data: data.data - }; - if (App.get('testMode')) { - d.type = 'GET'; - } - return d; - } - }, - 'wizard.step9.add_service.launch_start_services': { - 'real': '/clusters/{cluster}/services?ServiceInfo/state=INSTALLED&ServiceInfo/service_name.in({servicesList})¶ms/reconfigure_client=false', - 'mock': '/data/wizard/deploy/5_hosts/poll_6.json', - 'format': function (data) { - var d = { - type: 'PUT', - data: data.data - }; - if (App.get('testMode')) { - d.type = 'GET'; - } - return d; - } - }, - 'wizard.step9.add_host.launch_start_services': { - 'real': '/clusters/{cluster}/host_components', - 'mock': '/data/wizard/deploy/5_hosts/poll_6.json', - 'format': function (data) { - return { - type: 'PUT', - data: data.data - }; - } - }, - 'wizard.step9.load_log': { 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/Tasks/command,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true', 'mock': '/data/wizard/deploy/5_hosts/poll_{numPolls}.json', 'format': function () { return { - type: 'GET', dataType: 'text' }; } @@ -1649,53 +1536,6 @@ var urls = { 'type': 'POST' }, - 'bulk_request.host_components': { - 'real': '/clusters/{clusterName}/host_components', - 'mock': '', - 'format': function(data) { - return { - type: 'PUT', - data: JSON.stringify({ - RequestInfo: { - context: data.requestInfo, - query: 'HostRoles/component_name=' + data.componentName + '&HostRoles/host_name.in(' + data.hostNames + ')&HostRoles/maintenance_state=OFF' - }, - Body: { - HostRoles: { - state: data.state - } - } - }) - } - } - }, - - 'bulk_request.hosts.all_components': { - 'real': '/clusters/{clusterName}/host_components', - 'mock': '', - 'format': function(data) { - return { - type: 'PUT', - data: JSON.stringify({ - RequestInfo: { - context: data.requestInfo, - query: data.query, - operation_level: { - level: "HOST", - cluster_name: data.clusterName, - host_name: data.hostName - } - }, - Body: { - HostRoles: { - state: data.state - } - } - }) - } - } - }, - 'bulk_request.decommission': { 'real' : '/clusters/{clusterName}/requests', 'mock' : '', @@ -1706,7 +1546,11 @@ var urls = { 'RequestInfo': { 'context': data.context, 'command': 'DECOMMISSION', - 'parameters': data.parameters + 'parameters': data.parameters, + 'operation_level': { + 'level': "CLUSTER", + 'cluster_name': data.clusterName + } }, "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}] }) http://git-wip-us.apache.org/repos/asf/ambari/blob/84e13aab/ambari-web/app/views/main/host/summary.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js index 443061f..a7fc43a 100644 --- a/ambari-web/app/views/main/host/summary.js +++ b/ambari-web/app/views/main/host/summary.js @@ -262,7 +262,7 @@ App.MainHostSummaryView = Em.View.extend({ addableToHostComponents.forEach(function(addableComponent) { if(installedServices.contains(componentServiceMap[addableComponent]) && !installedComponents.contains(addableComponent)) { - components.pushObject(self.addableComponentObject.create({'componentName': addableComponent})); + components.pushObject(self.addableComponentObject.create({'componentName': addableComponent, 'serviceName': componentServiceMap[addableComponent]})); } }); if (installableClients.length > 0) {