AMBARI-9725 Add Hive Metastore component doesn't work on hosts details page.(ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9bcc3527 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9bcc3527 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9bcc3527 Branch: refs/heads/trunk Commit: 9bcc3527768085a9daf2653a4d4b18f390fc6c21 Parents: 3ccdd98 Author: aBabiichuk <[email protected]> Authored: Fri Feb 20 16:37:45 2015 +0200 Committer: aBabiichuk <[email protected]> Committed: Fri Feb 20 16:37:45 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 36 ++++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9bcc3527/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 27c3c84..3adb742 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -347,7 +347,7 @@ App.MainHostDetailsController = Em.Controller.extend({ /** * Remove host component data from App.HostComponent model. - * + * * @param {String} componentName * @param {String} hostName */ @@ -355,7 +355,7 @@ App.MainHostDetailsController = Em.Controller.extend({ var component = App.HostComponent.find().filterProperty('componentName', componentName).findProperty('hostName', hostName); App.serviceMapper.deleteRecord(component); }, - + /** * Send command to server to upgrade selected host component * @param {object} event @@ -444,7 +444,7 @@ App.MainHostDetailsController = Em.Controller.extend({ var returnFunc, self = this, - hiveHost = event.hiveMetastoreHost ? event.hiveMetastoreHost : ""; + hiveHost = event.hiveMetastoreHost ? event.hiveMetastoreHost : this.get('content.hostName'); component = event.context, componentName = component.get('componentName'), missedComponents = !!hiveHost ? [] : componentsUtils.checkComponentDependencies(componentName, { @@ -466,8 +466,10 @@ App.MainHostDetailsController = Em.Controller.extend({ }, Em.I18n.t('hosts.host.addComponent.' + componentName )); break; case 'HIVE_METASTORE': - this.set('hiveMetastoreHost',hiveHost); - this.loadConfigs("loadHiveConfigs"); + returnFunc = App.showConfirmationPopup(function () { + self.set('hiveMetastoreHost', hiveHost); + self.loadConfigs("loadHiveConfigs"); + }, Em.I18n.t('hosts.host.addComponent.' + componentName )); break; default: returnFunc = this.addClientComponent(component); @@ -684,13 +686,12 @@ App.MainHostDetailsController = Em.Controller.extend({ /** * save configs' sites in batch + * @param hiveMetastoreHost * @param groups */ saveConfigsBatch: function (groups, hiveMetastoreHost) { groups.forEach(function (group) { - var - self = this, - desiredConfigs = [], + var desiredConfigs = [], tag = 'version' + (new Date).getTime(), properties = group.properties; @@ -709,16 +710,29 @@ App.MainHostDetailsController = Em.Controller.extend({ name: 'common.service.configurations', sender: this, data: { - desired_config: desiredConfigs + desired_config: desiredConfigs, + hiveMetastoreHost: hiveMetastoreHost }, - defaultSuccessCallback: function () {}, - success: !!hiveMetastoreHost ? componentsUtils.installHostComponent(hiveMetastoreHost, App.StackServiceComponent.find("HIVE_METASTORE")) : this.defaultSuccessCallback + success: 'installHiveMetastore' }); } + //clear hive metastore host not to send second request to install component + hiveMetastoreHost = null; }, this); }, /** + * success callback for saveConfigsBatch method + * @param data + * @param opt + * @param params + */ + installHiveMetastore: function(data, opt, params) { + if (params.hiveMetastoreHost) { + componentsUtils.installHostComponent(params.hiveMetastoreHost, App.StackServiceComponent.find("HIVE_METASTORE")); + } + }, + /** * Delete Hive Metastore is performed * @type {bool} */
