You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2013/09/23 19:58:00 UTC
git commit: AMBARI-3316. Reassign Master Wizard: step 4 refactoring.
(akovalenko)
Updated Branches:
refs/heads/trunk 9b2d8c487 -> f28f7e141
AMBARI-3316. Reassign Master Wizard: step 4 refactoring. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/f28f7e14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/f28f7e14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/f28f7e14
Branch: refs/heads/trunk
Commit: f28f7e141a169f2cb569409ff70b22fb967bc581
Parents: 9b2d8c4
Author: Aleksandr Kovalenko <ol...@ukr.net>
Authored: Mon Sep 23 20:55:30 2013 +0300
Committer: Aleksandr Kovalenko <ol...@ukr.net>
Committed: Mon Sep 23 20:55:30 2013 +0300
----------------------------------------------------------------------
.../highAvailability/progress_controller.js | 11 +-
.../main/service/reassign_controller.js | 22 +
.../app/controllers/wizard/step13_controller.js | 928 +++----------------
ambari-web/app/messages.js | 16 +-
ambari-web/app/routes/reassign_master_routes.js | 21 +-
.../app/templates/main/service/reassign.hbs | 2 +-
ambari-web/app/templates/wizard/step13.hbs | 36 +-
ambari-web/app/utils/ajax.js | 69 --
ambari-web/app/utils/db.js | 22 +
ambari-web/app/views/wizard/step13_view.js | 87 +-
10 files changed, 203 insertions(+), 1011 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
index 3003bae..fa7b346 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js
@@ -23,6 +23,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
name: 'highAvailabilityProgressPageController',
status: 'IN_PROGRESS',
+ clusterDeployState: 'HIGH_AVAILABILITY_DEPLOY',
tasks: [],
commands: [],
currentRequestIds: [],
@@ -35,6 +36,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
loadStep: function () {
this.clearStep();
+ this.initializeTasks();
this.loadTasks();
this.addObserver('tasks.@each.status', this, 'onTaskStatusChange');
this.onTaskStatusChange();
@@ -45,6 +47,9 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
this.set('tasks', []);
this.set('logs', []);
this.set('currentRequestIds', []);
+ },
+
+ initializeTasks: function() {
var commands = this.get('commands');
var currentStep = App.router.get('highAvailabilityWizardController.currentStep');
for (var i = 0; i < commands.length; i++) {
@@ -53,7 +58,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
status: 'PENDING',
id: i,
command: commands[i],
- showRetry: false,
+ showRetry: false,
showRollback: false,
name: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
displayName: Em.I18n.t('admin.highAvailability.wizard.step' + currentStep + '.task' + i + '.title'),
@@ -140,9 +145,9 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
var nextTask = this.get('tasks').findProperty('status', 'PENDING');
if (nextTask) {
this.set('status', 'IN_PROGRESS');
- this.runTask(nextTask.get('id'));
this.setTaskStatus(nextTask.get('id'), 'QUEUED');
this.set('currentTaskId', nextTask.get('id'));
+ this.runTask(nextTask.get('id'));
} else {
this.set('status', 'COMPLETED');
this.set('isSubmitDisabled', false);
@@ -161,7 +166,7 @@ App.HighAvailabilityProgressPageController = App.HighAvailabilityWizardControlle
App.router.get(this.get('content.controllerName')).saveLogs(logs);
App.clusterStatus.setClusterStatus({
clusterName: this.get('content.cluster.name'),
- clusterState: 'HIGH_AVAILABILITY_DEPLOY',
+ clusterState: this.get('clusterDeployState'),
wizardControllerName: this.get('content.controllerName'),
localdb: App.db.data
});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/controllers/main/service/reassign_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js
index 3ee36d2..a638fae 100644
--- a/ambari-web/app/controllers/main/service/reassign_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign_controller.js
@@ -199,6 +199,26 @@ App.ReassignMasterController = App.WizardController.extend({
console.log('ReassignMasterController.saveTasksStatuses: saved statuses', statuses);
},
+ loadRequestIds: function(){
+ var requestIds = App.db.getReassignMasterWizardRequestIds();
+ this.set('content.requestIds', requestIds);
+ },
+
+ saveRequestIds: function(requestIds){
+ App.db.setReassignMasterWizardRequestIds(requestIds);
+ this.set('content.requestIds', requestIds);
+ },
+
+ saveLogs: function(logs){
+ App.db.setReassignMasterWizardLogs(logs);
+ this.set('content.logs', logs);
+ },
+
+ loadLogs: function(){
+ var logs = App.db.getReassignMasterWizardLogs();
+ this.set('content.logs', logs);
+ },
+
/**
* Load data for all steps until <code>current step</code>
*/
@@ -207,6 +227,8 @@ App.ReassignMasterController = App.WizardController.extend({
switch (step) {
case '4':
this.loadTasksStatuses();
+ this.loadRequestIds();
+ this.loadLogs();
case '3':
case '2':
this.loadServicesFromServer();
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/controllers/wizard/step13_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step13_controller.js b/ambari-web/app/controllers/wizard/step13_controller.js
index 54fae5f..001837c 100644
--- a/ambari-web/app/controllers/wizard/step13_controller.js
+++ b/ambari-web/app/controllers/wizard/step13_controller.js
@@ -18,888 +18,176 @@
var App = require('app');
-App.WizardStep13Controller = Em.Controller.extend({
+App.WizardStep13Controller = App.HighAvailabilityProgressPageController.extend({
- status: 'IN_PROGRESS',
+ commands: ['stopServices', 'createHostComponents', 'putHostComponentsInMaintenanceMode', 'installHostComponents', 'reconfigure', 'startServices', 'deleteHostComponents'],
- 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: [],
+ clusterDeployStep: 'REASSIGN_MASTER_INSTALLING',
- /**
- * 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);
- }
- }
- },
+ componentsWithManualSteps: ['NAMENODE, SECONDARY_NAMENODE', 'JOBTRACKER'],
- configs: [],
- globals: [],
- configMapping: App.config.get('configMapping').all(),
- newConfigsTag: null,
- createdConfigs: [],
+ multiTaskCounter: 0,
- currentRequestId: [],
+ hostComponents: [],
- 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'),
+ serviceNames: [],
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);
+ if (['HIVE_METASTORE', 'WEBHCAT_SERVER'].contains(this.get('content.reassign.component_name'))) { //todo
+ this.set('hostComponents', ['HIVE_METASTORE', 'WEBHCAT']);
+ this.set('serviceNames', ['HIVE', 'WEBHCAT']);
} else {
- this.get('tasks')[task].set('status', status);
+ this.set('hostComponents', [this.get('content.reassign.component_name')]);
+ this.set('serviceNames', [this.get('content.reassign.service_id')]);
}
+ this._super();
},
- 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'
- });
+ initializeTasks: function () {
+ var commands = this.get('commands');
+ var currentStep = App.router.get('reassignMasterController.currentStep');
+ var hostComponentsNames = '';
+ var serviceNames = '';
+ this.get('hostComponents').forEach(function (comp, index) {
+ hostComponentsNames += index ? ', ' : '';
+ hostComponentsNames += App.format.role(comp);
}, this);
- },
-
- 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.get('serviceNames').forEach(function (service, index) {
+ serviceNames += index ? ', ' : '';
+ serviceNames += App.Service.find().findProperty('serviceName', service).get('displayName');
}, 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');
+ for (var i = 0; i < commands.length; i++) {
+ var title = Em.I18n.t('installer.step13.task' + i + '.title').format(hostComponentsNames, serviceNames);
+ this.get('tasks').pushObject(Ember.Object.create({
+ title: title,
+ status: 'PENDING',
+ id: i,
+ command: commands[i],
+ showRetry: false,
+ showRollback: false,
+ name: title,
+ displayName: title,
+ progress: 0,
+ isRunning: false,
+ hosts: []
+ }));
}
+ //todo
+ /*if (this.get('componentsWithManualSteps').contains(this.get('content.reassign.component_name'))) {
+ this.get('tasks').splice(4, 3);
+ }*/
},
- 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'));
- }
+ hideRollbackButton: function () {
+ var failedTask = this.get('tasks').findProperty('showRollback');
+ if (failedTask) {
+ failedTask.set('showRollback', false)
}
- 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;
- },
+ }.observes('tasks.@each.showRollback'),
- getGlobConfigValue: function (templateName, expression, name) {
- var express = expression.match(/<(.*?)>/g);
- var value = expression;
- if (express == null) {
- return expression;
+ onComponentsTasksSuccess: function () {
+ this.set('multiTaskCounter', this.get('multiTaskCounter') + 1);
+ if (this.get('multiTaskCounter') >= this.get('hostComponents').length) {
+ this.onTaskCompleted();
}
- 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');
+ stopServices: function () {
+ this.set('multiTaskCounter', 0);
+ var serviceNames = this.get('serviceNames');
+ for (var i = 0; i < serviceNames.length; i++) {
App.ajax.send({
- name: 'reassign.check_configs',
+ name: 'reassign.stop_service',
sender: this,
data: {
- serviceName: serviceName
+ serviceName: serviceNames[i],
+ displayName: App.Service.find().findProperty('serviceName', serviceNames[i]).get('displayName'),
+ taskNum: serviceNames.length
},
- success: 'onCheckConfigsSuccess',
- error: 'onCheckConfigsError'
+ success: 'startPolling',
+ error: 'onTaskError'
});
}
},
- 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);
+ createHostComponents: function () {
+ this.set('multiTaskCounter', 0);
+ var hostComponents = this.get('hostComponents');
+ var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+ for (var i = 0; i < hostComponents.length; i++) {
+ this.createComponent(hostComponents[i], hostName);
}
},
- onPutInMaintenanceModeBeforeSend: function () {
- this.setTasksStatus(4, 'PENDING');
- },
-
- onPutInMaintenanceModeSuccess: function () {
- this.setTasksStatus(4, 'COMPLETED');
+ onCreateComponent: function () {
+ this.onComponentsTasksSuccess();
},
- 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) {
+ putHostComponentsInMaintenanceMode: function () {
+ this.set('multiTaskCounter', 0);
+ var hostComponents = this.get('hostComponents');
+ var hostName = this.get('content.reassign.host_id');
+ for (var i = 0; i < hostComponents.length; i++) {
App.ajax.send({
- name: 'reassign.install_component',
+ name: 'reassign.maintenance_mode',
sender: this,
data: {
hostName: hostName,
- componentName: componentName,
- displayName: App.format.role(componentName)
+ componentName: hostComponents[i]
},
- beforeSend: 'onInstallComponentBeforeSend',
- success: 'onInstallComponentSuccess',
- error: 'onInstallComponentError'
+ success: 'onComponentsTasksSuccess',
+ error: 'onTaskError'
});
- }, 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');
+ installHostComponents: function () {
+ this.set('multiTaskCounter', 0);
+ var hostComponents = this.get('hostComponents');
+ var hostName = this.get('content.masterComponentHosts').findProperty('component', this.get('content.reassign.component_name')).hostName;
+ for (var i = 0; i < hostComponents.length; i++) {
+ this.installComponent(hostComponents[i], hostName, hostComponents.length);
}
},
- onStartComponentsError: function () {
- this.setTasksStatus(6, 'FAILED');
+ reconfigure: function () {
+ //todo
+ this.onTaskCompleted();
},
- /**
- * 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) {
+ startServices: function () {
+ this.set('multiTaskCounter', 0);
+ var serviceNames = this.get('serviceNames');
+ for (var i = 0; i < serviceNames.length; i++) {
App.ajax.send({
- name: 'reassign.get_logs',
+ name: 'reassign.start_components',
sender: this,
data: {
- requestId: requestId,
- pollCounter: this.get('dataPollCounter')
+ serviceName: serviceNames[i],
+ displayName: App.Service.find().findProperty('serviceName', serviceNames[i]).get('displayName'),
+ taskNum: serviceNames.length
},
- success: 'onGetLogsByRequestSuccess',
- error: 'onGetLogsByRequestError'
+ success: 'startPolling',
+ error: 'onTaskError'
});
- }, 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) {
+ deleteHostComponents: function () {
+ this.set('multiTaskCounter', 0);
+ var hostComponents = this.get('hostComponents');
+ var hostName = this.get('content.reassign.host_id');
+ for (var i = 0; i < hostComponents.length; i++) {
App.ajax.send({
- name: 'reassign.maintenance_mode',
+ name: 'reassign.remove_component',
sender: this,
data: {
hostName: hostName,
- componentName: componentName
+ componentName: hostComponents[i]
},
- 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
+ success: 'onComponentsTasksSuccess',
+ error: 'onTaskError'
});
- 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>')
- })
- });
}
-})
+})
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 3432941..ddcfb70 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -554,14 +554,14 @@ Em.I18n.translations = {
'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.header':'Install, Start and Test',
+ 'installer.step13.task0.title':'{1} stop',
+ 'installer.step13.task1.title':'{0} create',
+ 'installer.step13.task2.title':'{0} disable',
+ 'installer.step13.task3.title':'{0} install',
+ 'installer.step13.task4.title':'{1} reconfigure',
+ 'installer.step13.task5.title':'{1} start',
+ 'installer.step13.task6.title':'{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.',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index 36c98ce..d4a054d 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -24,7 +24,7 @@ module.exports = Em.Route.extend({
Em.run.next(function () {
var reassignMasterController = router.get('reassignMasterController');
App.router.get('updateController').set('isWorking', false);
- App.ModalPopup.show({
+ var popup = App.ModalPopup.show({
classNames: ['full-width-modal'],
header:Em.I18n.t('services.reassign.header'),
bodyClass: App.ReassignMasterView.extend({
@@ -48,14 +48,16 @@ module.exports = Em.Route.extend({
this.fitHeight();
}
});
-
+ reassignMasterController.set('popup', popup);
App.clusterStatus.updateFromServer();
var currentClusterStatus = App.clusterStatus.get('value');
- if (currentClusterStatus && currentClusterStatus.clusterState == 'REASSIGN_MASTER_INSTALLING') {
- reassignMasterController.setCurrentStep('4');
- App.db.data = currentClusterStatus.localdb;
- } else {
- reassignMasterController.setCurrentStep('1');
+ if (currentClusterStatus) {
+ switch (currentClusterStatus.clusterState) {
+ case 'REASSIGN_MASTER_INSTALLING' :
+ App.db.data = currentClusterStatus.localdb;
+ reassignMasterController.setCurrentStep(currentClusterStatus.localdb.ReassignMaster.currentStep);
+ break;
+ }
}
router.transitionTo('step' + reassignMasterController.get('currentStep'));
});
@@ -131,16 +133,17 @@ module.exports = Em.Route.extend({
controller.setCurrentStep('4');
controller.dataLoading().done(function () {
controller.loadAllPriorSteps();
+ controller.setLowerStepsDisable(4);
controller.connectOutlet('wizardStep13', controller.get('content'));
})
},
back: Em.Router.transitionTo('step3'),
- complete: function (router, context) {
+ next: function (router, context) {
var controller = router.get('reassignMasterController');
var wizardStep13Controller = router.get('wizardStep13Controller');
if (!wizardStep13Controller.get('isSubmitDisabled')) {
controller.finish();
- $(context.currentTarget).parents("#modal").find(".close").trigger('click');
+ controller.get('popup').hide();
App.clusterStatus.setClusterStatus({
clusterName: router.get('reassignMasterController.content.cluster.name'),
clusterState: 'REASSIGN_MASTER_COMPLETED',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/templates/main/service/reassign.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/reassign.hbs b/ambari-web/app/templates/main/service/reassign.hbs
index 3edd945..6f7d6b1 100644
--- a/ambari-web/app/templates/main/service/reassign.hbs
+++ b/ambari-web/app/templates/main/service/reassign.hbs
@@ -28,7 +28,7 @@
<li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t installer.step11.header}}</a></li>
<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="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t installer.step13.header}}</a></li>
</ul>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/templates/wizard/step13.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step13.hbs b/ambari-web/app/templates/wizard/step13.hbs
index 8e61f53..defea53 100644
--- a/ambari-web/app/templates/wizard/step13.hbs
+++ b/ambari-web/app/templates/wizard/step13.hbs
@@ -15,38 +15,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
-<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>
- {{#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}}%</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}} →</a>
-</div>
+{{template "templates/main/admin/highAvailability/progress"}}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index adf7d16..4ee675c 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -97,24 +97,6 @@ var urls = {
}
}
},
- 'reassign.create_master': {
- 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
- 'mock':'',
- 'type': 'POST',
- 'format': function (data) {
- return {
- data: JSON.stringify({
- "host_components": [
- {
- "HostRoles": {
- "component_name": data.componentName
- }
- }
- ]
- })
- }
- }
- },
'reassign.maintenance_mode': {
'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
'mock':'',
@@ -131,25 +113,6 @@ var urls = {
}
}
},
- 'reassign.install_component': {
- 'mock': '/data/wizard/reassign/request_id.json',
- 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
- 'type': 'PUT',
- 'format': function (data) {
- return {
- data: JSON.stringify({
- RequestInfo: {
- "context": "Install " + data.displayName
- },
- Body: {
- "HostRoles": {
- "state": "INSTALLED"
- }
- }
- })
- }
- }
- },
'reassign.start_components': {
'mock': '/data/wizard/reassign/request_id.json',
'real': '/clusters/{clusterName}/services/{serviceName}',
@@ -174,38 +137,6 @@ var urls = {
'mock':'',
'type': 'DELETE'
},
- 'reassign.get_logs': {
- 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/*',
- 'mock': '/data/wizard/reassign/step14PolledData/tasks_poll{pollCounter}.json',
- 'type': 'GET'
-
- },
- 'reassign.create_configs': {
- 'real': '/clusters/{clusterName}/configurations',
- 'mock':'',
- 'type': 'POST',
- 'format': function (data) {
- return {
- data: JSON.stringify(data.configs),
- configs: data.configs
- }
- }
- },
- 'reassign.check_configs': {
- 'real': '/clusters/{clusterName}/services/{serviceName}',
- 'mock':'',
- 'type': 'GET'
- },
- 'reassign.apply_configs': {
- 'real': '/clusters/{clusterName}/services/{serviceName}',
- 'mock':'',
- 'type': 'PUT',
- 'format': function (data) {
- return {
- data: JSON.stringify(data.configs)
- }
- }
- },
'config.advanced': {
'real': '{stack2VersionUrl}/stackServices/{serviceName}/configurations?fields=*',
'mock': '/data/wizard/stack/hdp/version{stackVersion}/{serviceName}.json',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index d89ab2c..b89276b 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -391,6 +391,18 @@ App.db.setHighAvailabilityWizardNameServiceId = function (nameServiceId) {
localStorage.setObject('ambari', App.db.data);
};
+App.db.setReassignMasterWizardRequestIds = function (requestIds) {
+ App.db.data = localStorage.getObject('ambari');
+ App.db.data.ReassignMaster.requestIds = requestIds;
+ localStorage.setObject('ambari', App.db.data);
+};
+
+App.db.setReassignMasterWizardLogs = function (logs) {
+ App.db.data = localStorage.getObject('ambari');
+ App.db.data.ReassignMaster.logs = logs;
+ localStorage.setObject('ambari', App.db.data);
+};
+
/*
* getter methods
*/
@@ -639,4 +651,14 @@ App.db.getHighAvailabilityWizardNameServiceId = function () {
return App.db.data.HighAvailabilityWizard.nameServiceId;
};
+App.db.getReassignMasterWizardRequestIds = function () {
+ App.db.data = localStorage.getObject('ambari');
+ return App.db.data.ReassignMaster.requestIds;
+};
+
+App.db.getReassignMasterWizardLogs = function () {
+ App.db.data = localStorage.getObject('ambari');
+ return App.db.data.ReassignMaster.logs;
+};
+
module.exports = App.db;
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f28f7e14/ambari-web/app/views/wizard/step13_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step13_view.js b/ambari-web/app/views/wizard/step13_view.js
index 5d6e1cd..723240a 100644
--- a/ambari-web/app/views/wizard/step13_view.js
+++ b/ambari-web/app/views/wizard/step13_view.js
@@ -19,77 +19,32 @@
var App = require('app');
-App.WizardStep13View = Em.View.extend({
+App.WizardStep13View = App.HighAvailabilityProgressPageView.extend({
- templateName: require('templates/wizard/step13'),
+ headerTitle: Em.I18n.t('installer.step13.header'),
- statusMessage: null,
- statusClass: 'alert-info',
+ hostComponents: function () {
+ var result = '';
+ this.get('controller.hostComponents').forEach(function (comp, index) {
+ result += index ? ', ' : '';
+ result += App.format.role(comp);
+ }, this);
+ return result;
+ }.property('controller.hostComponents'),
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
+ noticeInProgress: function () {
+ return Em.I18n.t('installer.step13.status.info').format(this.get('hostComponents'));
+ }.property('hostComponents'),
- 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'),
+ noticeFailed: function () {
+ return Em.I18n.t('installer.step13.status.failed').format(this.get('hostComponents'));
+ }.property('hostComponents'),
- 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'),
+ noticeCompleted: function () {
+ return Em.I18n.t('installer.step13.status.success').format(this.get('hostComponents'));
+ }.property('hostComponents'),
- taskView: Em.View.extend({
- icon: '',
- iconColor: '',
+ submitButtonText: Em.I18n.t('common.complete'),
- 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')
-
- })
+ templateName: require('templates/wizard/step13')
});