瀏覽代碼

AMBARI-3272. Reassign Master Wizard: remove Reconfigure step. (akovalenko)

Aleksandr Kovalenko 11 年之前
父節點
當前提交
f0fe1dcabc

+ 0 - 1
ambari-web/app/controllers.js

@@ -117,7 +117,6 @@ require('controllers/wizard/step10_controller');
 require('controllers/wizard/step11_controller');
 require('controllers/wizard/step12_controller');
 require('controllers/wizard/step13_controller');
-require('controllers/wizard/step14_controller');
 require('controllers/wizard/stack_upgrade/step1_controller');
 require('controllers/wizard/stack_upgrade/step2_controller');
 require('controllers/wizard/stack_upgrade/step3_controller');

+ 2 - 5
ambari-web/app/controllers/main/service/reassign_controller.js

@@ -23,7 +23,7 @@ App.ReassignMasterController = App.WizardController.extend({
 
   name: 'reassignMasterController',
 
-  totalSteps: 6,
+  totalSteps: 4,
 
   /**
    * Used for hiding back button in wizard
@@ -205,12 +205,9 @@ App.ReassignMasterController = App.WizardController.extend({
   loadAllPriorSteps: function () {
     var step = this.get('currentStep');
     switch (step) {
-      case '6':
-      case '5':
-        this.loadTasksStatuses();
       case '4':
+        this.loadTasksStatuses();
       case '3':
-        this.loadServiceConfigProperties();
       case '2':
         this.loadServicesFromServer();
         this.loadMasterComponentHosts();

+ 2 - 41
ambari-web/app/controllers/wizard/step12_controller.js

@@ -16,45 +16,6 @@
  * limitations under the License.
  */
 
-App.WizardStep12Controller = App.MainServiceInfoConfigsController.extend({
+var App = require('app');
 
-  modifiedConfigs: [],
-
-  afterLoad: function () {
-    if (this.get('dataIsLoaded')) {
-      this.get('stepConfigs').objectAt(0).get('configs').filterProperty('isEditable', false).setEach('isEditable', true);
-      this.get('stepConfigs').objectAt(0).get('configs').filterProperty('displayType', 'masterHost').setEach('isVisible', false);
-    }
-  }.observes('dataIsLoaded'),
-
-  addHostNamesToGlobalConfig: function () {
-    var hostComponents = [];
-    this.get('content.masterComponentHosts').forEach(function (component) {
-      hostComponents.push(Ember.Object.create({
-        componentName: component.component,
-        host: {hostName: component.hostName}
-      }))
-    });
-    this.set('content.hostComponents', hostComponents);
-    this._super();
-  },
-
-  submit: function () {
-    if (this.get('isSubmitDisabled')) {
-      return false;
-    }
-    var self = this;
-    this.get('modifiedConfigs').clear();
-    this.get('stepConfigs').objectAt(0).get('configs').forEach(function (config) {
-      if (config.get('defaultValue') !== config.get('value')) {
-        self.get('modifiedConfigs').push({
-          name: config.get('displayName'),
-          oldValue: config.get('defaultValue'),
-          value: config.get('value'),
-          unit: config.get('unit') || false
-        });
-      }
-    });
-    App.router.send('next');
-  }
-});
+App.WizardStep12Controller = Em.Controller.extend()

+ 885 - 1
ambari-web/app/controllers/wizard/step13_controller.js

@@ -18,4 +18,888 @@
 
 var App = require('app');
 
-App.WizardStep13Controller = Em.Controller.extend()
+App.WizardStep13Controller = Em.Controller.extend({
+
+  status: 'IN_PROGRESS',
+
+  onStatusChange: function () {
+    if (this.get('tasks').someProperty('status', 'FAILED')) {
+      this.set('status', 'FAILED');
+      if (this.get('tasks')[5].status == 'FAILED' || this.get('tasks')[6].status == 'FAILED') {
+        this.set('showRetry', true);
+      }
+    } else if (this.get('tasks').everyProperty('status', 'COMPLETED')) {
+      this.set('status', 'COMPLETED');
+      this.set('isSubmitDisabled', false);
+    } else {
+      this.set('status', 'IN_PROGRESS')
+    }
+    var statuses = this.get('tasks').mapProperty('status');
+    App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
+    App.clusterStatus.setClusterStatus({
+      clusterName: this.get('content.cluster.name'),
+      clusterState: 'REASSIGN_MASTER_INSTALLING',
+      wizardControllerName: this.get('content.controllerName'),
+      localdb: App.db.data
+    });
+    this.setTasksMessages();
+    this.navigateStep();
+  },
+
+  tasks: [],
+
+  /**
+   * Set messages for tasks depending on their status
+   */
+  setTasksMessages: function () {
+    var service = this.get('service.displayName');
+    var master = this.get('masterComponent.display_name');
+    if (this.get('isCohosted')) {
+      service = 'Hive, WebHCat';
+      master = Em.I18n.t('installer.step5.hiveGroup');
+    }
+    for (i = 0; i < this.get('tasks').length; i++) {
+      var status = this.get('tasks')[i].status.toLowerCase().replace('initialize', 'pending').replace('_', ' ');
+      if (i == 0 || i == 6) {
+        this.get('tasks')[i].set('message', Em.I18n.t('installer.step13.task' + i).format(service) + ' ' + status);
+      } else {
+        this.get('tasks')[i].set('message', Em.I18n.t('installer.step13.task' + i).format(master) + ' ' + status);
+      }
+    }
+  },
+
+  configs: [],
+  globals: [],
+  configMapping: App.config.get('configMapping').all(),
+  newConfigsTag: null,
+  createdConfigs: [],
+
+  currentRequestId: [],
+
+  isSubmitDisabled: true,
+
+  showRetry: false,
+
+  service: function () {
+    return App.Service.find().findProperty('serviceName', this.get('masterComponent.service_id'));
+  }.property('masterComponent'),
+
+  masterComponent: function () {
+    return this.get('content.reassign');
+  }.property('content.reassign'),
+
+  isCohosted: function () {
+    return this.get('masterComponent.component_name') == 'HIVE_SERVER';
+  }.property('masterComponent'),
+
+  loadStep: function () {
+    this.clearStep();
+    this.loadTasks();
+    this.addObserver('tasks.@each.status', this, 'onStatusChange');
+    this.onStatusChange();
+  },
+
+  clearStep: function () {
+    this.removeObserver('tasks.@each.status', this, 'onStatusChange');
+    this.removeObserver('createdConfigs.length', this, 'onCreateConfigsCompleted');
+    var tasks = [];
+    for (var i = 0; i < 8; i++) {
+      tasks.pushObject(Ember.Object.create({
+        status: 'INITIALIZE',
+        logs: '',
+        message: '',
+        progress: 0
+      }));
+    }
+    this.set('tasks', tasks);
+    this.set('createdConfigsCount', 0);
+    this.set('queueTasksCompleted', 0);
+    this.set('dataPollCounter', 1);
+    this.set('showRetry', false);
+    this.set('isSubmitDisabled', true);
+    this.get('configs').clear();
+    this.get('globals').clear();
+    this.get('createdConfigs').clear();
+  },
+
+  loadTasks: function () {
+    var statuses = this.get('content.tasksStatuses');
+    if (statuses) {
+      statuses.forEach(function (status, index) {
+        this.get('tasks')[index].status = status;
+      }, this)
+    }
+    var statusesForRequestId = ['PENDING', 'QUEUED', 'IN_PROGRESS'];
+    if (statusesForRequestId.contains(statuses[0]) || statusesForRequestId.contains(statuses[5]) || statusesForRequestId.contains(statuses[6])) {
+      this.set('currentRequestId', this.get('content.cluster.requestId'));
+      this.getLogsByRequest();
+    }
+  },
+
+  /**
+   * Run tasks in proper way
+   */
+  navigateStep: function () {
+    if (this.get('tasks')[0].status == 'INITIALIZE') {
+      this.stopService();
+    }
+    else if (this.taskIsReady(1)) {
+      this.createMasterComponent();
+    }
+    else if (this.taskIsReady(2)) {
+      this.createConfigs();
+    }
+    else if (this.taskIsReady(3)) {
+      this.applyConfigs();
+    }
+    else if (this.taskIsReady(4)) {
+      this.putInMaintenanceMode();
+    }
+    else if (this.taskIsReady(5)) {
+      this.installComponent();
+    }
+    else if (this.taskIsReady(6)) {
+      this.startComponents();
+    }
+    else if (this.taskIsReady(7)) {
+      this.removeComponent();
+    }
+  },
+
+  /**
+   * Determine preparedness to run task
+   * @param task
+   * @return {Boolean}
+   */
+  taskIsReady: function (task) {
+    if (this.get('tasks')[task].status != 'INITIALIZE') {
+      return false;
+    }
+    var tempArr = this.get('tasks').mapProperty('status').slice(0, task).uniq();
+    return tempArr.length == 1 && tempArr[0] == 'COMPLETED';
+  },
+
+  queueTasksCompleted: 0,
+
+  /**
+   * Change status of the task
+   * @param task
+   * @param status
+   */
+  setTasksStatus: function (task, status) {
+    if (status == 'COMPLETED' && this.get('isCohosted') && [1, 4, 7].contains(task) && this.get('queueTasksCompleted') < 2) {
+      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
+    } else {
+      this.get('tasks')[task].set('status', status);
+    }
+  },
+
+  saveClusterStatus: function (requestId, status) {
+    var clusterStatus = {
+      status: status,
+      requestId: requestId
+    };
+    App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
+  },
+
+  stopService: function () {
+    this.set('currentRequestId', []);
+    var serviceNames = [this.get('masterComponent.service_id')];
+    if (this.get('isCohosted')) {
+      serviceNames = ['HIVE', 'WEBHCAT'];
+    }
+    serviceNames.forEach(function (serviceName) {
+      App.ajax.send({
+        name: 'reassign.stop_service',
+        sender: this,
+        data: {
+          serviceName: serviceName,
+          displayName: App.Service.find().findProperty('serviceName', serviceName).get('displayName')
+        },
+        beforeSend: 'onStopServiceBeforeSend',
+        success: 'onStopServiceSuccess',
+        error: 'onStopServiceError'
+      });
+    }, this);
+  },
+
+  onStopServiceBeforeSend: function () {
+    this.setTasksStatus(0, 'PENDING');
+  },
+
+  onStopServiceSuccess: function (data) {
+    if (data) {
+      var requestId = data.Requests.id;
+      this.get('currentRequestId').push(requestId);
+      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
+      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 2) || !this.get('isCohosted')) {
+        this.getLogsByRequest();
+      }
+    } else {
+      this.setTasksStatus(0, 'FAILED');
+    }
+  },
+
+  onStopServiceError: function () {
+    this.setTasksStatus(0, 'FAILED');
+  },
+
+  createMasterComponent: function () {
+    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+    var componentNames = [this.get('masterComponent.component_name')];
+    if (this.get('isCohosted')) {
+      this.set('queueTasksCompleted', 0);
+      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+    }
+    componentNames.forEach(function (componentName) {
+      if (App.testMode) {
+        this.setTasksStatus(1, 'COMPLETED');
+      } else {
+        App.ajax.send({
+          name: 'reassign.create_master',
+          sender: this,
+          data: {
+            hostName: hostName,
+            componentName: componentName
+          },
+          beforeSend: 'onCreateMasterComponentBeforeSend',
+          success: 'onCreateMasterComponentSuccess',
+          error: 'onCreateMasterComponentError'
+        });
+      }
+    }, this);
+  },
+
+  onCreateMasterComponentBeforeSend: function () {
+    this.setTasksStatus(1, 'PENDING');
+  },
+
+  onCreateMasterComponentSuccess: function () {
+    this.setTasksStatus(1, 'COMPLETED');
+  },
+
+  onCreateMasterComponentError: function () {
+    this.setTasksStatus(1, 'FAILED');
+  },
+
+  createConfigs: function () {
+    if (this.get('service.serviceName') == 'GANGLIA' || App.testMode) {
+      this.setTasksStatus(2, 'COMPLETED');
+    } else {
+      this.setTasksStatus(2, 'PENDING');
+      this.loadGlobals();
+      this.loadConfigs();
+      this.set('newConfigsTag', 'version' + (new Date).getTime());
+      var serviceName = this.get('service.serviceName');
+      this.createConfigSite(this.createGlobalSiteObj());
+      this.createConfigSite(this.createCoreSiteObj());
+      if (serviceName == 'HDFS') {
+        this.createConfigSite(this.createSiteObj('hdfs-site'));
+      }
+      if (serviceName == 'MAPREDUCE') {
+        this.createConfigSite(this.createSiteObj('mapred-site'));
+      }
+      if (serviceName == 'HBASE') {
+        this.createConfigSite(this.createSiteObj('hbase-site'));
+      }
+      if (serviceName == 'OOZIE') {
+        this.createConfigSite(this.createSiteObj('oozie-site'));
+      }
+      if (serviceName == 'HIVE' || this.get('isCohosted')) {
+        this.createConfigSite(this.createSiteObj('hive-site'));
+      }
+      if (serviceName == 'WEBHCAT' || this.get('isCohosted')) {
+        this.createConfigSite(this.createSiteObj('webhcat-site'));
+      }
+      this.addObserver('createdConfigs.length', this, 'onCreateConfigsCompleted');
+      this.onCreateConfigsCompleted();
+    }
+  },
+
+  createConfigSite: function (configs) {
+    configs.tag = this.get('newConfigsTag');
+    App.ajax.send({
+      name: 'reassign.create_configs',
+      sender: this,
+      data: {
+        configs: configs
+      },
+      beforeSend: 'onCreateConfigsBeforeSend',
+      success: 'onCreateConfigsSuccess',
+      error: 'onCreateConfigsError'
+    });
+  },
+
+  onCreateConfigsBeforeSend: function () {
+    this.set('createdConfigsCount', this.get('createdConfigsCount') + 1);
+  },
+
+  onCreateConfigsSuccess: function (data, opts) {
+    this.get('createdConfigs').pushObject(opts.configs.type);
+  },
+
+  onCreateConfigsError: function () {
+    this.setTasksStatus(2, 'FAILED');
+  },
+
+  createdConfigsCount: 0,
+
+  onCreateConfigsCompleted: function () {
+    if (this.get('createdConfigs.length') == this.get('createdConfigsCount')) {
+      this.setTasksStatus(2, 'COMPLETED');
+    }
+  },
+
+  loadGlobals: function () {
+    var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
+    if (globals.someProperty('name', 'hive_database')) {
+      //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgres is not the default db
+      var hiveDb = globals.findProperty('name', 'hive_database');
+      if (hiveDb.value === 'New MySQL Database') {
+        if (globals.someProperty('name', 'hive_ambari_host')) {
+          globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_hostname';
+        }
+        globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
+      } else {
+        globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_hostname';
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
+        globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
+      }
+    }
+    this.set('globals', globals);
+  },
+
+  loadConfigs: function () {
+    var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property').filterProperty('value');
+    var uiConfigs = this.loadUiSideConfigs();
+    this.set('configs', storedConfigs.concat(uiConfigs));
+  },
+
+  loadUiSideConfigs: function () {
+    var uiConfig = [];
+    var configs = this.get('configMapping').filterProperty('foreignKey', null);
+    configs.forEach(function (_config) {
+      var value = this.getGlobConfigValue(_config.templateName, _config.value, _config.name);
+      uiConfig.pushObject({
+        "id": "site property",
+        "name": _config.name,
+        "value": value,
+        "filename": _config.filename
+      });
+    }, this);
+    var dependentConfig = this.get('configMapping').filterProperty('foreignKey');
+    dependentConfig.forEach(function (_config) {
+      App.config.setConfigValue(uiConfig, this.get('content.serviceConfigProperties'), _config, this.get('globals'));
+      uiConfig.pushObject({
+        "id": "site property",
+        "name": _config._name || _config.name,
+        "value": _config.value,
+        "filename": _config.filename
+      });
+    }, this);
+    return uiConfig;
+  },
+
+  getGlobConfigValue: function (templateName, expression, name) {
+    var express = expression.match(/<(.*?)>/g);
+    var value = expression;
+    if (express == null) {
+      return expression;
+    }
+    express.forEach(function (_express) {
+      var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
+      if (this.get('globals').someProperty('name', templateName[index])) {
+        var globValue = this.get('globals').findProperty('name', templateName[index]).value;
+        // Hack for templeton.zookeeper.hosts
+        if (value !== null) {   // if the property depends on more than one template name like <templateName[0]>/<templateName[1]> then don't proceed to the next if the prior is null or not found in the global configs
+          if (name === "templeton.zookeeper.hosts" || name === 'hbase.zookeeper.quorum') {
+            // globValue is an array of ZooKeeper Server hosts
+            var zooKeeperPort = '2181';
+            if (name === "templeton.zookeeper.hosts") {
+              var zooKeeperServers = globValue.map(function (item) {
+                return item + ':' + zooKeeperPort;
+              }).join(',');
+              value = value.replace(_express, zooKeeperServers);
+            } else {
+              value = value.replace(_express, globValue.join(','));
+            }
+          } else {
+            value = value.replace(_express, globValue);
+          }
+        }
+      } else {
+        value = null;
+      }
+    }, this);
+    return value;
+  },
+
+  /**
+   * Set property of the site variable
+   */
+  setSiteProperty: function (key, value, filename) {
+    this.get('configs').pushObject({
+      "id": "site property",
+      "name": key,
+      "value": value,
+      "filename": filename
+    });
+  },
+
+  createGlobalSiteObj: function () {
+    var globalSiteProperties = {};
+    //this.get('globals').filterProperty('domain', 'global').forEach(function (_globalSiteObj) {
+    this.get('globals').forEach(function (_globalSiteObj) {
+      // do not pass any globals whose name ends with _host or _hosts
+      if (!/_hosts?$/.test(_globalSiteObj.name)) {
+        // append "m" to JVM memory options except for hadoop_heapsize
+        if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name) && _globalSiteObj.name !== 'hadoop_heapsize') {
+          globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value + "m";
+        } else {
+          globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value;
+        }
+      }
+    }, this);
+    return {"type": "global", "properties": globalSiteProperties};
+  },
+
+  createCoreSiteObj: function () {
+    var serviceName = this.get('service.serviceName');
+    var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
+    var coreSiteProperties = {};
+    // hadoop.proxyuser.oozie.hosts needs to be skipped if oozie is not selected
+    var isOozieSelected = serviceName == 'OOZIE';
+    var oozieUser = this.get('globals').someProperty('name', 'oozie_user') ? this.get('globals').findProperty('name', 'oozie_user').value : null;
+    var isHiveSelected = serviceName == 'HIVE';
+    var hiveUser = this.get('globals').someProperty('name', 'hive_user') ? this.get('globals').findProperty('name', 'hive_user').value : null;
+    var isHcatSelected = serviceName == 'WEBHCAT';
+    var hcatUser = this.get('globals').someProperty('name', 'hcat_user') ? this.get('globals').findProperty('name', 'hcat_user').value : null;
+    coreSiteObj.forEach(function (_coreSiteObj) {
+      if ((isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) && (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
+        coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
+      }
+    }, this);
+    return {"type": "core-site", "properties": coreSiteProperties};
+  },
+
+  createSiteObj: function (name) {
+    var fileName = name + '.xml';
+    var configs = this.get('configs').filterProperty('filename', fileName);
+    var properties = {};
+    configs.forEach(function (_configProperty) {
+      properties[_configProperty.name] = _configProperty.value;
+    }, this);
+    return {type: name, properties: properties};
+  },
+
+  applyConfigs: function () {
+    if (this.get('service.serviceName') == 'GANGLIA' || App.testMode) {
+      this.setTasksStatus(3, 'COMPLETED');
+    } else {
+      var serviceName = this.get('service.serviceName');
+      App.ajax.send({
+        name: 'reassign.check_configs',
+        sender: this,
+        data: {
+          serviceName: serviceName
+        },
+        success: 'onCheckConfigsSuccess',
+        error: 'onCheckConfigsError'
+      });
+    }
+  },
+
+  onCheckConfigsSuccess: function (configs) {
+    var configTags = configs.ServiceInfo.desired_configs;
+    if (!configTags) {
+      this.setTasksStatus(0, 'FAILED');
+      return;
+    }
+
+    for (var tag in configTags) {
+      if (this.get('createdConfigs').contains(tag)) {
+        configTags[tag] = this.get('newConfigsTag');
+      }
+    }
+    var data = {config: configTags};
+    var serviceName = this.get('service.serviceName');
+    App.ajax.send({
+      name: 'reassign.apply_configs',
+      sender: this,
+      data: {
+        serviceName: serviceName,
+        configs: data
+      },
+      beforeSend: 'onApplyConfigsBeforeSend',
+      success: 'onApplyConfigsSuccess',
+      error: 'onApplyConfigsError'
+    });
+  },
+
+  onCheckConfigsError: function () {
+    this.setTasksStatus(3, 'FAILED');
+  },
+
+  onApplyConfigsBeforeSend: function () {
+    this.setTasksStatus(3, 'PENDING');
+  },
+
+  onApplyConfigsSuccess: function () {
+    this.setTasksStatus(3, 'COMPLETED');
+  },
+
+  onApplyConfigsError: function () {
+    this.setTasksStatus(3, 'FAILED');
+  },
+
+  putInMaintenanceMode: function () {
+    if (App.testMode) {
+      this.setTasksStatus(4, 'COMPLETED');
+    } else {
+      var hostName = this.get('content.reassign.host_id');
+      var componentNames = [this.get('masterComponent.component_name')];
+      if (this.get('isCohosted')) {
+        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+        this.set('queueTasksCompleted', 0);
+      }
+      componentNames.forEach(function (componentName) {
+        App.ajax.send({
+          name: 'reassign.maintenance_mode',
+          sender: this,
+          data: {
+            hostName: hostName,
+            componentName: componentName
+          },
+          beforeSend: 'onPutInMaintenanceModeBeforeSend',
+          success: 'onPutInMaintenanceModeSuccess',
+          error: 'onPutInMaintenanceModeError'
+        });
+      }, this);
+    }
+  },
+
+  onPutInMaintenanceModeBeforeSend: function () {
+    this.setTasksStatus(4, 'PENDING');
+  },
+
+  onPutInMaintenanceModeSuccess: function () {
+    this.setTasksStatus(4, 'COMPLETED');
+  },
+
+  onPutInMaintenanceModeError: function () {
+    this.setTasksStatus(4, 'FAILED');
+  },
+
+  installComponent: function () {
+    this.set('currentRequestId', []);
+    var componentNames = [this.get('masterComponent.component_name')];
+    if (this.get('isCohosted')) {
+      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+    }
+    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+    componentNames.forEach(function (componentName) {
+      App.ajax.send({
+        name: 'reassign.install_component',
+        sender: this,
+        data: {
+          hostName: hostName,
+          componentName: componentName,
+          displayName: App.format.role(componentName)
+        },
+        beforeSend: 'onInstallComponentBeforeSend',
+        success: 'onInstallComponentSuccess',
+        error: 'onInstallComponentError'
+      });
+    }, this);
+  },
+
+  onInstallComponentBeforeSend: function () {
+    this.setTasksStatus(5, 'PENDING');
+  },
+
+  onInstallComponentSuccess: function (data) {
+    if (data) {
+      var requestId = data.Requests.id;
+      this.get('currentRequestId').push(requestId);
+      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
+      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 3) || !this.get('isCohosted')) {
+        this.getLogsByRequest();
+      }
+    } else {
+      this.setTasksStatus(5, 'FAILED');
+    }
+  },
+
+  onInstallComponentError: function () {
+    this.setTasksStatus(5, 'FAILED');
+  },
+
+  startComponents: function () {
+    this.set('currentRequestId', []);
+    var serviceNames = [this.get('masterComponent.service_id')];
+    if (this.get('isCohosted')) {
+      serviceNames = ['HIVE', 'WEBHCAT'];
+    }
+    serviceNames.forEach(function (serviceName) {
+      App.ajax.send({
+        name: 'reassign.start_components',
+        sender: this,
+        data: {
+          serviceName: serviceName,
+          displayName: App.Service.find().findProperty('serviceName', serviceName).get('displayName')
+        },
+        beforeSend: 'onStartComponentsBeforeSend',
+        success: 'onStartComponentsSuccess',
+        error: 'onStartComponentsError'
+      });
+    }, this);
+  },
+
+  onStartComponentsBeforeSend: function () {
+    this.setTasksStatus(6, 'PENDING');
+  },
+
+  onStartComponentsSuccess: function (data) {
+    if (data) {
+      var requestId = data.Requests.id;
+      this.get('currentRequestId').push(requestId);
+      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
+      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 2) || !this.get('isCohosted')) {
+        this.getLogsByRequest();
+      }
+    } else {
+      this.setTasksStatus(6, 'FAILED');
+    }
+  },
+
+  onStartComponentsError: function () {
+    this.setTasksStatus(6, 'FAILED');
+  },
+
+  /**
+   * Parse logs to define status of Start, Stop ot Install task
+   * @param logs
+   */
+  parseLogs: function (logs) {
+    var self = this;
+    var task;
+    var stopPolling = false;
+    var polledData = [];
+    logs.forEach(function (item) {
+      polledData = polledData.concat(item.tasks);
+    }, this);
+    if (this.get('tasks')[0].status == 'COMPLETED') {
+      task = this.get('tasks')[5].status == 'COMPLETED' ? 6 : 5;
+    } else {
+      task = 0;
+    }
+    if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
+      if (polledData.someProperty('Tasks.status', 'FAILED')) {
+        this.setTasksStatus(task, 'FAILED');
+      } else {
+        this.setTasksStatus(task, 'COMPLETED');
+      }
+      stopPolling = true;
+    } else {
+      if (polledData.length == 1) {
+        this.get('tasks')[task].set('progress', 50);
+      } else {
+        var progress = polledData.filterProperty('Tasks.status', 'COMPLETED').length / polledData.length * 100;
+        this.get('tasks')[task].set('progress', Math.round(progress));
+      }
+      this.setTasksStatus(task, 'IN_PROGRESS');
+    }
+    if (!stopPolling) {
+      window.setTimeout(function () {
+        self.getLogsByRequest()
+      }, self.POLL_INTERVAL);
+    }
+  },
+
+  POLL_INTERVAL: 4000,
+  dataPollCounter: 0,
+
+  getLogsByRequest: function () {
+    this.set('logs', []);
+    var requestIds = this.get('currentRequestId');
+
+    if (this.get('dataPollCounter') == 5) {
+      this.set('dataPollCounter', 0);
+    }
+    this.set('dataPollCounter', this.get('dataPollCounter') + 1);
+
+    requestIds.forEach(function (requestId) {
+      App.ajax.send({
+        name: 'reassign.get_logs',
+        sender: this,
+        data: {
+          requestId: requestId,
+          pollCounter: this.get('dataPollCounter')
+        },
+        success: 'onGetLogsByRequestSuccess',
+        error: 'onGetLogsByRequestError'
+      });
+    }, this);
+
+  },
+
+  logs: [],
+
+  onGetLogsByRequestSuccess: function (data) {
+    this.get('logs').push(data);
+    if (this.get('logs.length') == this.get('currentRequestId.length')) {
+      this.parseLogs(this.get('logs'))
+    }
+  },
+
+  onGetLogsByRequestError: function () {
+    this.set('status', 'FAILED');
+  },
+
+  removeComponent: function () {
+    if (App.testMode) {
+      this.setTasksStatus(7, 'COMPLETED');
+    } else {
+      var hostName = this.get('content.reassign.host_id');
+      var componentNames = [this.get('masterComponent.component_name')];
+      if (this.get('isCohosted')) {
+        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+        this.set('queueTasksCompleted', 0);
+      }
+      componentNames.forEach(function (componentName) {
+        App.ajax.send({
+          name: 'reassign.remove_component',
+          sender: this,
+          data: {
+            hostName: hostName,
+            componentName: componentName
+          },
+          beforeSend: 'onRemoveComponentBeforeSend',
+          success: 'onRemoveComponentSuccess',
+          error: 'onRemoveComponentError'
+        });
+      }, this);
+    }
+  },
+
+  onRemoveComponentBeforeSend: function () {
+    this.setTasksStatus(7, 'PENDING');
+  },
+
+  onRemoveComponentSuccess: function () {
+    this.setTasksStatus(7, 'COMPLETED');
+  },
+
+  onRemoveComponentError: function () {
+    this.setTasksStatus(7, 'FAILED');
+  },
+
+  retry: function () {
+    if (this.get('tasks')[5].status == 'FAILED') {
+      this.installComponent();
+    } else {
+      this.startComponents();
+    }
+    this.set('showRetry', false);
+  },
+
+  abort: function () {
+    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+    var componentNames = [this.get('masterComponent.component_name')];
+    if (this.get('isCohosted')) {
+      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+      this.set('queueTasksCompleted', 0);
+    }
+    componentNames.forEach(function (componentName) {
+      App.ajax.send({
+        name: 'reassign.maintenance_mode',
+        sender: this,
+        data: {
+          hostName: hostName,
+          componentName: componentName
+        },
+        success: 'onAbortMaintenance',
+        error: 'onAbortError'
+      });
+    }, this);
+  },
+
+
+  onAbortMaintenance: function () {
+    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
+      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
+    } else {
+      var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+      var componentNames = [this.get('masterComponent.component_name')];
+      if (this.get('isCohosted')) {
+        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+        this.set('queueTasksCompleted', 0);
+      }
+      componentNames.forEach(function (componentName) {
+        App.ajax.send({
+          name: 'reassign.remove_component',
+          sender: this,
+          data: {
+            hostName: hostName,
+            componentName: componentName
+          },
+          success: 'onAbortRemoveComponent',
+          error: 'onAbortError'
+        });
+      }, this);
+    }
+  },
+
+  onAbortRemoveComponent: function () {
+    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
+      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
+    } else {
+      var hostName = this.get('content.reassign.host_id');
+      var componentNames = [this.get('masterComponent.component_name')];
+      if (this.get('isCohosted')) {
+        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
+        this.set('queueTasksCompleted', 0);
+      }
+      componentNames.forEach(function (componentName) {
+        App.ajax.send({
+          name: 'reassign.install_component',
+          sender: this,
+          data: {
+            hostName: hostName,
+            componentName: componentName
+          },
+          success: 'onAbortCompleted',
+          error: 'onAbortError'
+        });
+      }, this);
+    }
+  },
+
+  onAbortCompleted: function () {
+    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
+      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
+    } else {
+      App.clusterStatus.setClusterStatus({
+        clusterName: this.get('content.cluster.name'),
+        clusterState: 'REASSIGN_MASTER_ABORTED',
+        wizardControllerName: this.get('content.controllerName'),
+        localdb: App.db.data
+      });
+      App.router.send('back');
+    }
+  },
+
+  onAbortError: function () {
+    App.ModalPopup.show({
+      header: Em.I18n.translations['common.error'],
+      secondary: false,
+      onPrimary: function () {
+        this.hide();
+      },
+      bodyClass: Ember.View.extend({
+        template: Ember.Handlebars.compile('<p>{{t installer.step13.abortError}}</p>')
+      })
+    });
+  }
+})

+ 0 - 905
ambari-web/app/controllers/wizard/step14_controller.js

@@ -1,905 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.WizardStep14Controller = Em.Controller.extend({
-
-  status: 'IN_PROGRESS',
-
-  onStatusChange: function () {
-    if (this.get('tasks').someProperty('status', 'FAILED')) {
-      this.set('status', 'FAILED');
-      if (this.get('tasks')[5].status == 'FAILED' || this.get('tasks')[6].status == 'FAILED') {
-        this.set('showRetry', true);
-      }
-    } else if (this.get('tasks').everyProperty('status', 'COMPLETED')) {
-      this.set('status', 'COMPLETED');
-      this.set('isSubmitDisabled', false);
-    } else {
-      this.set('status', 'IN_PROGRESS')
-    }
-    var statuses = this.get('tasks').mapProperty('status');
-    App.router.get(this.get('content.controllerName')).saveTasksStatuses(statuses);
-    App.clusterStatus.setClusterStatus({
-      clusterName: this.get('content.cluster.name'),
-      clusterState: 'REASSIGN_MASTER_INSTALLING',
-      wizardControllerName: this.get('content.controllerName'),
-      localdb: App.db.data
-    });
-    this.setTasksMessages();
-    this.navigateStep();
-  },
-
-  tasks: [],
-
-  /**
-   * Set messages for tasks depending on their status
-   */
-  setTasksMessages: function () {
-    var service = this.get('service.displayName');
-    var master = this.get('masterComponent.display_name');
-    if (this.get('isCohosted')) {
-      service = 'Hive, WebHCat';
-      master = Em.I18n.t('installer.step5.hiveGroup');
-    }
-    for (i = 0; i < this.get('tasks').length; i++) {
-      var status = this.get('tasks')[i].status.toLowerCase().replace('initialize', 'pending').replace('_', ' ');
-      if (i == 0 || i == 6) {
-        this.get('tasks')[i].set('message', Em.I18n.t('installer.step14.task' + i).format(service) + ' ' + status);
-      } else {
-        this.get('tasks')[i].set('message', Em.I18n.t('installer.step14.task' + i).format(master) + ' ' + status);
-      }
-    }
-  },
-
-  configs: [],
-  globals: [],
-  configMapping: App.config.get('configMapping').all(),
-  newConfigsTag: null,
-  createdConfigs: [],
-
-  currentRequestId: [],
-
-  isSubmitDisabled: true,
-
-  showRetry: false,
-
-  service: function () {
-    return App.Service.find().findProperty('serviceName', this.get('masterComponent.service_id'));
-  }.property('masterComponent'),
-
-  masterComponent: function () {
-    return this.get('content.reassign');
-  }.property('content.reassign'),
-
-  isCohosted: function () {
-    return this.get('masterComponent.component_name') == 'HIVE_SERVER';
-  }.property('masterComponent'),
-
-  loadStep: function () {
-    this.clearStep();
-    this.loadTasks();
-    this.addObserver('tasks.@each.status', this, 'onStatusChange');
-    this.onStatusChange();
-  },
-
-  clearStep: function () {
-    this.removeObserver('tasks.@each.status', this, 'onStatusChange');
-    this.removeObserver('createdConfigs.length', this, 'onCreateConfigsCompleted');
-    var tasks = [];
-    for (var i = 0; i < 8; i++) {
-      tasks.pushObject(Ember.Object.create({
-        status: 'INITIALIZE',
-        logs: '',
-        message: '',
-        progress: 0
-      }));
-    }
-    this.set('tasks', tasks);
-    this.set('createdConfigsCount', 0);
-    this.set('queueTasksCompleted', 0);
-    this.set('dataPollCounter', 1);
-    this.set('showRetry', false);
-    this.set('isSubmitDisabled', true);
-    this.get('configs').clear();
-    this.get('globals').clear();
-    this.get('createdConfigs').clear();
-  },
-
-  loadTasks: function () {
-    var statuses = this.get('content.tasksStatuses');
-    if (statuses) {
-      statuses.forEach(function (status, index) {
-        this.get('tasks')[index].status = status;
-      }, this)
-    }
-    var statusesForRequestId = ['PENDING', 'QUEUED', 'IN_PROGRESS'];
-    if (statusesForRequestId.contains(statuses[0]) || statusesForRequestId.contains(statuses[5]) || statusesForRequestId.contains(statuses[6])) {
-      this.set('currentRequestId', this.get('content.cluster.requestId'));
-      this.getLogsByRequest();
-    }
-  },
-
-  /**
-   * Run tasks in proper way
-   */
-  navigateStep: function () {
-    if (this.get('tasks')[0].status == 'INITIALIZE') {
-      this.stopService();
-    }
-    else if (this.taskIsReady(1)) {
-      this.createMasterComponent();
-    }
-    else if (this.taskIsReady(2)) {
-      this.createConfigs();
-    }
-    else if (this.taskIsReady(3)) {
-      this.applyConfigs();
-    }
-    else if (this.taskIsReady(4)) {
-      this.putInMaintenanceMode();
-    }
-    else if (this.taskIsReady(5)) {
-      this.installComponent();
-    }
-    else if (this.taskIsReady(6)) {
-      this.startComponents();
-    }
-    else if (this.taskIsReady(7)) {
-      this.removeComponent();
-    }
-  },
-
-  /**
-   * Determine preparedness to run task
-   * @param task
-   * @return {Boolean}
-   */
-  taskIsReady: function (task) {
-    if (this.get('tasks')[task].status != 'INITIALIZE') {
-      return false;
-    }
-    var tempArr = this.get('tasks').mapProperty('status').slice(0, task).uniq();
-    return tempArr.length == 1 && tempArr[0] == 'COMPLETED';
-  },
-
-  queueTasksCompleted: 0,
-
-  /**
-   * Change status of the task
-   * @param task
-   * @param status
-   */
-  setTasksStatus: function (task, status) {
-    if (status == 'COMPLETED' && this.get('isCohosted') && [1, 4, 7].contains(task) && this.get('queueTasksCompleted') < 2) {
-      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
-    } else {
-      this.get('tasks')[task].set('status', status);
-    }
-  },
-
-  saveClusterStatus: function (requestId, status) {
-    var clusterStatus = {
-      status: status,
-      requestId: requestId
-    };
-    App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
-  },
-
-  stopService: function () {
-    this.set('currentRequestId', []);
-    var serviceNames = [this.get('masterComponent.service_id')];
-    if (this.get('isCohosted')) {
-      serviceNames = ['HIVE', 'WEBHCAT'];
-    }
-    serviceNames.forEach(function (serviceName) {
-      App.ajax.send({
-        name: 'reassign.stop_service',
-        sender: this,
-        data: {
-          serviceName: serviceName,
-          displayName: App.Service.find().findProperty('serviceName', serviceName).get('displayName')
-        },
-        beforeSend: 'onStopServiceBeforeSend',
-        success: 'onStopServiceSuccess',
-        error: 'onStopServiceError'
-      });
-    }, this);
-  },
-
-  onStopServiceBeforeSend: function () {
-    this.setTasksStatus(0, 'PENDING');
-  },
-
-  onStopServiceSuccess: function (data) {
-    if (data) {
-      var requestId = data.Requests.id;
-      this.get('currentRequestId').push(requestId);
-      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
-      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 2) || !this.get('isCohosted')) {
-        this.getLogsByRequest();
-      }
-    } else {
-      this.setTasksStatus(0, 'FAILED');
-    }
-  },
-
-  onStopServiceError: function () {
-    this.setTasksStatus(0, 'FAILED');
-  },
-
-  createMasterComponent: function () {
-    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
-    var componentNames = [this.get('masterComponent.component_name')];
-    if (this.get('isCohosted')) {
-      this.set('queueTasksCompleted', 0);
-      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-    }
-    componentNames.forEach(function (componentName) {
-      if (App.testMode) {
-        this.setTasksStatus(1, 'COMPLETED');
-      } else {
-        App.ajax.send({
-          name: 'reassign.create_master',
-          sender: this,
-          data: {
-            hostName: hostName,
-            componentName: componentName
-          },
-          beforeSend: 'onCreateMasterComponentBeforeSend',
-          success: 'onCreateMasterComponentSuccess',
-          error: 'onCreateMasterComponentError'
-        });
-      }
-    }, this);
-  },
-
-  onCreateMasterComponentBeforeSend: function () {
-    this.setTasksStatus(1, 'PENDING');
-  },
-
-  onCreateMasterComponentSuccess: function () {
-    this.setTasksStatus(1, 'COMPLETED');
-  },
-
-  onCreateMasterComponentError: function () {
-    this.setTasksStatus(1, 'FAILED');
-  },
-
-  createConfigs: function () {
-    if (this.get('service.serviceName') == 'GANGLIA' || App.testMode) {
-      this.setTasksStatus(2, 'COMPLETED');
-    } else {
-      this.setTasksStatus(2, 'PENDING');
-      this.loadGlobals();
-      this.loadConfigs();
-      this.set('newConfigsTag', 'version' + (new Date).getTime());
-      var serviceName = this.get('service.serviceName');
-      this.createConfigSite(this.createGlobalSiteObj());
-      this.createConfigSite(this.createCoreSiteObj());
-      if (serviceName == 'HDFS') {
-        this.createConfigSite(this.createSiteObj('hdfs-site'));
-      }
-      if (serviceName == 'MAPREDUCE') {
-        this.createConfigSite(this.createSiteObj('mapred-site'));
-      }
-      if (serviceName == 'HBASE') {
-        this.createConfigSite(this.createSiteObj('hbase-site'));
-      }
-      if (serviceName == 'OOZIE') {
-        this.createConfigSite(this.createSiteObj('oozie-site'));
-      }
-      if (serviceName == 'HIVE' || this.get('isCohosted')) {
-        this.createConfigSite(this.createSiteObj('hive-site'));
-      }
-      if (serviceName == 'WEBHCAT' || this.get('isCohosted')) {
-        this.createConfigSite(this.createSiteObj('webhcat-site'));
-      }
-      this.addObserver('createdConfigs.length', this, 'onCreateConfigsCompleted');
-      this.onCreateConfigsCompleted();
-    }
-  },
-
-  createConfigSite: function (configs) {
-    configs.tag = this.get('newConfigsTag');
-    App.ajax.send({
-      name: 'reassign.create_configs',
-      sender: this,
-      data: {
-        configs: configs
-      },
-      beforeSend: 'onCreateConfigsBeforeSend',
-      success: 'onCreateConfigsSuccess',
-      error: 'onCreateConfigsError'
-    });
-  },
-
-  onCreateConfigsBeforeSend: function () {
-    this.set('createdConfigsCount', this.get('createdConfigsCount') + 1);
-  },
-
-  onCreateConfigsSuccess: function (data, opts) {
-    this.get('createdConfigs').pushObject(opts.configs.type);
-  },
-
-  onCreateConfigsError: function () {
-    this.setTasksStatus(2, 'FAILED');
-  },
-
-  createdConfigsCount: 0,
-
-  onCreateConfigsCompleted: function () {
-    if (this.get('createdConfigs.length') == this.get('createdConfigsCount')) {
-      this.setTasksStatus(2, 'COMPLETED');
-    }
-  },
-
-  loadGlobals: function () {
-    var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
-    if (globals.someProperty('name', 'hive_database')) {
-      //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgres is not the default db
-      var hiveDb = globals.findProperty('name', 'hive_database');
-      if (hiveDb.value === 'New MySQL Database') {
-        if (globals.someProperty('name', 'hive_ambari_host')) {
-          globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_hostname';
-        }
-        globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
-        globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
-      } else {
-        globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_hostname';
-        globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
-        globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
-      }
-    }
-    this.set('globals', globals);
-  },
-
-  loadConfigs: function () {
-    var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property').filterProperty('value');
-    var uiConfigs = this.loadUiSideConfigs();
-    this.set('configs', storedConfigs.concat(uiConfigs));
-  },
-
-  loadUiSideConfigs: function () {
-    var uiConfig = [];
-    var configs = this.get('configMapping').filterProperty('foreignKey', null);
-    configs.forEach(function (_config) {
-      var value = this.getGlobConfigValue(_config.templateName, _config.value, _config.name);
-      uiConfig.pushObject({
-        "id": "site property",
-        "name": _config.name,
-        "value": value,
-        "filename": _config.filename
-      });
-    }, this);
-    var dependentConfig = this.get('configMapping').filterProperty('foreignKey');
-    dependentConfig.forEach(function (_config) {
-      App.config.setConfigValue(uiConfig, this.get('content.serviceConfigProperties'), _config, this.get('globals'));
-      uiConfig.pushObject({
-        "id": "site property",
-        "name": _config._name || _config.name,
-        "value": _config.value,
-        "filename": _config.filename
-      });
-    }, this);
-    return uiConfig;
-  },
-
-  getGlobConfigValue: function (templateName, expression, name) {
-    var express = expression.match(/<(.*?)>/g);
-    var value = expression;
-    if (express == null) {
-      return expression;
-    }
-    express.forEach(function (_express) {
-      var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
-      if (this.get('globals').someProperty('name', templateName[index])) {
-        var globValue = this.get('globals').findProperty('name', templateName[index]).value;
-        // Hack for templeton.zookeeper.hosts
-        if (value !== null) {   // if the property depends on more than one template name like <templateName[0]>/<templateName[1]> then don't proceed to the next if the prior is null or not found in the global configs
-          if (name === "templeton.zookeeper.hosts" || name === 'hbase.zookeeper.quorum') {
-            // globValue is an array of ZooKeeper Server hosts
-            var zooKeeperPort = '2181';
-            if (name === "templeton.zookeeper.hosts") {
-              var zooKeeperServers = globValue.map(function (item) {
-                return item + ':' + zooKeeperPort;
-              }).join(',');
-              value = value.replace(_express, zooKeeperServers);
-            } else {
-              value = value.replace(_express, globValue.join(','));
-            }
-          } else {
-            value = value.replace(_express, globValue);
-          }
-        }
-      } else {
-        value = null;
-      }
-    }, this);
-    return value;
-  },
-
-  /**
-   * Set property of the site variable
-   */
-  setSiteProperty: function (key, value, filename) {
-    this.get('configs').pushObject({
-      "id": "site property",
-      "name": key,
-      "value": value,
-      "filename": filename
-    });
-  },
-
-  createGlobalSiteObj: function () {
-    var globalSiteProperties = {};
-    //this.get('globals').filterProperty('domain', 'global').forEach(function (_globalSiteObj) {
-    this.get('globals').forEach(function (_globalSiteObj) {
-      // do not pass any globals whose name ends with _host or _hosts
-      if (!/_hosts?$/.test(_globalSiteObj.name)) {
-        // append "m" to JVM memory options except for hadoop_heapsize
-        if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name) && _globalSiteObj.name !== 'hadoop_heapsize') {
-          globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value + "m";
-        } else {
-          globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value;
-        }
-      }
-    }, this);
-    return {"type": "global", "properties": globalSiteProperties};
-  },
-
-  createCoreSiteObj: function () {
-    var serviceName = this.get('service.serviceName');
-    var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
-    var coreSiteProperties = {};
-    // hadoop.proxyuser.oozie.hosts needs to be skipped if oozie is not selected
-    var isOozieSelected = serviceName == 'OOZIE';
-    var oozieUser = this.get('globals').someProperty('name', 'oozie_user') ? this.get('globals').findProperty('name', 'oozie_user').value : null;
-    var isHiveSelected = serviceName == 'HIVE';
-    var hiveUser = this.get('globals').someProperty('name', 'hive_user') ? this.get('globals').findProperty('name', 'hive_user').value : null;
-    var isHcatSelected = serviceName == 'WEBHCAT';
-    var hcatUser = this.get('globals').someProperty('name', 'hcat_user') ? this.get('globals').findProperty('name', 'hcat_user').value : null;
-    coreSiteObj.forEach(function (_coreSiteObj) {
-      if ((isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) && (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
-        coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
-      }
-    }, this);
-    return {"type": "core-site", "properties": coreSiteProperties};
-  },
-
-  createSiteObj: function (name) {
-    var fileName = name + '.xml';
-    var configs = this.get('configs').filterProperty('filename', fileName);
-    var properties = {};
-    configs.forEach(function (_configProperty) {
-      properties[_configProperty.name] = _configProperty.value;
-    }, this);
-    return {type: name, properties: properties};
-  },
-
-  applyConfigs: function () {
-    if (this.get('service.serviceName') == 'GANGLIA' || App.testMode) {
-      this.setTasksStatus(3, 'COMPLETED');
-    } else {
-      var serviceName = this.get('service.serviceName');
-      App.ajax.send({
-        name: 'reassign.check_configs',
-        sender: this,
-        data: {
-          serviceName: serviceName
-        },
-        success: 'onCheckConfigsSuccess',
-        error: 'onCheckConfigsError'
-      });
-    }
-  },
-
-  onCheckConfigsSuccess: function (configs) {
-    var configTags = configs.ServiceInfo.desired_configs;
-    if (!configTags) {
-      this.setTasksStatus(0, 'FAILED');
-      return;
-    }
-
-    for (var tag in configTags) {
-      if (this.get('createdConfigs').contains(tag)) {
-        configTags[tag] = this.get('newConfigsTag');
-      }
-    }
-    var data = {config: configTags};
-    var serviceName = this.get('service.serviceName');
-    App.ajax.send({
-      name: 'reassign.apply_configs',
-      sender: this,
-      data: {
-        serviceName: serviceName,
-        configs: data
-      },
-      beforeSend: 'onApplyConfigsBeforeSend',
-      success: 'onApplyConfigsSuccess',
-      error: 'onApplyConfigsError'
-    });
-  },
-
-  onCheckConfigsError: function () {
-    this.setTasksStatus(3, 'FAILED');
-  },
-
-  onApplyConfigsBeforeSend: function () {
-    this.setTasksStatus(3, 'PENDING');
-  },
-
-  onApplyConfigsSuccess: function () {
-    this.setTasksStatus(3, 'COMPLETED');
-  },
-
-  onApplyConfigsError: function () {
-    this.setTasksStatus(3, 'FAILED');
-  },
-
-  putInMaintenanceMode: function () {
-    if (App.testMode) {
-      this.setTasksStatus(4, 'COMPLETED');
-    } else {
-      var hostName = this.get('content.reassign.host_id');
-      var componentNames = [this.get('masterComponent.component_name')];
-      if (this.get('isCohosted')) {
-        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-        this.set('queueTasksCompleted', 0);
-      }
-      componentNames.forEach(function (componentName) {
-        App.ajax.send({
-          name: 'reassign.maintenance_mode',
-          sender: this,
-          data: {
-            hostName: hostName,
-            componentName: componentName
-          },
-          beforeSend: 'onPutInMaintenanceModeBeforeSend',
-          success: 'onPutInMaintenanceModeSuccess',
-          error: 'onPutInMaintenanceModeError'
-        });
-      }, this);
-    }
-  },
-
-  onPutInMaintenanceModeBeforeSend: function () {
-    this.setTasksStatus(4, 'PENDING');
-  },
-
-  onPutInMaintenanceModeSuccess: function () {
-    this.setTasksStatus(4, 'COMPLETED');
-  },
-
-  onPutInMaintenanceModeError: function () {
-    this.setTasksStatus(4, 'FAILED');
-  },
-
-  installComponent: function () {
-    this.set('currentRequestId', []);
-    var componentNames = [this.get('masterComponent.component_name')];
-    if (this.get('isCohosted')) {
-      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-    }
-    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
-    componentNames.forEach(function (componentName) {
-      App.ajax.send({
-        name: 'reassign.install_component',
-        sender: this,
-        data: {
-          hostName: hostName,
-          componentName: componentName,
-          displayName: App.format.role(componentName)
-        },
-        beforeSend: 'onInstallComponentBeforeSend',
-        success: 'onInstallComponentSuccess',
-        error: 'onInstallComponentError'
-      });
-    }, this);
-  },
-
-  onInstallComponentBeforeSend: function () {
-    this.setTasksStatus(5, 'PENDING');
-  },
-
-  onInstallComponentSuccess: function (data) {
-    if (data) {
-      var requestId = data.Requests.id;
-      this.get('currentRequestId').push(requestId);
-      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
-      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 3) || !this.get('isCohosted')) {
-        this.getLogsByRequest();
-      }
-    } else {
-      this.setTasksStatus(5, 'FAILED');
-    }
-  },
-
-  onInstallComponentError: function () {
-    this.setTasksStatus(5, 'FAILED');
-  },
-
-  startComponents: function () {
-    this.set('currentRequestId', []);
-    var serviceNames = [this.get('masterComponent.service_id')];
-    if (this.get('isCohosted')) {
-      serviceNames = ['HIVE', 'WEBHCAT'];
-    }
-    serviceNames.forEach(function (serviceName) {
-      App.ajax.send({
-        name: 'reassign.start_components',
-        sender: this,
-        data: {
-          serviceName: serviceName,
-          displayName: App.Service.find().findProperty('serviceName', serviceName).get('displayName')
-        },
-        beforeSend: 'onStartComponentsBeforeSend',
-        success: 'onStartComponentsSuccess',
-        error: 'onStartComponentsError'
-      });
-    }, this);
-  },
-
-  onStartComponentsBeforeSend: function () {
-    this.setTasksStatus(6, 'PENDING');
-  },
-
-  onStartComponentsSuccess: function (data) {
-    if (data) {
-      var requestId = data.Requests.id;
-      this.get('currentRequestId').push(requestId);
-      this.saveClusterStatus(this.get('currentRequestId'), 'PENDING');
-      if ((this.get('isCohosted') && this.get('currentRequestId.length') == 2) || !this.get('isCohosted')) {
-        this.getLogsByRequest();
-      }
-    } else {
-      this.setTasksStatus(6, 'FAILED');
-    }
-  },
-
-  onStartComponentsError: function () {
-    this.setTasksStatus(6, 'FAILED');
-  },
-
-  /**
-   * Parse logs to define status of Start, Stop ot Install task
-   * @param logs
-   */
-  parseLogs: function (logs) {
-    var self = this;
-    var task;
-    var stopPolling = false;
-    var polledData = [];
-    logs.forEach(function (item) {
-      polledData = polledData.concat(item.tasks);
-    }, this);
-    if (this.get('tasks')[0].status == 'COMPLETED') {
-      task = this.get('tasks')[5].status == 'COMPLETED' ? 6 : 5;
-    } else {
-      task = 0;
-    }
-    if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
-      if (polledData.someProperty('Tasks.status', 'FAILED')) {
-        this.setTasksStatus(task, 'FAILED');
-      } else {
-        this.setTasksStatus(task, 'COMPLETED');
-      }
-      stopPolling = true;
-    } else {
-      if (polledData.length == 1) {
-        this.get('tasks')[task].set('progress', 50);
-      } else {
-        var progress = polledData.filterProperty('Tasks.status', 'COMPLETED').length / polledData.length * 100;
-        this.get('tasks')[task].set('progress', Math.round(progress));
-      }
-      this.setTasksStatus(task, 'IN_PROGRESS');
-    }
-    if (!stopPolling) {
-      window.setTimeout(function () {
-        self.getLogsByRequest()
-      }, self.POLL_INTERVAL);
-    }
-  },
-
-  POLL_INTERVAL: 4000,
-  dataPollCounter: 0,
-
-  getLogsByRequest: function () {
-    this.set('logs', []);
-    var requestIds = this.get('currentRequestId');
-
-    if (this.get('dataPollCounter') == 5) {
-      this.set('dataPollCounter', 0);
-    }
-    this.set('dataPollCounter', this.get('dataPollCounter') + 1);
-
-    requestIds.forEach(function (requestId) {
-      App.ajax.send({
-        name: 'reassign.get_logs',
-        sender: this,
-        data: {
-          requestId: requestId,
-          pollCounter: this.get('dataPollCounter')
-        },
-        success: 'onGetLogsByRequestSuccess',
-        error: 'onGetLogsByRequestError'
-      });
-    }, this);
-
-  },
-
-  logs: [],
-
-  onGetLogsByRequestSuccess: function (data) {
-    this.get('logs').push(data);
-    if (this.get('logs.length') == this.get('currentRequestId.length')) {
-      this.parseLogs(this.get('logs'))
-    }
-  },
-
-  onGetLogsByRequestError: function () {
-    this.set('status', 'FAILED');
-  },
-
-  removeComponent: function () {
-    if (App.testMode) {
-      this.setTasksStatus(7, 'COMPLETED');
-    } else {
-      var hostName = this.get('content.reassign.host_id');
-      var componentNames = [this.get('masterComponent.component_name')];
-      if (this.get('isCohosted')) {
-        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-        this.set('queueTasksCompleted', 0);
-      }
-      componentNames.forEach(function (componentName) {
-        App.ajax.send({
-          name: 'reassign.remove_component',
-          sender: this,
-          data: {
-            hostName: hostName,
-            componentName: componentName
-          },
-          beforeSend: 'onRemoveComponentBeforeSend',
-          success: 'onRemoveComponentSuccess',
-          error: 'onRemoveComponentError'
-        });
-      }, this);
-    }
-  },
-
-  onRemoveComponentBeforeSend: function () {
-    this.setTasksStatus(7, 'PENDING');
-  },
-
-  onRemoveComponentSuccess: function () {
-    this.setTasksStatus(7, 'COMPLETED');
-  },
-
-  onRemoveComponentError: function () {
-    this.setTasksStatus(7, 'FAILED');
-  },
-
-  retry: function () {
-    if (this.get('tasks')[5].status == 'FAILED') {
-      this.installComponent();
-    } else {
-      this.startComponents();
-    }
-    this.set('showRetry', false);
-  },
-
-  abort: function () {
-    var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
-    var componentNames = [this.get('masterComponent.component_name')];
-    if (this.get('isCohosted')) {
-      componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-      this.set('queueTasksCompleted', 0);
-    }
-    componentNames.forEach(function (componentName) {
-      App.ajax.send({
-        name: 'reassign.maintenance_mode',
-        sender: this,
-        data: {
-          hostName: hostName,
-          componentName: componentName
-        },
-        success: 'onAbortMaintenance',
-        error: 'onAbortError'
-      });
-    }, this);
-  },
-
-
-  onAbortMaintenance: function () {
-    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
-      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
-    } else {
-      var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
-      var componentNames = [this.get('masterComponent.component_name')];
-      if (this.get('isCohosted')) {
-        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-        this.set('queueTasksCompleted', 0);
-      }
-      componentNames.forEach(function (componentName) {
-        App.ajax.send({
-          name: 'reassign.remove_component',
-          sender: this,
-          data: {
-            hostName: hostName,
-            componentName: componentName
-          },
-          success: 'onAbortRemoveComponent',
-          error: 'onAbortError'
-        });
-      }, this);
-    }
-  },
-
-  onAbortRemoveComponent: function () {
-    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
-      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
-    } else {
-      var hostName = this.get('content.reassign.host_id');
-      var componentNames = [this.get('masterComponent.component_name')];
-      if (this.get('isCohosted')) {
-        componentNames = ['HIVE_SERVER', 'WEBHCAT_SERVER', 'MYSQL_SERVER'];
-        this.set('queueTasksCompleted', 0);
-      }
-      componentNames.forEach(function (componentName) {
-        App.ajax.send({
-          name: 'reassign.install_component',
-          sender: this,
-          data: {
-            hostName: hostName,
-            componentName: componentName
-          },
-          success: 'onAbortCompleted',
-          error: 'onAbortError'
-        });
-      }, this);
-    }
-  },
-
-  onAbortCompleted: function () {
-    if (this.get('isCohosted') && this.get('queueTasksCompleted') < 2) {
-      this.set('queueTasksCompleted', this.get('queueTasksCompleted') + 1);
-    } else {
-      App.clusterStatus.setClusterStatus({
-        clusterName: this.get('content.cluster.name'),
-        clusterState: 'REASSIGN_MASTER_ABORTED',
-        wizardControllerName: this.get('content.controllerName'),
-        localdb: App.db.data
-      });
-      App.router.send('back');
-    }
-  },
-
-  onAbortError: function () {
-    App.ModalPopup.show({
-      header: Em.I18n.translations['common.error'],
-      secondary: false,
-      onPrimary: function () {
-        this.hide();
-      },
-      bodyClass: Ember.View.extend({
-        template: Ember.Handlebars.compile('<p>{{t installer.step14.abortError}}</p>')
-      })
-    });
-  }
-})

+ 18 - 20
ambari-web/app/messages.js

@@ -549,26 +549,24 @@ Em.I18n.translations = {
   'installer.step10.installTime.seconds':'Install and start completed in {0} seconds',
   'installer.step10.installTime.minutes':'Install and start completed in {0} minutes and {1} seconds',
   'installer.step11.header':'Prerequisites',
-  'installer.step12.header':'Reconfigure',
-  'installer.step13.header':'Review',
-  'installer.step13.body':'Please review the changes you made',
-  'installer.step13.targetHost':'Target Host:',
-  'installer.step13.sourceHost':'Source Host:',
-  'installer.step13.changes':'Configs to change:',
-  'installer.step13.component':'Component name:',
-  'installer.step14.task0':'{0} stop',
-  'installer.step14.task1':'{0} create',
-  'installer.step14.task2':'{0} configs create',
-  'installer.step14.task3':'{0} configs apply',
-  'installer.step14.task4':'{0} put in maintenance mode',
-  'installer.step14.task5':'{0} install',
-  'installer.step14.task6':'{0} start',
-  'installer.step14.task7':'{0} remove',
-  'installer.step14.status.success': 'Successfully reassigned {0}',
-  'installer.step14.status.failed': 'Failed to reassign {0}',
-  'installer.step14.status.info': 'Reassigning {0}. \nPlease wait while all tasks will be completed.',
-  'installer.step14.retry': 'You can click on the Retry or Abort button to retry failed task or abort changes',
-  'installer.step14.abortError': 'Error in aborting changes.',
+  'installer.step12.header':'Review',
+  'installer.step12.body':'Please review the changes you made',
+  'installer.step12.targetHost':'Target Host:',
+  'installer.step12.sourceHost':'Source Host:',
+  'installer.step12.component':'Component name:',
+  'installer.step13.task0':'{0} stop',
+  'installer.step13.task1':'{0} create',
+  'installer.step13.task2':'{0} configs create',
+  'installer.step13.task3':'{0} configs apply',
+  'installer.step13.task4':'{0} put in maintenance mode',
+  'installer.step13.task5':'{0} install',
+  'installer.step13.task6':'{0} start',
+  'installer.step13.task7':'{0} remove',
+  'installer.step13.status.success': 'Successfully reassigned {0}',
+  'installer.step13.status.failed': 'Failed to reassign {0}',
+  'installer.step13.status.info': 'Reassigning {0}. \nPlease wait while all tasks will be completed.',
+  'installer.step13.retry': 'You can click on the Retry or Abort button to retry failed task or abort changes',
+  'installer.step13.abortError': 'Error in aborting changes.',
 
   'installer.stackUpgrade.header':'Stack Upgrade Wizard',
   'installer.stackUpgrade.step1.newVersion':'New Version',

+ 12 - 42
ambari-web/app/routes/reassign_master_routes.js

@@ -52,7 +52,7 @@ module.exports = Em.Route.extend({
         App.clusterStatus.updateFromServer();
         var currentClusterStatus = App.clusterStatus.get('value');
         if (currentClusterStatus && currentClusterStatus.clusterState == 'REASSIGN_MASTER_INSTALLING') {
-          reassignMasterController.setCurrentStep('5');
+          reassignMasterController.setCurrentStep('4');
           App.db.data = currentClusterStatus.localdb;
         } else {
           reassignMasterController.setCurrentStep('1');
@@ -104,39 +104,13 @@ module.exports = Em.Route.extend({
     connectOutlets: function (router) {
       console.log('in reassignMaster.step3:connectOutlets');
       var controller = router.get('reassignMasterController');
-      if (controller.get('skipStep3')) {
-        router.transitionTo('step4');
-      } else {
-        controller.setCurrentStep('3');
-        controller.dataLoading().done(function () {
-          controller.loadAllPriorSteps();
-          controller.set('content.serviceName', controller.get('content.reassign.service_id'));
-          controller.connectOutlet('wizardStep12', controller.get('content'));
-        })
-      }
-    },
-    back: Em.Router.transitionTo('step2'),
-    next: function (router) {
-      var controller = router.get('reassignMasterController');
-      var wizardStep12Controller = router.get('wizardStep12Controller');
-      controller.set('content.modifiedConfigs', wizardStep12Controller.get('modifiedConfigs'));
-      controller.saveServiceConfigProperties(wizardStep12Controller);
-      router.transitionTo('step4');
-    }
-  }),
-
-  step4: Em.Route.extend({
-    route: '/step4',
-    connectOutlets: function (router) {
-      console.log('in reassignMaster.step4:connectOutlets');
-      var controller = router.get('reassignMasterController');
-      controller.setCurrentStep('4');
+      controller.setCurrentStep('3');
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
-        controller.connectOutlet('wizardStep13', controller.get('content'));
+        controller.connectOutlet('wizardStep12', controller.get('content'));
       })
     },
-    back: Em.Router.transitionTo('step3'),
+    back: Em.Router.transitionTo('step2'),
     next: function (router) {
       App.db.setReassignTasksStatuses(['INITIALIZE', 'INITIALIZE', 'INITIALIZE', 'INITIALIZE', 'INITIALIZE', 'INITIALIZE', 'INITIALIZE', 'INITIALIZE']);
       App.clusterStatus.setClusterStatus({
@@ -145,26 +119,26 @@ module.exports = Em.Route.extend({
         wizardControllerName: 'reassignMasterController',
         localdb: App.db.data
       });
-      router.transitionTo('step5');
+      router.transitionTo('step4');
     }
   }),
 
-  step5: Em.Route.extend({
-    route: '/step5',
+  step4: Em.Route.extend({
+    route: '/step4',
     connectOutlets: function (router) {
-      console.log('in reassignMaster.step5:connectOutlets');
+      console.log('in reassignMaster.step4:connectOutlets');
       var controller = router.get('reassignMasterController');
-      controller.setCurrentStep('5');
+      controller.setCurrentStep('4');
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
-        controller.connectOutlet('wizardStep14', controller.get('content'));
+        controller.connectOutlet('wizardStep13', controller.get('content'));
       })
     },
     back: Em.Router.transitionTo('step3'),
     complete: function (router, context) {
       var controller = router.get('reassignMasterController');
-      var wizardStep14Controller = router.get('wizardStep14Controller');
-      if (!wizardStep14Controller.get('isSubmitDisabled')) {
+      var wizardStep13Controller = router.get('wizardStep13Controller');
+      if (!wizardStep13Controller.get('isSubmitDisabled')) {
         controller.finish();
         $(context.currentTarget).parents("#modal").find(".close").trigger('click');
         App.clusterStatus.setClusterStatus({
@@ -187,10 +161,6 @@ module.exports = Em.Route.extend({
 
   gotoStep4: Em.Router.transitionTo('step4'),
 
-  gotoStep5: Em.Router.transitionTo('step5'),
-
-  gotoStep6: Em.Router.transitionTo('step6'),
-
   backToServices: function (router) {
     App.router.get('updateController').set('isWorking', true);
     router.transitionTo('services');

+ 0 - 1
ambari-web/app/templates/main/service/reassign.hbs

@@ -29,7 +29,6 @@
               <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep2 target="controller"}}>{{t installer.step5.reassign.header}}</a></li>
               <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep3 target="controller"}}>{{t installer.step12.header}}</a></li>
               <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep4 target="controller"}}>{{t installer.step8.header}}</a></li>
-              <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep5 target="controller"}}>{{t installer.step9.header}}</a></li>
             </ul>
           </div>
         </div>

+ 18 - 12
ambari-web/app/templates/wizard/step12.hbs

@@ -16,20 +16,26 @@
 * limitations under the License.
 }}
 
-<div id="serviceConfig">
-  <h2>{{t installer.step12.header}}</h2>
+<h2>{{t installer.step12.header}}</h2>
 
-  {{#if controller.dataIsLoaded}}
-    {{view App.ServiceConfigView}}
-  {{else}}
-    {{t app.loadingPlaceholder}}
-  {{/if}}
+<div class="alert alert-info">
+  {{t installer.step12.body}}
+</div>
+
+<div id="step8-content" class="well pre-scrollable">
+  <div id="printReview">
+    <a class="btn btn-info pull-right" {{action printReview target="view"}}>{{t common.print}}</a> <br/>
+  </div>
+  <div id="step8-info">
+    <p><b>{{t installer.step12.component}}</b> {{controller.content.reassign.display_name}}</p>
 
-  <div class="btn-area">
-    <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
+    <p><b>{{t installer.step12.sourceHost}}</b> {{view.sourceHost}}</p>
 
-    <a
-            class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
-            {{action submit target="controller"}}>{{t common.next}} &rarr;</a>
+    <p><b>{{t installer.step12.targetHost}}</b> {{view.targetHost}}</p>
   </div>
 </div>
+<div class="btn-area">
+  <a class="btn pull-left" {{action back href="true"}}>&larr; {{t common.back}}</a>
+  <a class="btn btn-success pull-right"
+     id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action next}}>{{t common.deploy}} &rarr;</a>
+</div>

+ 30 - 33
ambari-web/app/templates/wizard/step13.hbs

@@ -15,41 +15,38 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 }}
-
-<h2>{{t installer.step13.header}}</h2>
-
-<div class="alert alert-info">
-  {{t installer.step13.body}}
-</div>
-
-<div id="step8-content" class="well pre-scrollable">
-  <div id="printReview">
-    <a class="btn btn-info pull-right" {{action printReview target="view"}}>{{t common.print}}</a> <br/>
+<div id="step13">
+  <div {{bindAttr class="view.statusClass :alert"}}>
+    <p>{{view.statusMessage}}</p>
+    {{#if controller.showRetry}}
+    <p>{{t installer.step13.retry}}</p>
+      <a {{action retry target="controller"}} class="btn btn-primary">
+        <i class="icon-repeat icon-white"></i>
+        {{t common.retry}}
+      </a>
+      <a {{action abort target="controller"}} class="btn btn-warning">
+        <i class="icon-remove icon-white"></i>
+        {{t common.abort}}
+      </a>
+    {{/if}}
   </div>
-  <div id="step8-info">
-    <p><b>{{t installer.step13.component}}</b> {{controller.content.reassign.display_name}}</p>
-
-    <p><b>{{t installer.step13.sourceHost}}</b> {{view.sourceHost}}</p>
-
-    <p><b>{{t installer.step13.targetHost}}</b> {{view.targetHost}}</p>
-
-    {{#if view.changes}}<p><b>{{t installer.step13.changes}}</b></p>{{/if}}
-    {{#each item in view.changes}}
-    <div>
-      <ul><em> <b>{{item.name}}</b></em>
-
-        <div>
-          <ul>Old value: &nbsp;<span class="text text-info">{{item.oldValue}} {{#if item.unit}}{{item.unit}}{{/if}}</span></ul>
-          <ul>New value: <span class="text text-info">{{item.value}} {{#if item.unit}}{{item.unit}}{{/if}}</span></ul>
+    {{#each task in view.tasks}}
+      {{#view view.taskView contentBinding="task"}}
+        <div class="item">
+          <i {{bindAttr class="view.icon view.iconColor"}}></i>
+          <a href="javascript:void(0)">{{task.message}}</a>
+        </div>
+        <div {{bindAttr class="view.inProgress::hide :row :span12" }}>
+          <div class="progress-bar span4">
+            <div class="progress-striped active progress-info progress">
+              <div class="bar" {{bindAttr style="view.barWidth"}}></div>
+            </div>
+          </div>
+          <div class="span1">{{task.progress}}&#37;</div>
         </div>
-
-      </ul>
-    </div>
+      {{/view}}
     {{/each}}
   </div>
-</div>
-<div class="btn-area">
-  <a class="btn pull-left" {{action back href="true"}}>&larr; {{t common.back}}</a>
-  <a class="btn btn-success pull-right"
-     id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action next}}>{{t common.deploy}} &rarr;</a>
+  <div class="btn-area">
+    <a class="btn btn-success pull-right" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action complete}}>{{t common.complete}} &rarr;</a>
 </div>

+ 0 - 52
ambari-web/app/templates/wizard/step14.hbs

@@ -1,52 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-<div id="step14">
-  <div {{bindAttr class="view.statusClass :alert"}}>
-    <p>{{view.statusMessage}}</p>
-    {{#if controller.showRetry}}
-    <p>{{t installer.step14.retry}}</p>
-      <a {{action retry target="controller"}} class="btn btn-primary">
-        <i class="icon-repeat icon-white"></i>
-        {{t common.retry}}
-      </a>
-      <a {{action abort target="controller"}} class="btn btn-warning">
-        <i class="icon-remove icon-white"></i>
-        {{t common.abort}}
-      </a>
-    {{/if}}
-  </div>
-    {{#each task in view.tasks}}
-      {{#view view.taskView contentBinding="task"}}
-        <div class="item">
-          <i {{bindAttr class="view.icon view.iconColor"}}></i>
-          <a href="javascript:void(0)">{{task.message}}</a>
-        </div>
-        <div {{bindAttr class="view.inProgress::hide :row :span12" }}>
-          <div class="progress-bar span4">
-            <div class="progress-striped active progress-info progress">
-              <div class="bar" {{bindAttr style="view.barWidth"}}></div>
-            </div>
-          </div>
-          <div class="span1">{{task.progress}}&#37;</div>
-        </div>
-      {{/view}}
-    {{/each}}
-  </div>
-  <div class="btn-area">
-    <a class="btn btn-success pull-right" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action complete}}>{{t common.complete}} &rarr;</a>
-</div>

+ 0 - 1
ambari-web/app/views.js

@@ -220,7 +220,6 @@ require('views/wizard/step10_view');
 require('views/wizard/step11_view');
 require('views/wizard/step12_view');
 require('views/wizard/step13_view');
-require('views/wizard/step14_view');
 require('views/wizard/stack_upgrade/step1_view');
 require('views/wizard/stack_upgrade/step2_view');
 require('views/wizard/stack_upgrade/step3_view');

+ 0 - 8
ambari-web/app/views/main/service/reassign_view.js

@@ -39,14 +39,6 @@ App.ReassignMasterView = Em.View.extend({
     return this.isStepDisabled(4);
   }.property('controller.isStepDisabled.@each.value').cacheable(),
 
-  isStep5Disabled: function () {
-    return this.isStepDisabled(5);
-  }.property('controller.isStepDisabled.@each.value').cacheable(),
-
-  isStep6Disabled: function () {
-    return this.isStepDisabled(6);
-  }.property('controller.isStepDisabled.@each.value').cacheable(),
-
   isStepDisabled: function (index) {
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
   }

+ 10 - 3
ambari-web/app/views/wizard/step12_view.js

@@ -22,8 +22,15 @@ var App = require('app');
 App.WizardStep12View = Em.View.extend({
 
   templateName: require('templates/wizard/step12'),
-  didInsertElement: function () {
-    this.get('controller').loadStep();
-  }
 
+  sourceHost: function () {
+    return this.get('controller.content.reassign.host_id')
+  }.property('controller.content.reassign.host_id'),
+  targetHost: function () {
+    return this.get('controller.content.masterComponentHosts').findProperty('component', this.get('controller.content.reassign.component_name')).hostName;
+  }.property('controller.content.masterComponentHosts'),
+
+  printReview: function() {
+    $("#step8-info").jqprint();
+  }
 });

+ 69 - 13
ambari-web/app/views/wizard/step13_view.js

@@ -23,17 +23,73 @@ App.WizardStep13View = Em.View.extend({
 
   templateName: require('templates/wizard/step13'),
 
-  changes: function () {
-    return this.get('controller.content.modifiedConfigs');
-  }.property('controller.content.modifiedConfigs'),
-  sourceHost: function () {
-    return this.get('controller.content.reassign.host_id')
-  }.property('controller.content.reassign.host_id'),
-  targetHost: function () {
-    return this.get('controller.content.masterComponentHosts').findProperty('component', this.get('controller.content.reassign.component_name')).hostName;
-  }.property('controller.content.masterComponentHosts'),
-
-  printReview: function() {
-    $("#step8-info").jqprint();
-  }
+  statusMessage: null,
+  statusClass: 'alert-info',
+
+  didInsertElement: function () {
+    this.get('controller').loadStep();
+  },
+
+  tasks: function () {
+    var tasks = this.get('controller.tasks');
+    if (this.get('controller.service.serviceName') == 'GANGLIA') {
+      tasks = tasks.slice(0,2).concat(tasks.slice(4));
+    }
+    return tasks;
+  }.property('controller.tasks', 'controller.service'),
+
+  onStatus: function () {
+    var master = (this.get('controller.isCohosted')) ? Em.I18n.t('installer.step5.hiveGroup') : this.get('controller.content.reassign.display_name');
+    switch (this.get('controller.status')) {
+      case 'COMPLETED':
+        this.set('statusMessage', Em.I18n.t('installer.step13.status.success').format(master));
+        this.set('statusClass', 'alert-success');
+        break;
+      case 'FAILED':
+        this.set('statusMessage', Em.I18n.t('installer.step13.status.failed').format(master));
+        this.set('statusClass', 'alert-error');
+        break;
+      case 'IN_PROGRESS':
+      default:
+        this.set('statusMessage', Em.I18n.t('installer.step13.status.info').format(master));
+        this.set('statusClass', 'alert-info');
+    }
+  }.observes('controller.status'),
+
+  taskView: Em.View.extend({
+    icon: '',
+    iconColor: '',
+
+    didInsertElement: function () {
+      this.onStatus();
+    },
+
+    barWidth: function () {
+      return 'width: ' + this.get('content.progress') + '%;';
+    }.property('content.progress'),
+
+    onStatus: function () {
+      if (this.get('content.status') === 'IN_PROGRESS') {
+        this.set('icon', 'icon-cog');
+        this.set('iconColor', 'text-info');
+      } else if (this.get('content.status') === 'WARNING') {
+        this.set('icon', 'icon-warning-sign');
+        this.set('iconColor', 'text-warning');
+      } else if (this.get('content.status') === 'FAILED') {
+        this.set('icon', 'icon-exclamation-sign');
+        this.set('iconColor', 'text-error');
+      } else if (this.get('content.status') === 'COMPLETED') {
+        this.set('icon', 'icon-ok');
+        this.set('iconColor', 'text-success');
+      } else {
+        this.set('icon', 'icon-cog');
+        this.set('iconColor', '');
+      }
+    }.observes('content.status'),
+
+    inProgress: function () {
+      return this.get('content.status') === "IN_PROGRESS";
+    }.property('content.status')
+
+  })
 });

+ 0 - 95
ambari-web/app/views/wizard/step14_view.js

@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-var App = require('app');
-
-App.WizardStep14View = Em.View.extend({
-
-  templateName: require('templates/wizard/step14'),
-
-  statusMessage: null,
-  statusClass: 'alert-info',
-
-  didInsertElement: function () {
-    this.get('controller').loadStep();
-  },
-
-  tasks: function () {
-    var tasks = this.get('controller.tasks');
-    if (this.get('controller.service.serviceName') == 'GANGLIA') {
-      tasks = tasks.slice(0,2).concat(tasks.slice(4));
-    }
-    return tasks;
-  }.property('controller.tasks', 'controller.service'),
-
-  onStatus: function () {
-    var master = (this.get('controller.isCohosted')) ? Em.I18n.t('installer.step5.hiveGroup') : this.get('controller.content.reassign.display_name');
-    switch (this.get('controller.status')) {
-      case 'COMPLETED':
-        this.set('statusMessage', Em.I18n.t('installer.step14.status.success').format(master));
-        this.set('statusClass', 'alert-success');
-        break;
-      case 'FAILED':
-        this.set('statusMessage', Em.I18n.t('installer.step14.status.failed').format(master));
-        this.set('statusClass', 'alert-error');
-        break;
-      case 'IN_PROGRESS':
-      default:
-        this.set('statusMessage', Em.I18n.t('installer.step14.status.info').format(master));
-        this.set('statusClass', 'alert-info');
-    }
-  }.observes('controller.status'),
-
-  taskView: Em.View.extend({
-    icon: '',
-    iconColor: '',
-
-    didInsertElement: function () {
-      this.onStatus();
-    },
-
-    barWidth: function () {
-      return 'width: ' + this.get('content.progress') + '%;';
-    }.property('content.progress'),
-
-    onStatus: function () {
-      if (this.get('content.status') === 'IN_PROGRESS') {
-        this.set('icon', 'icon-cog');
-        this.set('iconColor', 'text-info');
-      } else if (this.get('content.status') === 'WARNING') {
-        this.set('icon', 'icon-warning-sign');
-        this.set('iconColor', 'text-warning');
-      } else if (this.get('content.status') === 'FAILED') {
-        this.set('icon', 'icon-exclamation-sign');
-        this.set('iconColor', 'text-error');
-      } else if (this.get('content.status') === 'COMPLETED') {
-        this.set('icon', 'icon-ok');
-        this.set('iconColor', 'text-success');
-      } else {
-        this.set('icon', 'icon-cog');
-        this.set('iconColor', '');
-      }
-    }.observes('content.status'),
-
-    inProgress: function () {
-      return this.get('content.status') === "IN_PROGRESS";
-    }.property('content.status')
-
-  })
-});