Updated Branches: refs/heads/trunk 5366b1d70 -> 150f949aa
AMBARI-3509. Reassign Master: Restart services should be the part of Reassign master wizard. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/150f949a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/150f949a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/150f949a Branch: refs/heads/trunk Commit: 150f949aaab21428c9770ee376b1285460f0c894 Parents: 5366b1d Author: Aleksandr Kovalenko <[email protected]> Authored: Mon Oct 14 17:49:40 2013 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Mon Oct 14 17:49:40 2013 +0300 ---------------------------------------------------------------------- .../main/service/reassign/step4_controller.js | 54 +++++------------- .../main/service/reassign/step6_controller.js | 59 ++++++++++++++------ ambari-web/app/messages.js | 10 ++-- ambari-web/app/utils/ajax.js | 57 ++++++++++--------- 4 files changed, 89 insertions(+), 91 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/150f949a/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 3b8449a..d49def9 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -30,15 +30,12 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro hostComponents: [], - serviceNames: [], - loadStep: function () { if (this.get('content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) { this.get('hostComponents').pushObjects(['NAMENODE', 'ZKFC']); } else { this.get('hostComponents').pushObject(this.get('content.reassign.component_name')); } - this.get('serviceNames').pushObject(this.get('content.reassign.service_id')); this._super(); }, @@ -46,17 +43,14 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro var commands = this.get('commands'); var currentStep = App.router.get('reassignMasterController.currentStep'); var hostComponentsNames = ''; - var serviceNames = ''; + this.get('hostComponents').forEach(function (comp, index) { hostComponentsNames += index ? ', ' : ''; hostComponentsNames += App.format.role(comp); }, this); - this.get('serviceNames').forEach(function (service, index) { - serviceNames += index ? ', ' : ''; - serviceNames += App.Service.find().findProperty('serviceName', service).get('displayName'); - }, this); + for (var i = 0; i < commands.length; i++) { - var title = Em.I18n.t('services.reassign.step4.task' + i + '.title').format(hostComponentsNames, serviceNames); + var title = Em.I18n.t('services.reassign.step4.task' + i + '.title').format(hostComponentsNames); this.get('tasks').pushObject(Ember.Object.create({ title: title, status: 'PENDING', @@ -92,21 +86,12 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro }, stopServices: function () { - this.set('multiTaskCounter', 0); - var serviceNames = this.get('serviceNames'); - for (var i = 0; i < serviceNames.length; i++) { - App.ajax.send({ - name: 'reassign.stop_service', - sender: this, - data: { - serviceName: serviceNames[i], - displayName: App.Service.find().findProperty('serviceName', serviceNames[i]).get('displayName'), - taskNum: serviceNames.length - }, - success: 'startPolling', - error: 'onTaskError' - }); - } + App.ajax.send({ + name: 'reassign.stop_services', + sender: this, + success: 'startPolling', + error: 'onTaskError' + }); }, createHostComponents: function () { @@ -294,21 +279,12 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro }, startServices: function () { - this.set('multiTaskCounter', 0); - var serviceNames = this.get('serviceNames'); - for (var i = 0; i < serviceNames.length; i++) { - App.ajax.send({ - name: 'reassign.start_components', - sender: this, - data: { - serviceName: serviceNames[i], - displayName: App.Service.find().findProperty('serviceName', serviceNames[i]).get('displayName'), - taskNum: serviceNames.length - }, - success: 'startPolling', - error: 'onTaskError' - }); - } + App.ajax.send({ + name: 'reassign.start_services', + sender: this, + success: 'startPolling', + error: 'onTaskError' + }); }, deleteHostComponents: function () { http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/150f949a/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 4d5a624..db0ab41 100644 --- a/ambari-web/app/controllers/main/service/reassign/step6_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step6_controller.js @@ -26,12 +26,29 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro clusterDeployState: 'REASSIGN_MASTER_INSTALLING', + multiTaskCounter: 0, + + hostComponents: [], + + loadStep: function () { + if (this.get('content.reassign.component_name') === 'NAMENODE' && !App.HostComponent.find().someProperty('componentName', 'SECONDARY_NAMENODE')) { + this.get('hostComponents').pushObjects(['NAMENODE', 'ZKFC']); + } else { + this.get('hostComponents').pushObject(this.get('content.reassign.component_name')); + } + this._super(); + }, + initializeTasks: function () { var commands = this.get('commands'); + var hostComponentsNames = ''; + this.get('hostComponents').forEach(function (comp, index) { + hostComponentsNames += index ? ', ' : ''; + hostComponentsNames += App.format.role(comp); + }, this); var currentStep = App.router.get('reassignMasterController.currentStep'); for (var i = 0; i < commands.length; i++) { - var title = Em.I18n.t('services.reassign.step6.task' + i + '.title').format(App.format.role(this.get('content.reassign.component_name')), - App.Service.find().findProperty('serviceName', this.get('content.reassign.service_id')).get('displayName')); + var title = Em.I18n.t('services.reassign.step6.task' + i + '.title').format(hostComponentsNames); this.get('tasks').pushObject(Ember.Object.create({ title: title, status: 'PENDING', @@ -55,31 +72,37 @@ App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageContro } }.observes('[email protected]'), + onComponentsTasksSuccess: function () { + this.set('multiTaskCounter', this.get('multiTaskCounter') + 1); + if (this.get('multiTaskCounter') >= this.get('hostComponents').length) { + this.onTaskCompleted(); + } + }, + startServices: function () { - var serviceName = this.get('content.reassign.service_id'); App.ajax.send({ - name: 'reassign.start_components', + name: 'reassign.start_services', sender: this, - data: { - serviceName: serviceName, - displayName: App.Service.find().findProperty('serviceName', serviceName).get('displayName') - }, success: 'startPolling', error: 'onTaskError' }); }, deleteHostComponents: function () { + this.set('multiTaskCounter', 0); + var hostComponents = this.get('hostComponents'); var hostName = this.get('content.reassignHosts.source'); - App.ajax.send({ - name: 'reassign.remove_component', - sender: this, - data: { - hostName: hostName, - componentName: this.get('content.reassign.component_name') - }, - success: 'onTaskCompleted', - error: 'onTaskError' - }); + for (var i = 0; i < hostComponents.length; i++) { + App.ajax.send({ + name: 'reassign.remove_component', + sender: this, + data: { + hostName: hostName, + componentName: hostComponents[i] + }, + success: 'onComponentsTasksSuccess', + error: 'onTaskError' + }); + } } }) http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/150f949a/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 944c64e..9117048 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1076,13 +1076,13 @@ Em.I18n.translations = { 'services.reassign.step3.sourceHost':'Source Host:', 'services.reassign.step3.component':'Component name:', 'services.reassign.step4.header':'Install, Start and Test', - 'services.reassign.step4.task0.title':'{1} stop', + 'services.reassign.step4.task0.title':'Stop All Services', 'services.reassign.step4.task1.title':'{0} create', 'services.reassign.step4.task2.title':'{0} disable', - 'services.reassign.step4.task3.title':'{1} reconfigure', + 'services.reassign.step4.task3.title':'{0} reconfigure', 'services.reassign.step4.task4.title':'{0} install', - 'services.reassign.step4.task5.title':'{1} remove', - 'services.reassign.step4.task6.title':'{0} start', + 'services.reassign.step4.task5.title':'{0} remove', + 'services.reassign.step4.task6.title':'Start All Services', 'services.reassign.step4.status.success': 'Successfully reassigned {0}', 'services.reassign.step4.status.success.withManualSteps': 'Proceed to the next step', 'services.reassign.step4.status.failed': 'Failed to reassign {0}', @@ -1112,7 +1112,7 @@ Em.I18n.translations = { '</ol>', 'services.reassign.step6.header': 'Install, Start and Test', 'services.reassign.step6.task0.title':'{0} remove', - 'services.reassign.step6.task1.title':'{1} start', + 'services.reassign.step6.task1.title':'Start All Services', 'services.reassign.step6.status.success': 'Successfully reassigned {0}', 'services.reassign.step6.status.failed': 'Failed to reassign {0}', 'services.reassign.step6.status.info': 'Reassigning {0}. \nPlease wait while all tasks will be completed.', http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/150f949a/ambari-web/app/utils/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js index d55f372..99c425a 100644 --- a/ambari-web/app/utils/ajax.js +++ b/ambari-web/app/utils/ajax.js @@ -78,18 +78,18 @@ var urls = { }; } }, - 'reassign.stop_service': { - 'mock': '/data/wizard/reassign/request_id.json', - 'real': '/clusters/{clusterName}/services/{serviceName}', - 'type': 'PUT', - 'format': function (data) { + 'reassign.stop_services': { + 'real': '/clusters/{clusterName}/services?ServiceInfo/state=STARTED', + 'mock': '', + 'format': function (data, opt) { return { + type: 'PUT', data: JSON.stringify({ - RequestInfo: { - "context": "Stop service " + data.displayName + "RequestInfo": { + "context": "Stop all services" }, - Body: { - ServiceInfo: { + "Body": { + "ServiceInfo": { "state": "INSTALLED" } } @@ -97,7 +97,25 @@ var urls = { } } }, - + 'reassign.start_services': { + 'real': '/clusters/{clusterName}/services?ServiceInfo/state=INSTALLED¶ms/run_smoke_test=true', + 'mock': '', + 'format': function (data, opt) { + return { + type: 'PUT', + data: JSON.stringify({ + "RequestInfo": { + "context": "Start all services" + }, + "Body": { + "ServiceInfo": { + "state": "STARTED" + } + } + }) + } + } + }, 'reassign.maintenance_mode': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', 'mock': '', @@ -114,25 +132,6 @@ var urls = { } } }, - 'reassign.start_components': { - 'mock': '/data/wizard/reassign/request_id.json', - 'real': '/clusters/{clusterName}/services/{serviceName}', - 'type': 'PUT', - 'format': function (data) { - return { - data: JSON.stringify({ - RequestInfo: { - "context": "Start service " + data.displayName - }, - Body: { - ServiceInfo: { - "state": "STARTED" - } - } - }) - } - } - }, 'reassign.remove_component': { 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}', 'mock': '',
