You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2013/10/21 14:48:31 UTC
git commit: AMBARI-3564. Separate "installServices" for each wizard
that uses it. (onechiporenko)
Updated Branches:
refs/heads/trunk 0321de69c -> 7f27602af
AMBARI-3564. Separate "installServices" for each wizard that uses it. (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/7f27602a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/7f27602a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/7f27602a
Branch: refs/heads/trunk
Commit: 7f27602af59a4f8259f7a74710b2b90b038f73e8
Parents: 0321de6
Author: Oleg Nechiporenko <cv...@yahoo.com>
Authored: Mon Oct 21 15:42:06 2013 +0300
Committer: Oleg Nechiporenko <cv...@yahoo.com>
Committed: Mon Oct 21 15:42:06 2013 +0300
----------------------------------------------------------------------
.../app/controllers/main/host/add_controller.js | 38 +++++++
.../controllers/main/service/add_controller.js | 72 +++++++++++++
ambari-web/app/controllers/wizard.js | 103 ++-----------------
3 files changed, 118 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7f27602a/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 d4a4de0..b2ee740 100644
--- a/ambari-web/app/controllers/main/host/add_controller.js
+++ b/ambari-web/app/controllers/main/host/add_controller.js
@@ -338,6 +338,44 @@ App.AddHostController = App.WizardController.extend({
this.clearStorageData();
App.router.get('updateController').updateAll();
App.updater.immediateRun('updateHost');
+ },
+
+ installServices: function (isRetry) {
+ this.set('content.cluster.oldRequestsId', []);
+ var clusterName = this.get('content.cluster.name');
+ var data;
+ var name;
+ var hostnames = [];
+ for (var hostname in App.db.getHosts()) {
+ hostnames.push(hostname);
+ }
+
+ if (isRetry) {
+ name = 'wizard.install_services.add_host_controller.is_retry';
+ }
+ else {
+ name = 'wizard.install_services.add_host_controller.not_is_retry';
+ }
+ data = {
+ "RequestInfo": {
+ "context": Em.I18n.t('requestInfo.installComponents'),
+ "query": "HostRoles/host_name.in(" + hostnames.join(',') + ")"
+ },
+ "Body": {
+ "HostRoles": {"state": "INSTALLED"}
+ }
+ };
+ data = JSON.stringify(data);
+ App.ajax.send({
+ name: name,
+ sender: this,
+ data: {
+ data: data,
+ cluster: clusterName
+ },
+ success: 'installServicesSuccessCallback',
+ error: 'installServicesErrorCallback'
+ });
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7f27602a/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 9a37bfb..3d1dbb8 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -408,6 +408,78 @@ App.AddServiceController = App.WizardController.extend({
this.clearAllSteps();
this.clearStorageData();
App.router.get('updateController').updateAll();
+ },
+
+ installServices: function (isRetry) {
+ this.set('content.cluster.oldRequestsId', []);
+ var clusterName = this.get('content.cluster.name');
+ var data;
+ var name;
+ if (isRetry) {
+ this.getFailedHostComponents();
+ 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(',') + ")"
+ },
+ "Body": {
+ "HostRoles": {
+ "state": "INSTALLED"
+ }
+ }
+ };
+ data = JSON.stringify(data);
+ }
+ else {
+ name = 'wizard.install_services.installer_controller.not_is_retry';
+ data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}';
+ }
+ App.ajax.send({
+ name: name,
+ sender: this,
+ data: {
+ data: data,
+ cluster: clusterName
+ },
+ success: 'installServicesSuccessCallback',
+ error: 'installServicesErrorCallback'
+ });
+ },
+
+ /**
+ * List of failed to install HostComponents while adding Service
+ */
+ failedHostComponents: [],
+
+ getFailedHostComponents: function() {
+ App.ajax.send({
+ name: 'wizard.install_services.add_service_controller.get_failed_host_components',
+ sender: this,
+ success: 'getFailedHostComponentsSuccessCallback',
+ error: 'getFailedHostComponentsErrorCallback'
+ });
+ },
+
+ /**
+ * Parse all failed components and filter out installed earlier components (based on selected to install services)
+ * @param {Object} json
+ */
+ getFailedHostComponentsSuccessCallback: function(json) {
+ var allFailed = json.items.filterProperty('HostRoles.state', 'INSTALL_FAILED');
+ var currentFailed = [];
+ var selectedServices = App.db.getService().filterProperty('isInstalled', false).filterProperty('isSelected', true).mapProperty('serviceName');
+ allFailed.forEach(function(failed) {
+ if (selectedServices.contains(failed.component[0].ServiceComponentInfo.service_name)) {
+ currentFailed.push(failed.HostRoles.component_name);
+ }
+ });
+ this.set('failedHostComponents', currentFailed);
+ },
+
+ getFailedHostComponentsErrorCallback: function(request, ajaxOptions, error) {
+ console.warn(error);
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/7f27602a/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 65e44a9..583793e 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -260,66 +260,13 @@ App.WizardController = Em.Controller.extend({
var clusterName = this.get('content.cluster.name');
var data;
var name;
-
- switch (this.get('content.controllerName')) {
- case 'addHostController':
-
- var hostnames = [];
- for (var hostname in App.db.getHosts()) {
- hostnames.push(hostname);
- }
-
- if (isRetry) {
- name = 'wizard.install_services.add_host_controller.is_retry';
- }
- else {
- name = 'wizard.install_services.add_host_controller.not_is_retry';
- }
- data = {
- "RequestInfo": {
- "context": Em.I18n.t('requestInfo.installComponents'),
- "query": "HostRoles/host_name.in(" + hostnames.join(',') + ")"
- },
- "Body": {
- "HostRoles": {"state": "INSTALLED"}
- }
- };
- data = JSON.stringify(data);
- break;
- case 'addServiceController':
- if (isRetry) {
- this.getFailedHostComponents();
- 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(',') + ")"
- },
- "Body": {
- "HostRoles": {
- "state": "INSTALLED"
- }
- }
- };
- data = JSON.stringify(data);
- }
- else {
- name = 'wizard.install_services.installer_controller.not_is_retry';
- data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.installServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}';
- }
- break;
- case 'installerController':
- default:
- 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"}}}';
- }
- break;
+ 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"}}}';
}
App.ajax.send({
@@ -334,40 +281,6 @@ App.WizardController = Em.Controller.extend({
});
},
- /**
- * List of failed to install HostComponents while adding Service
- */
- failedHostComponents: [],
-
- getFailedHostComponents: function() {
- App.ajax.send({
- name: 'wizard.install_services.add_service_controller.get_failed_host_components',
- sender: this,
- success: 'getFailedHostComponentsSuccessCallback',
- error: 'getFailedHostComponentsErrorCallback'
- });
- },
-
- /**
- * Parse all failed components and filter out installed earlier components (based on selected to install services)
- * @param {Object} json
- */
- getFailedHostComponentsSuccessCallback: function(json) {
- var allFailed = json.items.filterProperty('HostRoles.state', 'INSTALL_FAILED');
- var currentFailed = [];
- var selectedServices = App.db.getService().filterProperty('isInstalled', false).filterProperty('isSelected', true).mapProperty('serviceName');
- allFailed.forEach(function(failed) {
- if (selectedServices.contains(failed.component[0].ServiceComponentInfo.service_name)) {
- currentFailed.push(failed.HostRoles.component_name);
- }
- });
- this.set('failedHostComponents', currentFailed);
- },
-
- getFailedHostComponentsErrorCallback: function(request, ajaxOptions, error) {
- console.warn(error);
- },
-
installServicesSuccessCallback: function (jsonData) {
var installStartTime = new Date().getTime();
console.log("TRACE: In success function for the installService call");
@@ -806,4 +719,4 @@ App.WizardController = Em.Controller.extend({
App.db.setServiceConfigProperties(serviceConfigProperties);
this.set('content.serviceConfigProperties', serviceConfigProperties);
}
-})
+});
\ No newline at end of file