You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2016/04/29 13:33:05 UTC
ambari git commit: AMBARI-16181. maintenance_state isn't mapped on
the Move Wizards (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 03600998f -> a3c4d46c7
AMBARI-16181. maintenance_state isn't mapped on the Move Wizards (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a3c4d46c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a3c4d46c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a3c4d46c
Branch: refs/heads/trunk
Commit: a3c4d46c71a8f38750612ce154e7707617cba8ae
Parents: 0360099
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Apr 29 14:07:47 2016 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Apr 29 14:07:47 2016 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/wizard.js | 46 +++++----
.../wizard/step7/assign_master_controller.js | 10 +-
ambari-web/app/utils/ajax/ajax.js | 4 +-
.../app/views/main/service/reassign_view.js | 1 +
.../widgets/create/step3_controller_test.js | 28 ++----
.../config_recommendation_parser_test.js | 9 +-
.../objects/service_config_property_test.js | 98 +-------------------
ambari-web/test/models/form_test.js | 28 +-----
ambari-web/test/utils/blueprint_test.js | 2 +-
9 files changed, 45 insertions(+), 181 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 52fb241..2aacf28 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -49,7 +49,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
sensibleConfigs: [
{ name: 'admin_principal', filename: 'krb5-conf.xml'},
- { name: 'admin_password', filename: 'krb5-conf.xml' }
+ { name: 'admin_password', filename: 'krb5-conf.xml' }
],
init: function () {
@@ -57,10 +57,12 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
this.setIsStepDisabled();
},
- connectOutlet:function(name, context) {
+ connectOutlet:function(name) {
if (name !== 'loading') this.set('isStepDisabled.isLocked', false);
- App.get('router').set('transitionInProgress', false);
- App.get('router').set('nextBtnClickInProgress', false);
+ App.router.setProperties({
+ transitionInProgress: false,
+ nextBtnClickInProgress: false
+ });
return this._super.apply(this,arguments);
},
@@ -78,7 +80,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
obj.reopen({
isLocked:true,
get:function (key) {
- return (key === 'value' && this.get('isLocked')) || this._super.apply(this,arguments);
+ return key === 'value' && this.get('isLocked') || this._super.apply(this,arguments);
},
notifyValues:function () {
this.notifyPropertyChange('value');
@@ -140,7 +142,8 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
osType: dbHosts[hostName].osType ? dbHosts[hostName].osType: 0,
osArch: dbHosts[hostName].osArch ? dbHosts[hostName].osArch : 0,
ip: dbHosts[hostName].ip ? dbHosts[hostName].ip: 0,
- hostComponents: hostComponents
+ hostComponents: hostComponents,
+ maintenanceState: dbHosts[hostName].maintenance_state
}))
}
return hosts;
@@ -253,7 +256,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}
// if going back from Step 9 in Install Wizard, delete the checkpoint so that the user is not redirected
// to Step 9
- if (this.get('content.controllerName') == 'installerController' && this.get('currentStep') === '9' && step < 9) {
+ if (this.get('content.controllerName') === 'installerController' && this.get('currentStep') === '9' && step < 9) {
App.clusterStatus.setClusterStatus({
clusterName: this.get('clusterName'),
clusterState: 'CLUSTER_NOT_CREATED_1',
@@ -487,13 +490,13 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
* @param log
*/
finishLoading: function (requestId, serverError, status, log) {
- if (Em.isNone(requestId) || status == 'ERROR') {
+ if (Em.isNone(requestId) || status === 'ERROR') {
var stepController = App.get('router.wizardStep3Controller');
this.setProperties({
isError: true,
showFooter: true,
showCloseButton: true,
- serverError: status == 'ERROR' ? log : serverError
+ serverError: status === 'ERROR' ? log : serverError
});
stepController.setProperties({
isRegistrationInProgress: false,
@@ -654,10 +657,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}, this);
} else {
jsonData.items.forEach(function (service) {
- if (savedSelectedServices.contains(service.StackServices.service_name))
- service.StackServices.is_selected = true;
- else
- service.StackServices.is_selected = false;
+ service.StackServices.is_selected = savedSelectedServices.contains(service.StackServices.service_name);
}, this);
}
@@ -667,10 +667,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}, this);
} else {
jsonData.items.forEach(function (service) {
- if (savedInstalledServices.contains(service.StackServices.service_name))
- service.StackServices.is_installed = true;
- else
- service.StackServices.is_installed = false;
+ service.StackServices.is_installed = savedInstalledServices.contains(service.StackServices.service_name);
}, this);
}
@@ -734,7 +731,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}
stepController.get('confirmedHosts').forEach(function (_host) {
- if (_host.bootStatus == 'REGISTERED') {
+ if (_host.bootStatus === 'REGISTERED') {
hosts[_host.name] = {
name: _host.name,
cpu: _host.cpu,
@@ -743,6 +740,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
os_type: _host.os_type,
os_arch: _host.os_arch,
ip: _host.ip,
+ maintenance_state: _host.maintenance_state,
bootStatus: _host.bootStatus,
isInstalled: false,
id: indx++
@@ -913,7 +911,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
if (installedServiceNamesMap[_content.get('serviceName')]) {
// get only modified configs
var configs = _content.get('configs').filter(function (config) {
- if (config.get('isNotDefaultValue') || (config.get('savedValue') === null)) {
+ if (config.get('isNotDefaultValue') || config.get('savedValue') === null) {
return config.isRequiredByAgent!== false;
}
return false;
@@ -996,7 +994,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
Em.get(configGroup, 'properties').forEach(function (config) {
hash[Em.get(config, 'name')] = {value: Em.get(config, 'value'), isFinal: Em.get(config, 'isFinal')};
});
- hash['hosts'] = hosts || Em.get(configGroup, 'hosts');
+ hash.hosts = hosts || Em.get(configGroup, 'hosts');
return JSON.stringify(hash);
},
@@ -1019,7 +1017,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
uninstalledComponents.push(component);
}
}, this);
- installedComponentsMap['HDFS_CLIENT'] = [];
+ installedComponentsMap.HDFS_CLIENT = [];
App.HostComponent.find().forEach(function (hostComponent) {
if (installedComponentsMap[hostComponent.get('componentName')]) {
@@ -1028,7 +1026,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
}, this);
for (var componentName in installedComponentsMap) {
- var name = (componentName === 'HDFS_CLIENT') ? 'CLIENT' : componentName;
+ var name = componentName === 'HDFS_CLIENT' ? 'CLIENT' : componentName;
var component = {
componentName: name,
displayName: App.format.role(name, false),
@@ -1127,7 +1125,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
var dfd = $.Deferred();
for (var s in loadMap) {
- if (parseInt(s) <= parseInt(currentStep)) {
+ if (parseInt(s, 10) <= parseInt(currentStep, 10)) {
operationStack.pushObjects(loadMap[s]);
}
}
@@ -1170,7 +1168,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
this.setDBProperty('services',services);
} else {
App.StackService.find().forEach(function(item) {
- var isSelected = services.selectedServices.contains(item.get('serviceName'));
+ var isSelected = services.selectedServices.contains(item.get('serviceName'));
var isInstalled = services.installedServices.contains(item.get('serviceName'));
item.set('isSelected', isSelected);
item.set('isInstalled', isInstalled);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
index 410e42b..4c8eccc 100644
--- a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
+++ b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
@@ -32,7 +32,7 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
configActionComponent: {},
content: function () {
- return (this.get('configWidgetContext.controller.content') || {});
+ return this.get('configWidgetContext.controller.content') || {};
}.property('configWidgetContext.controller.content'),
popup: null,
@@ -181,6 +181,7 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
host_name: hosts[p].get('hostName'),
cpu: hosts[p].get('cpu'),
memory: hosts[p].get('memory'),
+ maintenance_state: hosts[p].get('maintenance_state'),
disk_info: hosts[p].get('diskInfo'),
host_info: Em.I18n.t('installer.step5.hostInfo').fmt(hosts[p].get('hostName'), numberUtils.bytesToSize(hosts[p].get('memory'), 1, 'parseFloat', 1024), hosts[p].get('cpu'))
}));
@@ -252,7 +253,6 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
saveRecommendationsHostGroups: function() {
var controller = App.router.get(this.get('content.controllerName'));
var recommendationsHostGroups = this.get('content.recommendationsHostGroups');
- var masterComponentHosts = this.get('content.masterComponentHosts');
var mastersToCreate = this.get('mastersToCreate');
mastersToCreate.forEach(function(componentName) {
var hostName = this.getSelectedHostName(componentName);
@@ -262,14 +262,14 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
var i = 0;
while (i < hostGroups.length) {
var hosts = hostGroups[i].hosts;
- isHostPresent = hosts.someProperty('fqdn', hostName);
+ isHostPresent = hosts.someProperty('fqdn', hostName);
if (isHostPresent) break;
i++;
}
if (isHostPresent) {
var hostGroupName = hostGroups[i].name;
- var hostGroup = recommendationsHostGroups.blueprint.host_groups.findProperty('name', hostGroupName);
- var addHostComponentInGroup = !hostGroup.components.someProperty('name', componentName);
+ var hostGroup = recommendationsHostGroups.blueprint.host_groups.findProperty('name', hostGroupName);
+ var addHostComponentInGroup = !hostGroup.components.someProperty('name', componentName);
if (addHostComponentInGroup) {
hostGroup.components.pushObject({name: componentName});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index a7087c9..d32afc9 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2453,7 +2453,7 @@ var urls = {
'mock': '/data/hosts/quick_links.json'
},
'hosts.confirmed.install': {
- 'real': '/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
+ 'real': '/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/maintenance_state&minimal_response=true',
'mock': ''
},
'hosts.confirmed': {
@@ -2551,7 +2551,7 @@ var urls = {
}
},
'hosts.high_availability.wizard': {
- 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
+ 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/maintenance_state&minimal_response=true',
'mock': ''
},
'hosts.security.wizard': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/app/views/main/service/reassign_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reassign_view.js b/ambari-web/app/views/main/service/reassign_view.js
index fd2776d..4adbf11 100644
--- a/ambari-web/app/views/main/service/reassign_view.js
+++ b/ambari-web/app/views/main/service/reassign_view.js
@@ -84,6 +84,7 @@ App.ReassignMasterView = Em.View.extend(App.WizardMenuMixin, {
cpu: item.Hosts.cpu_count,
memory: item.Hosts.total_mem,
disk_info: item.Hosts.disk_info,
+ maintenance_state: item.Hosts.maintenance_state,
bootStatus: "REGISTERED",
isInstalled: true
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
index d54d04a..b0386a9 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
@@ -30,10 +30,6 @@ describe('App.WidgetWizardStep3Controller', function () {
App.TestAliases.testAsComputedIfThenElse(controller, 'widgetScope', 'isSharedChecked', 'Cluster', 'User');
- //App.TestAliases.testAsComputedGte(controller, 'isNameInvalid', 'widgetName.length', 129);
-
- //App.TestAliases.testAsComputedGte(controller, 'isDescriptionInvalid', 'widgetDescription.length', 2049);
-
App.TestAliases.testAsComputedOr(controller, 'isSubmitDisabled', ['widgetNameEmpty', 'isNameInvalid', 'isDescriptionInvalid']);
describe("#validateName", function(){
@@ -68,15 +64,12 @@ describe('App.WidgetWizardStep3Controller', function () {
}
];
- testCases.forEach(function(test){
- controller.setProperties({
- widgetName: test.widgetName
+ testCases.forEach(function(test) {
+ it(JSON.stringify(test.widgetName), function () {
+ controller.set('widgetName', test.widgetName);
+ expect(controller.get('widgetNameErrorMessage')).to.equal(test.result.errorMessage);
+ expect(controller.get('isNameInvalid')).to.equal(test.result.isNameInvalid);
});
-
- //Since validateName() observes the property "widgetName", Ember framework will call it
-
- expect(controller.get('widgetNameErrorMessage')).to.equal(test.result.errorMessage);
- expect(controller.get('isNameInvalid')).to.equal(test.result.isNameInvalid);
});
});
@@ -113,14 +106,11 @@ describe('App.WidgetWizardStep3Controller', function () {
];
testCases.forEach(function(test){
- controller.setProperties({
- widgetDescription: test.widgetDescription
+ it(JSON.stringify(test.widgetDescription), function () {
+ controller.set('widgetDescription', test.widgetDescription);
+ expect(controller.get('descriptionErrorMessage')).to.equal(test.result.errorMessage);
+ expect(controller.get('isDescriptionInvalid')).to.equal(test.result.isDescriptionInvalid);
});
-
- //Since validateDescription() observes the property "widgetDescription", Ember framework will call it
-
- expect(controller.get('descriptionErrorMessage')).to.equal(test.result.errorMessage);
- expect(controller.get('isDescriptionInvalid')).to.equal(test.result.isDescriptionInvalid);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
index ae668c7..8b983f1 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
@@ -18,6 +18,8 @@
var App = require('app');
+var helpers = require('test/helpers');
+
describe('App.ConfigRecommendationParser', function() {
var mixinObject = Em.Controller.extend(App.ConfigRecommendationParser, {});
var instanceObject = mixinObject.create({});
@@ -284,12 +286,7 @@ describe('App.ConfigRecommendationParser', function() {
};
var test = instanceObject._createNewProperty('name', 'fileName', 'recommendedValue', null);
-
- for (var k in res) {
- if (res.hasOwnProperty(k)) {
- expect(test.get(k)).to.eql(res[k]);
- }
- }
+ helpers.nestedExpect([res], [test]);
expect(instanceObject.applyRecommendation.calledOnce).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js
index 3a1d14c..a6772d3 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -173,104 +173,8 @@ var serviceConfigProperty,
value: 'value',
savedValue: 'default'
},
- types = ['componentHost', 'componentHosts', 'radio button'],
- classCases = [
- {
- initial: {
- displayType: 'checkbox'
- },
- viewClass: App.ServiceConfigCheckbox
- },
- {
- initial: {
- displayType: 'checkbox',
- dependentConfigPattern: 'somPattern'
- },
- viewClass: App.ServiceConfigCheckboxWithDependencies
- },
- {
- initial: {
- displayType: 'password'
- },
- viewClass: App.ServiceConfigPasswordField
- },
- {
- initial: {
- displayType: 'combobox'
- },
- viewClass: App.ServiceConfigComboBox
- },
- {
- initial: {
- displayType: 'radio button'
- },
- viewClass: App.ServiceConfigRadioButtons
- },
- {
- initial: {
- displayType: 'directories'
- },
- viewClass: App.ServiceConfigTextArea
- },
- {
- initial: {
- displayType: 'content'
- },
- viewClass: App.ServiceConfigTextAreaContent
+ types = ['componentHost', 'componentHosts', 'radio button'];
- },
- {
- initial: {
- displayType: 'multiLine'
- },
- viewClass: App.ServiceConfigTextArea
- },
- {
- initial: {
- displayType: 'custom'
- },
- viewClass: App.ServiceConfigBigTextArea
- },
- {
- initial: {
- displayType: 'componentHost'
- },
- viewClass: App.ServiceConfigMasterHostView
- },
- {
- initial: {
- displayType: 'componentHosts'
- },
- viewClass: App.ServiceConfigComponentHostsView
- },
- {
- initial: {
- displayType: 'componentHosts'
- },
- viewClass: App.ServiceConfigComponentHostsView
- },
- {
- initial: {
- unit: true,
- displayType: 'type'
- },
- viewClass: App.ServiceConfigTextFieldWithUnit
- },
- {
- initial: {
- unit: false,
- displayType: 'type'
- },
- viewClass: App.ServiceConfigTextField
- },
- {
- initial: {
- unit: false,
- displayType: 'supportTextConnection'
- },
- viewClass: App.checkConnectionView
- }
- ];
function getProperty() {
return App.ServiceConfigProperty.create();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/test/models/form_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/form_test.js b/ambari-web/test/models/form_test.js
index 573deae..fab811d 100644
--- a/ambari-web/test/models/form_test.js
+++ b/ambari-web/test/models/form_test.js
@@ -37,28 +37,6 @@ var form,
result: 0
}
],
- displayTypeCases = [
- {
- type: 'checkbox',
- classString: 'Checkbox'
- },
- {
- type: 'select',
- classString: 'Select'
- },
- {
- type: 'textarea',
- classString: 'TextArea'
- },
- {
- type: 'password',
- classString: 'TextField'
- },
- {
- type: 'hidden',
- classString: 'TextField'
- }
- ],
hiddenCases = [
{
displayType: 'password',
@@ -70,11 +48,7 @@ var form,
type: 'hidden',
value: true
}
- ],
- expectError = function (message) {
- formField.validate();
- expect(formField.get('errorMessage')).to.equal(message);
- };
+ ];
describe('App.Form', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3c4d46c/ambari-web/test/utils/blueprint_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js
index 6ada088..d0180fe 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -481,7 +481,7 @@ describe('utils/blueprint', function() {
]
}
};
- expect(blueprintUtils.getHostGroupByFqdn(bp, 'host1.name')).to.be.eql('host1-group');
+ expect(blueprintUtils.getHostGroupByFqdn(bp, 'host1.name')).to.be.equal('host1-group');
});
});