You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/04/23 17:04:53 UTC
[1/5] ambari git commit: AMBARI-10693. Install clients on host:
dependent clients aren't installed,
dependencies info is displayed behind BG operations popup (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 7113ce228 -> ee3bfa112
AMBARI-10693. Install clients on host: dependent clients aren't installed, dependencies info is displayed behind BG operations popup (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/14436286
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/14436286
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/14436286
Branch: refs/heads/trunk
Commit: 14436286b425c2b83ba9afa57cded39319abbef8
Parents: 7113ce2
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 23 15:23:55 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 23 18:04:48 2015 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 103 +++++++----
ambari-web/app/messages.js | 1 +
.../test/controllers/main/host/details_test.js | 185 ++++++++++++++-----
3 files changed, 206 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/14436286/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 99fea74..d23fc79 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -432,20 +432,18 @@ App.MainHostDetailsController = Em.Controller.extend({
* add component as <code>addComponent<code> method but perform
* kdc sessionstate if cluster is secure;
* @param event
- * @param skipConfirmation
*/
- addComponentWithCheck: function (event, skipConfirmation) {
+ addComponentWithCheck: function (event) {
var componentName = event.context ? event.context.get('componentName') : "";
event.hiveMetastoreHost = (componentName == "HIVE_METASTORE" && !!this.get('content.hostName')) ? this.get('content.hostName') : null;
- App.get('router.mainAdminKerberosController').getKDCSessionState(this.addComponent.bind(this, event, skipConfirmation));
+ App.get('router.mainAdminKerberosController').getKDCSessionState(this.addComponent.bind(this, event));
},
/**
* Send command to server to install selected host component
* @param {object} event
- * @param {boolean} skipConfirmation
* @method addComponent
*/
- addComponent: function (event, skipConfirmation) {
+ addComponent: function (event) {
var
returnFunc,
self = this,
@@ -477,41 +475,40 @@ App.MainHostDetailsController = Em.Controller.extend({
}, Em.I18n.t('hosts.host.addComponent.' + componentName ));
break;
default:
- returnFunc = this.addClientComponent(component, skipConfirmation);
+ returnFunc = this.addClientComponent(component);
}
return returnFunc;
},
/**
* Send command to server to install client on selected host
* @param component
- * @param skipConfirmation
*/
- addClientComponent: function (component, skipConfirmation) {
+ addClientComponent: function (component) {
var self = this;
var message = this.formatClientsMessage(component);
- var returnFunction;
- if (skipConfirmation) {
- returnFunction = this.primary(component);
- } else {
- returnFunction = App.ModalPopup.show({
- primary: Em.I18n.t('hosts.host.addComponent.popup.confirm'),
- header: Em.I18n.t('popup.confirmation.commonHeader'),
+ return this.showAddComponentPopup(message, function () {
+ self.primary(component);
+ });
+ },
- addComponentMsg: function () {
- return Em.I18n.t('hosts.host.addComponent.msg').format(message);
- }.property(),
+ showAddComponentPopup: function (message, primary) {
+ return App.ModalPopup.show({
+ primary: Em.I18n.t('hosts.host.addComponent.popup.confirm'),
+ header: Em.I18n.t('popup.confirmation.commonHeader'),
- bodyClass: Em.View.extend({
- templateName: require('templates/main/host/details/addComponentPopup')
- }),
+ addComponentMsg: function () {
+ return Em.I18n.t('hosts.host.addComponent.msg').format(message);
+ }.property(),
- onPrimary: function () {
- this.hide();
- self.primary(component);
- }
- });
- }
- return returnFunction;
+ bodyClass: Em.View.extend({
+ templateName: require('templates/main/host/details/addComponentPopup')
+ }),
+
+ onPrimary: function () {
+ this.hide();
+ primary();
+ }
+ });
},
/**
@@ -1933,7 +1930,10 @@ App.MainHostDetailsController = Em.Controller.extend({
installClients: function(event) {
var clientsToInstall = [],
- clientsToAdd = [];
+ clientsToAdd = [],
+ missedComponents = [],
+ dependentComponents = [],
+ self = this;
event.context.forEach(function (component) {
if (['INIT', 'INSTALL_FAILED'].contains(component.get('workStatus'))) {
clientsToInstall.push(component);
@@ -1941,14 +1941,45 @@ App.MainHostDetailsController = Em.Controller.extend({
clientsToAdd.push(component);
}
});
- if (clientsToInstall.length) {
- this.sendComponentCommand(clientsToInstall, Em.I18n.t('host.host.details.installClients'), 'INSTALLED');
- }
- clientsToAdd.forEach(function (component) {
- this.addComponentWithCheck({
- context: component
- }, true);
+ clientsToAdd.forEach(function (component, index, array) {
+ var dependencies = componentsUtils.checkComponentDependencies(component.get('componentName'), {
+ scope: 'host',
+ installedComponents: this.get('content.hostComponents').mapProperty('componentName')
+ }).reject(function (componentName) {
+ return array.mapProperty('componentName').contains(componentName);
+ });
+ if (dependencies.length) {
+ missedComponents.pushObjects(dependencies);
+ dependentComponents.push(component.get('displayName'));
+ }
}, this);
+ missedComponents = missedComponents.uniq();
+ if (missedComponents.length) {
+ var popupMessage = Em.I18n.t('host.host.addComponent.popup.clients.dependedComponents.body').format(stringUtils.getFormattedStringFromArray(dependentComponents),
+ stringUtils.getFormattedStringFromArray(missedComponents.map(function(componentName) {
+ return App.StackServiceComponent.find(componentName).get('displayName');
+ })));
+ App.showAlertPopup(Em.I18n.t('host.host.addComponent.popup.dependedComponents.header'), popupMessage);
+ } else {
+ App.get('router.mainAdminKerberosController').getKDCSessionState(function () {
+ var sendInstallCommand = function () {
+ if (clientsToInstall.length) {
+ self.sendComponentCommand(clientsToInstall, Em.I18n.t('host.host.details.installClients'), 'INSTALLED');
+ }
+ };
+ if (clientsToAdd.length) {
+ var message = stringUtils.getFormattedStringFromArray(clientsToAdd.mapProperty('displayName'));
+ self.showAddComponentPopup(message, function () {
+ sendInstallCommand();
+ clientsToAdd.forEach(function (component) {
+ this.primary(component);
+ }, self);
+ });
+ } else {
+ sendInstallCommand();
+ }
+ });
+ }
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/14436286/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 31aeb67..3e43684 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2142,6 +2142,7 @@ Em.I18n.translations = {
'hosts.host.addComponent.deleteHostWithZooKeeper':'Deleting host with ZooKeeper Server may reconfigure such properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li><li>yarn.resourcemanager.zk-address</li><li>hive.zookeeper.quorum</li><li>hive.cluster.delegation.token.store.zookeeper.connectString</li></ul>',
'host.host.addComponent.popup.dependedComponents.body': '{0} requires {1} to be installed along with it on the same host. Please add them first and then try adding {0}',
'host.host.addComponent.popup.dependedComponents.header': 'Component dependencies',
+ 'host.host.addComponent.popup.clients.dependedComponents.body': '{0} require {1} to be installed along with them on the same host. Please add them first',
'hosts.host.zooKeeper.configs.save.note': 'This configuration is created by ambari while installing/deleting zookeeper component on a host',
'hosts.host.addComponent.securityNote':'You are running your cluster in secure mode. You must set up the keytab for {0} on {1} before you proceed. Otherwise, the component will not be able to start properly.',
'hosts.host.addComponent.popup.confirm':'Confirm Add',
http://git-wip-us.apache.org/repos/asf/ambari/blob/14436286/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 84545d0..1a7c2ca 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -499,24 +499,44 @@ describe('App.MainHostDetailsController', function () {
});
beforeEach(function () {
- sinon.spy(App.ModalPopup, "show");
- sinon.stub(controller, "primary", Em.K);
+ sinon.stub(controller, 'showAddComponentPopup', Em.K);
});
afterEach(function () {
- App.ModalPopup.show.restore();
- controller.primary.restore();
+ controller.showAddComponentPopup.restore();
});
it('any CLIENT component', function () {
var popup = controller.addClientComponent(component);
- expect(App.ModalPopup.show.calledOnce).to.be.true;
- popup.onPrimary();
- expect(controller.primary.calledWith(component)).to.be.true;
+ expect(controller.showAddComponentPopup.calledOnce).to.be.true;
+ });
+
+ });
+
+ describe('#showAddComponentPopup()', function () {
+
+ var message = 'Comp1',
+ component = Em.Object.create({
+ componentName: ' Comp1'
+ });
+
+ beforeEach(function () {
+ sinon.spy(App.ModalPopup, 'show');
+ sinon.stub(controller, 'primary', Em.K);
+ });
+
+ afterEach(function () {
+ App.ModalPopup.show.restore();
+ controller.primary.restore();
});
- it('should launch primary method without confirmation', function () {
- controller.addClientComponent(component, true);
+ it('should display add component confirmation', function () {
+ var popup = controller.showAddComponentPopup(message, function () {
+ controller.primary(component);
+ });
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
+ expect(popup.get('addComponentMsg')).to.eql(Em.I18n.t('hosts.host.addComponent.msg').format(message));
+ popup.onPrimary();
expect(controller.primary.calledWith(component)).to.be.true;
});
});
@@ -2148,50 +2168,121 @@ describe('App.MainHostDetailsController', function () {
});
describe('#installClients()', function () {
+
+ var cases = [
+ {
+ context: [
+ Em.Object.create({
+ componentName: 'c0',
+ workStatus: 'INSTALLED'
+ }),
+ Em.Object.create({
+ componentName: 'c1',
+ workStatus: 'INIT'
+ }),
+ Em.Object.create({
+ componentName: 'c2',
+ workStatus: 'INSTALL_FAILED'
+ })
+ ],
+ dependencies: {
+ c0: [],
+ c1: [],
+ c2: []
+ },
+ getKDCSessionStateCalled: true,
+ sendComponentCommandCalled: true,
+ showAlertPopupCalled: false,
+ title: 'No clients to add, some clients to install'
+ },
+ {
+ context: [
+ Em.Object.create({
+ componentName: 'c3',
+ displayName: 'c3'
+ })
+ ],
+ dependencies: {
+ c3: []
+ },
+ getKDCSessionStateCalled: true,
+ sendComponentCommandCalled: false,
+ showAlertPopupCalled: false,
+ title: 'No clients to install, some clients to add'
+ },
+ {
+ context: [
+ Em.Object.create({
+ componentName: 'c4',
+ displayName: 'c4'
+ })
+ ],
+ dependencies: {
+ c4: ['c5']
+ },
+ getKDCSessionStateCalled: false,
+ sendComponentCommandCalled: false,
+ showAlertPopupCalled: true,
+ title: 'Clients to add have unresolved dependencies'
+ },
+ {
+ context: [
+ Em.Object.create({
+ componentName: 'c5',
+ displayName: 'c5'
+ }),
+ Em.Object.create({
+ componentName: 'c6',
+ displayName: 'c6'
+ })
+ ],
+ dependencies: {
+ c5: ['c6'],
+ c6: ['c5']
+ },
+ getKDCSessionStateCalled: true,
+ sendComponentCommandCalled: false,
+ showAlertPopupCalled: false,
+ title: 'Clients to add have mutual dependencies'
+ }
+ ],
+ componentsUtils = require('utils/components');
+
beforeEach(function () {
sinon.stub(controller, 'sendComponentCommand', Em.K);
- sinon.stub(controller, 'addComponentWithCheck', Em.K);
+ sinon.stub(controller, 'showAddComponentPopup', Em.K);
+ sinon.stub(App.get('router.mainAdminKerberosController'), 'getKDCSessionState', function (arg) {
+ return arg();
+ });
+ sinon.stub(App, 'showAlertPopup', Em.K);
+ sinon.stub(App.StackServiceComponent, 'find', function (componentName) {
+ return Em.Object.create({
+ displayName: componentName
+ });
+ });
+ controller.set('content.hostComponents', []);
});
afterEach(function () {
controller.sendComponentCommand.restore();
- controller.addComponentWithCheck.restore();
- });
- it('No clients to install, some clients to add', function () {
- var event = {
- context: [
- Em.Object.create()
- ]
- };
- controller.installClients(event);
- expect(controller.sendComponentCommand.called).to.be.false;
- expect(controller.addComponentWithCheck.calledWith({
- context: Em.Object.create()
- }, true)).to.be.true;
+ controller.showAddComponentPopup.restore();
+ App.get('router.mainAdminKerberosController').getKDCSessionState.restore();
+ App.showAlertPopup.restore();
+ App.StackServiceComponent.find.restore();
+ componentsUtils.checkComponentDependencies.restore();
});
- it('Some clients to install, no clients to add', function () {
- var event = {
- context: [
- Em.Object.create({
- workStatus: 'INSTALLED'
- }),
- Em.Object.create({
- workStatus: 'INIT'
- }),
- Em.Object.create({
- workStatus: 'INSTALL_FAILED'
- })
- ]
- };
- controller.installClients(event);
- expect(controller.sendComponentCommand.calledWith([
- Em.Object.create({
- workStatus: 'INIT'
- }),
- Em.Object.create({
- workStatus: 'INSTALL_FAILED'
- })
- ], Em.I18n.t('host.host.details.installClients'), 'INSTALLED')).to.be.true;
- expect(controller.addComponentWithCheck.called).to.be.false;
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ sinon.stub(componentsUtils, 'checkComponentDependencies', function (componentName, params) {
+ return item.dependencies[componentName];
+ });
+ controller.installClients({
+ context: item.context
+ });
+ expect(App.get('router.mainAdminKerberosController').getKDCSessionState.calledOnce).to.equal(item.getKDCSessionStateCalled);
+ expect(controller.sendComponentCommand.calledOnce).to.equal(item.sendComponentCommandCalled);
+ expect(App.showAlertPopup.calledOnce).to.equal(item.showAlertPopupCalled);
+ });
});
});
[3/5] ambari git commit: AMBARI-10697. Remove the "Jobs" View from
Ambari (alexantonenko)
Posted by al...@apache.org.
AMBARI-10697. Remove the "Jobs" View from Ambari (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/571c1926
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/571c1926
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/571c1926
Branch: refs/heads/trunk
Commit: 571c192643e4abba6a9b4eaa00888f53626c8e08
Parents: 5ab5f3f
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 23 16:26:44 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 23 18:04:49 2015 +0300
----------------------------------------------------------------------
contrib/views/pom.xml | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/571c1926/contrib/views/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pom.xml b/contrib/views/pom.xml
index 60c3b71..6eb6aeb 100644
--- a/contrib/views/pom.xml
+++ b/contrib/views/pom.xml
@@ -34,7 +34,6 @@
</properties>
<modules>
<module>files</module>
- <module>jobs</module>
<module>pig</module>
<module>slider</module>
<module>capacity-scheduler</module>
[4/5] ambari git commit: AMBARI-10701. hosts page rack tooltip hangs
around (alexantonenko)
Posted by al...@apache.org.
AMBARI-10701. hosts page rack tooltip hangs around (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ee3bfa11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ee3bfa11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ee3bfa11
Branch: refs/heads/trunk
Commit: ee3bfa112e02e147e595e0eddb5eb44c38010b8c
Parents: 571c192
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 23 16:55:41 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 23 18:04:49 2015 +0300
----------------------------------------------------------------------
ambari-web/app/views/main/host.js | 1 +
.../test/controllers/wizard/step8_test.js | 692 +++++++++++++++++++
.../test/controllers/wizard/step9_test.js | 324 +++++++++
3 files changed, 1017 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee3bfa11/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index d28a5d8..d3de708 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -216,6 +216,7 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
willDestroyElement: function () {
this.clearExpandedSections();
+ $('.tooltip').remove();
},
clearExpandedSections: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee3bfa11/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 1b97f6d..2dd939a 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -236,6 +236,629 @@ describe('App.WizardStep8Controller', function () {
});
});
+ describe('#createCoreSiteObj', function () {
+ it('should return config', function () {
+ var content = Em.Object.create({
+ services: Em.A([
+ Em.Object.create({
+ serviceName: 's1',
+ isSelected: true,
+ isInstalled: false
+ }),
+ Em.Object.create({
+ serviceName: 's2',
+ isSelected: true,
+ isInstalled: false
+ }),
+ Em.Object.create({
+ serviceName: 's3',
+ isSelected: true,
+ isInstalled: false
+ }),
+ Em.Object.create({
+ serviceName: 'GLUSTERFS',
+ isSelected: false,
+ isInstalled: true,
+ configTypesRendered: {hdfs:'tag1'}
+ })
+ ])
+ });
+ var installedServices = content.services.filterProperty('isInstalled', true);
+ var selectedServices = content.services.filterProperty('isSelected', true);
+ installerStep8Controller.set('content', content);
+ installerStep8Controller.set('installedServices', installedServices);
+ installerStep8Controller.set('selectedServices', selectedServices);
+ installerStep8Controller.set('configs', Em.A([
+ Em.Object.create({
+ name: 'fs_glusterfs_default_name',
+ filename: 'core-site.xml',
+ value: 'value',
+ overrides: Em.A([
+ Em.Object.create({
+ value: '4',
+ hosts: Em.A(['h1','h2'])
+ })
+ ])
+ }),
+ Em.Object.create({
+ name: 'fs.defaultFS',
+ filename: 'core-site.xml',
+ value: 'value',
+ overrides: Em.A([
+ Em.Object.create({
+ value: '4',
+ hosts: Em.A(['h1','h2'])
+ })
+ ])
+ }),
+ Em.Object.create({
+ name: 'glusterfs_defaultFS_name',
+ filename: 'core-site.xml',
+ value: 'value',
+ overrides: Em.A([
+ Em.Object.create({
+ value: '4',
+ hosts: Em.A(['h1','h2'])
+ })
+ ])
+ })
+ ]));
+ var expected = {
+ "type": "core-site",
+ "tag": "version1",
+ "properties": {
+ "fs_glusterfs_default_name": "value",
+ "fs.defaultFS": "value",
+ "glusterfs_defaultFS_name": "value"
+ }
+ };
+
+ expect(installerStep8Controller.createCoreSiteObj()).to.eql(expected);
+ });
+ });
+
+ describe('#createConfigurationGroups', function () {
+ beforeEach(function() {
+ sinon.stub(App.router,'get').returns(Em.Object.create({
+ getDBProperty: function() {
+ return Em.A([
+ Em.Object.create({
+ value: 1
+ })
+ ]);
+ },
+ getConfigAttributes: function() {
+ return Em.A(['atr']);
+ }
+ }));
+ });
+ afterEach(function() {
+ App.router.get.restore();
+ });
+ it('should push group in properties', function () {
+ var content = Em.Object.create({
+ configGroups: Em.A([
+ Em.Object.create({
+ isDefault: true,
+ service: Em.Object.create({
+ id: 1
+ }),
+ name: 'n1',
+ description: 'describe',
+ hosts: ['h1', 'h2'],
+ properties: Em.A([
+ Em.Object.create({
+ value: 'p1',
+ filename: 'file.xml'
+ }),
+ Em.Object.create({
+ value: 'p2',
+ filename: 'file1.xml'
+ })
+ ])
+ }),
+ Em.Object.create({
+ isDefault: false,
+ service: Em.Object.create({
+ id: 2
+ }),
+ name: 'n2',
+ hosts: ['h3', 'h4'],
+ description: 'describe1',
+ properties: Em.A([
+ Em.Object.create({
+ value: 'p3',
+ filename: 'file2.xml'
+ }),
+ Em.Object.create({
+ value: 'p4',
+ filename: 'file3.xml'
+ })
+ ])
+ })
+ ])
+ });
+ var defaultGroups = Em.A([
+ Em.Object.create({
+ group: 'n2',
+ filename: 'file5.xml'
+ }),
+ Em.Object.create({
+ group: 'n1',
+ filename: 'file4.xml'
+ })
+ ]);
+ installerStep8Controller.set('content', content);
+ installerStep8Controller.set('clusterName', 'name');
+ installerStep8Controller.set('customNonDefaultGroupConfigs', defaultGroups);
+ installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+ installerStep8Controller.get('ajaxRequestsQueue').clear();
+ installerStep8Controller.createConfigurationGroups();
+ var expected = [
+ {
+ "value": "p3",
+ "filename": "file2.xml"
+ },
+ {
+ "value": "p4",
+ "filename": "file3.xml"
+ },
+ {
+ "group": "n2",
+ "filename": "file5.xml"
+ }
+ ];
+ var result = JSON.parse(JSON.stringify(content.configGroups[1].properties));
+ expect(result).to.eql(expected);
+ });
+ });
+
+ describe('#getGlobConfigValueWithOverrides', function () {
+ it('should retun empty objects', function () {
+ expect(installerStep8Controller.getGlobConfigValueWithOverrides('','','')).to.eql({
+ "value": "",
+ "overrides": []
+ });
+ });
+ it('should retun overrides', function () {
+ var expression = '<cod index=[1]></cod index=[2]>';
+ installerStep8Controller.set('configs', Em.A([
+ Em.Object.create({
+ name:'name', overrides: Em.A([
+ Em.Object.create({
+ value: '4',
+ hosts: Em.A(['h1','h2'])
+ })
+ ])
+ })
+ ]));
+ var names = Em.A(['name0', 'name', 'name', 'ad']);
+ var result = {
+ "value": "undefinedundefined",
+ "overrides": [
+ {
+ "value": "44",
+ "hosts": [
+ "h1",
+ "h2"
+ ]
+ }
+ ]
+ };
+ expect(installerStep8Controller.getGlobConfigValueWithOverrides(names,expression,'')).to.eql(result);
+ });
+ });
+
+ describe('#isConfigsChanged', function () {
+ it('should return true if config changed', function () {
+ var properties = Em.Object.create({
+ property:true,
+ property1: Em.Object.create({
+ hasInitialValue: false,
+ isNotDefaultValue: false
+ })
+ });
+ var configs = Em.A([Em.Object.create({
+ name: 'property'
+ })]);
+ expect(installerStep8Controller.isConfigsChanged(properties,configs)).to.be.true;
+ });
+ });
+
+ describe('#loadServices', function () {
+ it('should load services', function () {
+ var services = Em.A([
+ Em.Object.create({
+ serviceName: 's1',
+ isSelected: true,
+ displayNameOnSelectServicePage: 's01',
+ isClientOnlyService: false,
+ serviceComponents: Em.A([
+ Em.Object.create({
+ isClient: true
+ })
+ ]),
+ isHiddenOnSelectServicePage: false
+ }),
+ Em.Object.create({
+ serviceName: 's2',
+ isSelected: true,
+ displayNameOnSelectServicePage: 's02',
+ serviceComponents: Em.A([
+ Em.Object.create({
+ isMaster: true
+ })
+ ]),
+ isHiddenOnSelectServicePage: false
+ }),
+ Em.Object.create({
+ serviceName: 's3',
+ isSelected: true,
+ displayNameOnSelectServicePage: 's03',
+ serviceComponents: Em.A([
+ Em.Object.create({
+ isHAComponentOnly: true
+ })
+ ]),
+ isHiddenOnSelectServicePage: false
+ }),
+ Em.Object.create({
+ serviceName: 's4',
+ isSelected: true,
+ displayNameOnSelectServicePage: 's03',
+ isClientOnlyService: true,
+ serviceComponents: Em.A([
+ Em.Object.create({
+ isClient: true
+ })
+ ]),
+ isHiddenOnSelectServicePage: false
+ })
+ ]);
+ var selectedServices = services.filterProperty('isSelected');
+ var slaveComponentHosts = Em.A([
+ Em.Object.create({
+ componentName: 'CLIENT',
+ hostName: 'h1',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ]);
+ var content = Em.Object.create({
+ services: services,
+ selectedServices: selectedServices,
+ slaveComponentHosts: slaveComponentHosts
+ });
+ installerStep8Controller.set('content', content);
+ installerStep8Controller.set('services', Em.A([]));
+ installerStep8Controller.reopen({selectedServices: selectedServices});
+ installerStep8Controller.loadServices();
+ var expected = [
+ {
+ "service_name": "s1",
+ "display_name": "s01",
+ "service_components": []
+ },
+ {
+ "service_name": "s2",
+ "display_name": "s02",
+ "service_components": []
+ },
+ {
+ "service_name": "s3",
+ "display_name": "s03",
+ "service_components": []
+ },
+ {
+ "service_name": "s4",
+ "display_name": "s03",
+ "service_components": [
+ {
+ "component_name": "CLIENT",
+ "display_name": "Clients",
+ "component_value": "2 hosts"
+ }
+ ]
+ }
+ ];
+ var result = JSON.parse(JSON.stringify(installerStep8Controller.get('services')));
+ expect(result).to.be.eql(expected);
+ });
+ });
+
+ describe('#removeClientsFromList', function () {
+ it('should remove h1', function () {
+ installerStep8Controller.set('content', Em.Object.create({
+ hosts: Em.Object.create({
+ h1: Em.Object.create({
+ hostName: 'h1',
+ isInstalled: true,
+ hostComponents: Em.A([Em.Object.create({HostRoles: Em.Object.create({component_name: "h1"})})])
+ }),
+ h2: Em.Object.create({
+ hostName: 'h2',
+ isInstalled: true,
+ hostComponents: Em.A([Em.Object.create({HostRoles: Em.Object.create({component_name: "h2"})})])
+ })
+ })
+ }));
+ var hostList = Em.A(['h1','h2']);
+ installerStep8Controller.removeClientsFromList('h1', hostList);
+ expect(JSON.parse(JSON.stringify(hostList))).to.eql(["h2"]);
+ });
+ });
+
+ describe('#createSlaveAndClientsHostComponents', function () {
+ it('should return non install object', function () {
+ installerStep8Controller.set('content', Em.Object.create({
+ masterComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'CLIENT',
+ component: 'HBASE_MASTER',
+ hostName: 'h1'
+ })
+ ]),
+ slaveComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'CLIENT',
+ hostName: 'h1',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ }),
+ Em.Object.create({
+ componentName: 'CLIENT1',
+ hostName: 'h1',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ]),
+ clients: Em.A([
+ Em.Object.create({
+ isInstalled: false
+ })
+ ]),
+ services: Em.A([
+ Em.Object.create({
+ isInstalled: true,
+ serviceName: "name",
+ isClient: true
+ })
+ ]),
+ hosts: Em.Object.create({
+ h1: Em.Object.create({
+ hostName: 'h1',
+ isInstalled: true,
+ hostComponents: Em.A([Em.Object.create({})])
+ }),
+ h2: Em.Object.create({
+ hostName: 'h2',
+ isInstalled: false,
+ hostComponents: Em.A([Em.Object.create({})])
+ })
+ }),
+ additionalClients: Em.A([{hostNames: "name", componentName: "client"}])
+ }));
+ installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+ installerStep8Controller.get('ajaxRequestsQueue').clear();
+ installerStep8Controller.createSlaveAndClientsHostComponents();
+ expect(installerStep8Controller.get('content.clients')[0].isInstalled).to.be.false;
+ });
+ });
+
+ describe('#createAdditionalClientComponents', function () {
+ it('should bes equal to content.cluster.name', function () {
+ installerStep8Controller.set('content', Em.Object.create({
+ masterComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'CLIENT',
+ component: 'HBASE_MASTER',
+ hostName: 'h1'
+ })
+ ]),
+ slaveComponentHosts: Em.A([
+ Em.Object.create({
+ componentName: 'CLIENT',
+ hostName: 'h1',
+ hosts: Em.A([
+ Em.Object.create({hostName: 'h1', isInstalled: true}),
+ Em.Object.create({hostName: 'h2', isInstalled: false})
+ ])
+ })
+ ]),
+ clients: Em.A([
+ Em.Object.create({
+ isInstalled: false
+ })
+ ]),
+ services: Em.A([
+ Em.Object.create({
+ isInstalled: true,
+ serviceName: "name",
+ isClient: true
+ })
+ ]),
+ hosts: Em.Object.create({
+ h1: Em.Object.create({
+ hostName: 'h1',
+ isInstalled: true,
+ hostComponents: Em.A([Em.Object.create({})])
+ }),
+ h2: Em.Object.create({
+ hostName: 'h2',
+ isInstalled: false,
+ hostComponents: Em.A([Em.Object.create({})])
+ })
+ }),
+ additionalClients: Em.A([{hostNames: "name", componentName: "client"}])
+ }));
+ installerStep8Controller.set('ajaxRequestsQueue', App.ajaxQueue.create());
+ installerStep8Controller.get('ajaxRequestsQueue').clear();
+ installerStep8Controller.createAdditionalClientComponents();
+ var result = [
+ {
+ "hostNames": "name",
+ "componentName": "client"
+ }
+ ];
+ var expected = installerStep8Controller.get('content.additionalClients');
+ expect(JSON.parse(JSON.stringify(expected))).to.eql(result);
+ });
+ });
+
+ describe('#assignComponentHosts', function () {
+ it('should return host name', function () {
+ var component = Em.Object.create({
+ isMaster: true,
+ componentName: 'HBASE_MASTER',
+ hostName: 'h1'
+ });
+ installerStep8Controller.set('content', Em.Object.create({
+ masterComponentHosts:Em.A([
+ Em.Object.create({component: 'HBASE_MASTER', hostName: 'h1'})
+ ])}));
+ var res = installerStep8Controller.assignComponentHosts(component);
+ expect(res).to.equal("h1");
+ });
+ it('should return number of hosts', function () {
+ var component = Em.Object.create({
+ componentName: 'HBASE_MASTER',
+ isClient: false,
+ hostName: 'h1'
+ });
+ installerStep8Controller.set('content', Em.Object.create({
+ slaveComponentHosts:Em.A([
+ Em.Object.create({
+ componentName: 'HBASE_MASTER',
+ hostName: 'h1',
+ hosts: [
+ {hostName: 'h1'},
+ {hostName: 'h2'}
+ ]
+ })
+ ])}));
+ var res = installerStep8Controller.assignComponentHosts(component);
+ expect(res).to.equal("2 hosts");
+ });
+ });
+
+ describe('#loadClusterInfo', function () {
+ beforeEach(function () {
+ sinon.stub(App.Stack, 'find', function(){
+ return Em.A([
+ Em.Object.create({isSelected: false, hostName: 'h1'}),
+ Em.Object.create({
+ isSelected: true,
+ hostName: 'h2',
+ operatingSystems: Em.A([Em.Object.create({
+ name:'windows',
+ isSelected: true,
+ repositories: Em.A([Em.Object.create({
+ baseUrl: "url",
+ osType: "2",
+ repoId: "3"
+ })])
+ })])
+ }),
+ Em.Object.create({isSelected: false, hostName: 'h3'})
+ ]);
+ });
+ });
+ afterEach(function () {
+ App.Stack.find.restore();
+ });
+ it('should return config with display_name', function () {
+ installerStep8Controller.set('clusterInfo', Em.A([]));
+ installerStep8Controller.loadClusterInfo();
+ var res = [{
+ "config_name":"cluster",
+ "display_name":"Cluster Name"
+ },{
+ "config_name":"hosts",
+ "display_name":"Total Hosts",
+ "config_value":"0 (0 new)"
+ }];
+ var calcRes = JSON.parse(JSON.stringify(installerStep8Controller.get('clusterInfo')));
+ expect(calcRes).to.eql(res);
+ });
+ });
+
+ describe('#loadConfigs', function () {
+ beforeEach(function () {
+ sinon.stub(App.config, 'excludeUnsupportedConfigs', Em.K);
+ sinon.stub(installerStep8Controller, 'loadUiSideConfigs', Em.K);
+ });
+ afterEach(function () {
+ App.config.excludeUnsupportedConfigs.restore();
+ installerStep8Controller.loadUiSideConfigs.restore();
+ });
+ it('should stringify serviceConfigProperties', function () {
+ var serviceConfigProperties = [
+ {name: 'oozie_hostname', value: true},
+ {name: 'oozie_existing_oracle_host', value: true},
+ {name: 'hive_database', value: false},
+ {name: 'oozie_database', value: false}
+ ];
+ var services = Em.A([
+ Em.Object.create({serviceName: 's1'}),
+ Em.Object.create({serviceName: 's2'}),
+ Em.Object.create({serviceName: 's3'})
+ ]);
+ var content = Em.Object.create({
+ services: services,
+ serviceConfigProperties: serviceConfigProperties
+ });
+ installerStep8Controller.set('content', content);
+ installerStep8Controller.set('configs', Em.A([]));
+ installerStep8Controller.loadConfigs();
+ var expected = [
+ {'name': 'oozie_hostname', 'value': 'true'},
+ {'name': 'oozie_existing_oracle_host', 'value': 'true'},
+ {'name': 'hive_database', 'value': 'false'},
+ {'name': 'oozie_database', 'value': 'false'}
+ ];
+ expect(JSON.parse(JSON.stringify(serviceConfigProperties))).to.eql(expected);
+ });
+ });
+
+ describe('#isDeployStarted', function () {
+ it('should be undefined', function () {
+ installerStep8Controller.set('isSubmitDisabled',false);
+ expect(installerStep8Controller.get('isDeployStarted')).to.equal(undefined);
+ });
+ });
+
+ describe('#configMapping', function () {
+ it('should object with isOverridable', function () {
+ var configMapping = [
+ {foreignKey: null, templateName: 't1', value: 'v1', name: 'c1', filename: 'f1'},
+ {foreignKey: null, templateName: 't2', value: 'v2', name: 'c2', filename: 'f2'},
+ {foreignKey: null, templateName: 't3', value: 'v3', name: 'c3', filename: 'f2'},
+ {foreignKey: null, templateName: 't4', value: 'v4', name: 'c4', filename: 'f1'}
+ ];
+ installerStep8Controller.set(configMapping);
+ var result = {
+ "name": "hadoop.proxyuser.<foreignKey[0]>.groups",
+ "templateName": [
+ "proxyuser_group"
+ ],
+ "foreignKey": [
+ "hive_user"
+ ],
+ "value": "<templateName[0]>",
+ "filename": "core-site.xml",
+ "isOverridable": true
+ };
+
+ expect(installerStep8Controller.get('configMapping')[0]).to.eql(result);
+ });
+ });
+
describe('#loadStep', function () {
beforeEach(function () {
sinon.stub(installerStep8Controller, 'clearStep', Em.K);
@@ -299,6 +922,17 @@ describe('App.WizardStep8Controller', function () {
},
{
globals: [
+ {name: 'hive_database', value: 'New PostgreSQL Database'},
+ {name: 'hive_database_type', value: 'postgresql'},
+ {name: 'hive_ambari_host', value: 'h1'},
+ {name: 'hive_hostname', value: 'h2'}
+ ],
+ removed: Em.A(['hive_existing_mysql_database', 'hive_existing_oracle_database', 'hive_existing_postgresql_database', 'hive_master_hosts']),
+ m: 'hive_database: New PostgreSQL Database',
+ host: 'h1'
+ },
+ {
+ globals: [
{name: 'hive_database', value: 'Existing MySQL Database'},
{name: 'hive_database_type', value: 'mysql'},
{name: 'hive_existing_mysql_host', value: 'h1'},
@@ -310,6 +944,28 @@ describe('App.WizardStep8Controller', function () {
},
{
globals: [
+ {name: 'hive_database', value: 'Existing MSSQL Server database with SQL authentication'},
+ {name: 'hive_database_type', value: 'mssql_server'},
+ {name: 'hive_existing_mssql_server_host', value: 'h1'},
+ {name: 'hive_hostname', value: 'h2'}
+ ],
+ removed: Em.A(['hive_ambari_database', 'hive_existing_oracle_database', 'hive_existing_postgresql_database', 'hive_master_hosts']),
+ m: 'hive_database: Existing MSSQL Server Database',
+ host: 'h1'
+ },
+ {
+ globals: [
+ {name: 'hive_database', value: 'Existing MSSQL Server database with integrated authentication'},
+ {name: 'hive_database_type', value: 'mssql_server2'},
+ {name: 'hive_existing_mssql_server_2_host', value: 'h1'},
+ {name: 'hive_hostname', value: 'h2'}
+ ],
+ removed: Em.A(['hive_ambari_database', 'hive_existing_oracle_database', 'hive_existing_postgresql_database', 'hive_master_hosts']),
+ m: 'hive_database: Existing MSSQL Server database with integrated authentication',
+ host: 'h1'
+ },
+ {
+ globals: [
{name: 'hive_database', value: 'Existing PostgreSQL Database'},
{name: 'hive_database_type', value: 'postgresql'},
{name: 'hive_existing_postgresql_host', value: 'h1'},
@@ -380,6 +1036,26 @@ describe('App.WizardStep8Controller', function () {
},
{
globals: [
+ {name: 'oozie_database', value: 'Existing MSSQL Server database with SQL authentication'},
+ {name: 'oozie_existing_mssql_server_host', value: 'h1'},
+ {name: 'oozie_hostname', value: 'h2'}
+ ],
+ removed: Em.A(['oozie_existing_mssql_server_database', 'oozie_existing_mssql_server_2_database', 'oozie_existing_mysql_database']),
+ m: 'oozie_database: Existing MSSQL with SQL authentication Database',
+ host: 'h1'
+ },
+ {
+ globals: [
+ {name: 'oozie_database', value: 'Existing MSSQL Server database with integrated authentication'},
+ {name: 'oozie_existing_mssql_server_2_host', value: 'h1'},
+ {name: 'oozie_hostname', value: 'h2'}
+ ],
+ removed: Em.A(['oozie_existing_mssql_server_database', 'oozie_existing_oracle_database', 'oozie_existing_mysql_database']),
+ m: 'oozie_database: Existing MSSQL with integrated authentication Database',
+ host: 'h1'
+ },
+ {
+ globals: [
{name: 'oozie_database', value: 'Existing Oracle Database'},
{name: 'oozie_existing_oracle_host', value: 'h1'},
{name: 'oozie_hostname', value: 'h2'}
@@ -601,6 +1277,22 @@ describe('App.WizardStep8Controller', function () {
},
{
serviceConfigProperties: [
+ {name: 'hive_database', value: 'Existing MSSQL Server database with SQL authentication'},
+ {name: 'hive_existing_mssql_server_database', value: 'dbname'}
+ ],
+ m: 'Existing MSSQL Server database with SQL authentication',
+ e: 'dbname (Existing MSSQL Server database with SQL authentication)'
+ },
+ {
+ serviceConfigProperties: [
+ {name: 'hive_database', value: 'Existing MSSQL Server database with integrated authentication'},
+ {name: 'hive_existing_mssql_server_2_database', value: 'dbname'}
+ ],
+ m: 'Existing MSSQL Server database with integrated authentication',
+ e: 'dbname (Existing MSSQL Server database with integrated authentication)'
+ },
+ {
+ serviceConfigProperties: [
{name: 'hive_database', value: 'New PostgreSQL Database'}
],
m: 'New PostgreSQL Database',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee3bfa11/ambari-web/test/controllers/wizard/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js
index b16e4d2..d0a895a 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -52,6 +52,9 @@ describe('App.InstallerStep9Controller', function () {
obj = App.InstallerController.create();
sinon.stub(App.ajax, 'send', function() {
return {
+ then: function() {
+ return true;
+ },
retry: function() {
return {
then: Em.K,
@@ -199,6 +202,148 @@ describe('App.InstallerStep9Controller', function () {
});
});
+ describe('#setParseHostInfo', function () {
+ var tasks = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ host_name: 'host1',
+ status: 'PENDING'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ host_name: 'host1',
+ status: 'PENDING'
+ })
+ })
+ ]);
+ var content = Em.Object.create({
+ cluster: Em.Object.create({
+ requestId: '11',
+ status: 'PENDING'
+ })
+ });
+ beforeEach(function(){
+ c.set('content', content)
+ });
+ it('Should make parseHostInfo false"', function () {
+ var polledData = Em.Object.create({
+ tasks: tasks,
+ Requests: Em.Object.create({
+ id: '222'
+ })
+ });
+ c.setParseHostInfo(polledData);
+ expect(c.get('parseHostInfo')).to.be.false;
+ });
+ it('Should set polledData"', function () {
+ var polledData = Em.Object.create({
+ tasks: tasks,
+ Requests: Em.Object.create({
+ id: '11'
+ })
+ });
+ c.setParseHostInfo(polledData);
+ var expected = [
+ {
+ "Tasks": {
+ "status": "PENDING",
+ "host_name": "host1",
+ "request_id": "11"
+ }
+ },
+ {
+ "Tasks": {
+ "status": "PENDING",
+ "host_name": "host1",
+ "request_id": "11"
+ }
+ }
+ ];
+ var result = JSON.parse(JSON.stringify(c.get('polledData')));
+ expect(result).to.eql(expected);
+ });
+ it('Should set progress for hosts"', function () {
+ var polledData = Em.Object.create({
+ tasks: tasks,
+ Requests: Em.Object.create({
+ id: '11'
+ })
+ });
+ var hosts = Em.A([
+ Em.Object.create({
+ name: 'host1',
+ logTasks: [
+ {Tasks: {role: 'HDFS_CLIENT'}},
+ {Tasks: {role: 'DATANODE'}}
+ ],
+ status: 'old_status',
+ progress: '10',
+ isNoTasksForInstall: true,
+ e: {status: 'old_status', progress: '10'}
+ }),
+ Em.Object.create({
+ name: 'host2',
+ logTasks: [
+ {Tasks: {role: 'HDFS_CLIENT'}}
+ ],
+ status: 'old_status',
+ progress: '10',
+ e: {status: 'success', progress: '100'}
+ })
+ ]);
+ c.set('hosts', hosts);
+ c.setParseHostInfo(polledData);
+ var expected = [
+ {
+ "name": "host1",
+ "logTasks": [
+ {
+ "Tasks": {
+ "role": "HDFS_CLIENT",
+ "status": "PENDING"
+ }
+ },
+ {
+ "Tasks": {
+ "role": "DATANODE"
+ }
+ }
+ ],
+ "progress": "0",
+ "isNoTasksForInstall": false,
+ "e": {
+ "status": "old_status",
+ "progress": "10"
+ },
+ "status": "in_progress",
+ "message": ""
+ },
+ {
+ "name": "host2",
+ "logTasks": [
+ {
+ "Tasks": {
+ "role": "HDFS_CLIENT"
+ }
+ }
+ ],
+ "progress": "33",
+ "e": {
+ "status": "success",
+ "progress": "100"
+ },
+ "status": "pending",
+ "isNoTasksForInstall": true,
+ "message": "Install complete (Waiting to start)"
+ }
+ ];
+
+ var result = JSON.parse(JSON.stringify(c.get('hosts')));
+ expect(result).to.eql(expected);
+ });
+ });
+
var hosts_for_load_and_render = {
'host1': {
message: 'message1',
@@ -266,6 +411,185 @@ describe('App.InstallerStep9Controller', function () {
});
});
+ describe('#isServicesStarted', function () {
+ it('Should return false when server not started', function () {
+ var polledData = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'PENDING'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'PENDING'
+ })
+ })
+ ]);
+ expect(c.isServicesStarted(polledData)).to.be.false;
+ });
+ it('Should return true when server started', function () {
+ var polledData = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ })
+ ]);
+ expect(c.isServicesStarted(polledData)).to.be.true;
+ });
+ it('Should return true when tasks completed', function () {
+ var polledData = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'COMPLETED'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'COMPLETED'
+ })
+ })
+ ]);
+ expect(c.isServicesStarted(polledData)).to.be.true;
+ });
+ });
+
+ describe('#setIsServicesInstalled', function () {
+ it('Should return 100% completed', function () {
+ var polledData = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ })
+ ]);
+ c.set('status', 'failed');
+ c.set('hosts', Em.A([
+ Em.Object.create({
+ progress: 0
+ })
+ ]));
+ c.setIsServicesInstalled(polledData);
+ expect(c.get('progress')).to.equal('100');
+ });
+ it('Should return 34% completed', function () {
+ var polledData = Em.A([
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ }),
+ Em.Object.create({
+ Tasks: Em.Object.create({
+ status: 'NONE'
+ })
+ })
+ ]);
+ c.set('status', '');
+ c.set('hosts', Em.A([
+ Em.Object.create({
+ progress: 0
+ })
+ ]));
+ c.set('content', Em.Object.create({
+ controllerName: 'installerController'
+ }));
+ c.setIsServicesInstalled(polledData);
+ expect(c.get('progress')).to.equal('34');
+ });
+ });
+
+ describe('#launchStartServices', function () {
+ beforeEach(function() {
+ sinon.stub(App, 'get', function(k) {
+ if (k === 'components.slaves')
+ return ["TASKTRACKER", "DATANODE",
+ "JOURNALNODE", "ZKFC",
+ "APP_TIMELINE_SERVER",
+ "NODEMANAGER",
+ "GANGLIA_MONITOR",
+ "HBASE_REGIONSERVER",
+ "SUPERVISOR",
+ "FLUME_HANDLER"];
+ return true;
+ });
+ });
+ afterEach(function() {
+ App.get.restore();
+ });
+ var tests = [
+ {
+ expected: [],
+ message: 'should return query',
+ controllerName: 'addHostController',
+ hosts: Em.A([
+ Em.Object.create({
+ name: 'h1'
+ }),
+ Em.Object.create({
+ name: 'h2'
+ })
+ ])
+ },
+ {
+ expected: [],
+ text: 'should return server info',
+ controllerName: 'addServiceController',
+ services: Em.A([
+ Em.Object.create({
+ serviceName: 'OOZIE',
+ isSelected: true,
+ isInstalled: false
+ }),
+ Em.Object.create({
+ serviceName: 'h2',
+ isSelected: false,
+ isInstalled: true
+ })
+ ])
+ },
+ {
+ expected: [],
+ text: 'should return default data',
+ controllerName: 'addHostContro',
+ hosts: Em.A([
+ Em.Object.create({
+ name: 'h1'
+ }),
+ Em.Object.create({
+ name: 'h2'
+ })
+ ])
+ }
+ ];
+ tests.forEach(function(test) {
+ it(test.message, function () {
+ var content = Em.Object.create({
+ controllerName: test.controllerName,
+ services: test.services
+ });
+ var wizardController = Em.Object.create({
+ getDBProperty: function() {
+ return test.hosts
+ }
+ });
+ c.set('content', content);
+ c.set('wizardController', wizardController);
+ expect(c.launchStartServices(function(){})).to.be.true;
+ });
+ })
+ });
+
describe('#hostHasClientsOnly', function () {
var tests = Em.A([
{
[5/5] ambari git commit: AMBARI-10694. Update ranger install
requirements dialog (alexantonenko)
Posted by al...@apache.org.
AMBARI-10694. Update ranger install requirements dialog (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f333a78c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f333a78c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f333a78c
Branch: refs/heads/trunk
Commit: f333a78c0134b1b059b2ad137ca917a38be6f062
Parents: 1443628
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 23 15:27:20 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 23 18:04:49 2015 +0300
----------------------------------------------------------------------
ambari-web/app/messages.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f333a78c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 3e43684..df96749 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -693,10 +693,10 @@ Em.I18n.translations = {
'installer.step4.ambariMetricsCheck.popup.header':'Limited Functionality Warning',
'installer.step4.ambariMetricsCheck.popup.body':'Ambari Metrics collects metrics from the cluster and makes them available to Ambari. If you do not install Ambari Metrics service, metrics will not be accessible from Ambari. Are you sure you want to proceed without Ambari Metrics?',
'installer.step4.rangerRequirements.popup.header': 'Ranger Requirements',
- 'installer.step4.rangerRequirements.popup.body.requirements': '<ol><li>You must have an <strong>existing MySQL Server or Oracle Server</strong> database instance running to be used by Ranger.</li>' +
- '<li>In Assign Masters step of this wizard, you will be prompted to specify which host for the Ranger Admin. On that host, you <strong>must have MySQL Client or Oracle Client installed</strong> for Ranger to access to the database.</li>' +
- '<li>Ensure that the access for the DB Admin user (<strong>root</strong> in case of MySQL or <strong>SYS</strong> in case of Oracle) is enabled in DB server from any host.</li>' +
- '<li>Execute the following command on the Ambari Server host. Replace <code>database-type</code> with <strong>mysql</strong> or <strong>oracle</strong> and <code>/jdbc/driver/path</code> based on the location of the MySQL or Oracle JDBC driver:' +
+ 'installer.step4.rangerRequirements.popup.body.requirements': '<ol><li>You must have an <strong>MySQL/Oracle/Postgres/MSSQL Server</strong> database instance running to be used by Ranger.</li>' +
+ '<li>In Assign Masters step of this wizard, you will be prompted to specify which host for the Ranger Admin. On that host, you <strong>must have DB Client installed</strong> for Ranger to access to the database. (Note: This is only applicable for only HDP 2.2)</li>' +
+ '<li>Ensure that the access for the DB Admin user is enabled in DB server from any host.</li>' +
+ '<li>Execute the following command on the Ambari Server host. Replace <code>database-type</code> with <strong>mysql|oracle|postgres|mssql</strong> and <code>/jdbc/driver/path</code> based on the location of corresponding JDBC driver:' +
'<pre>ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}</pre></li></ol>',
'installer.step4.rangerRequirements.popup.body.confirmation': 'I have met all the requirements above.',
'installer.step4.sparkWarning.popup.body': 'Spark requires HDP 2.2.2 or later. Attempting to install Spark to a HDP 2.2.0 cluster will fail. Confirm you are using HDP 2.2.2 or later packages. Are you sure you want to proceed?',
[2/5] ambari git commit: AMBARI-10696. Prevent the "Make Current"
operation on a historical config with an incompatible stack (alexantonenko)
Posted by al...@apache.org.
AMBARI-10696. Prevent the "Make Current" operation on a historical config with an incompatible stack (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5ab5f3f7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ab5f3f7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ab5f3f7
Branch: refs/heads/trunk
Commit: 5ab5f3f779620865bbf245f7a69b41b7d790c425
Parents: f333a78
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 23 15:41:17 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 23 18:04:49 2015 +0300
----------------------------------------------------------------------
.../data/configurations/service_versions.json | 52 +++++++++++---------
.../mappers/service_config_version_mapper.js | 3 +-
.../models/configs/service_config_version.js | 4 ++
ambari-web/app/styles/config_history_flow.less | 14 ++----
.../common/configs/config_history_flow.hbs | 8 +--
.../common/configs/service_version_box.hbs | 2 +-
ambari-web/app/utils/ajax/ajax.js | 2 +-
.../configs/service_config_version_test.js | 35 +++++++++++++
8 files changed, 80 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/assets/data/configurations/service_versions.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/configurations/service_versions.json b/ambari-web/app/assets/data/configurations/service_versions.json
index 5b30903..c5eb46c 100644
--- a/ambari-web/app/assets/data/configurations/service_versions.json
+++ b/ambari-web/app/assets/data/configurations/service_versions.json
@@ -8,7 +8,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "ganglia-env",
"tag" : "version1414410959005",
@@ -36,7 +36,8 @@
"service_config_version_note" : "Initial configurations for Ganglia",
"service_name" : "GANGLIA",
"user" : "admin",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6",
+ "is_cluster_compatible": true
},
{
"href" : "http://192.168.56.101:8080/api/v1/clusters/tdk/configurations/service_config_versions?service_name=HDFS&service_config_version=2",
@@ -45,7 +46,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "core-site",
"tag" : "version1",
@@ -75,7 +76,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hadoop-policy",
"tag" : "version1",
@@ -97,7 +98,8 @@
},
{
"Config" : {
- "cluster_name" : "tdk"
+ "cluster_name" : "tdk",
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hdfs-log4j",
"tag" : "version1",
@@ -110,7 +112,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hdfs-site",
"tag" : "version1",
@@ -173,7 +175,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hadoop-env",
"tag" : "version1414314983497",
@@ -206,7 +208,8 @@
"service_config_version_note" : "",
"service_name" : "HDFS",
"user" : "admin",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5",
+ "is_cluster_compatible": false
},
{
"href" : "http://192.168.56.101:8080/api/v1/clusters/tdk/configurations/service_config_versions?service_name=HDFS&service_config_version=1",
@@ -215,7 +218,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hadoop-env",
"tag" : "version1",
@@ -241,7 +244,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hdfs-log4j",
"tag" : "version1",
@@ -254,7 +257,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hdfs-site",
"tag" : "version1",
@@ -317,7 +320,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "hadoop-policy",
"tag" : "version1",
@@ -340,7 +343,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5"
},
"type" : "core-site",
"tag" : "version1",
@@ -377,7 +380,8 @@
"service_config_version_note" : "Initial configurations for HDFS",
"service_name" : "HDFS",
"user" : "admin",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.5",
+ "is_cluster_compatible": false
},
{
"href" : "http://192.168.56.101:8080/api/v1/clusters/tdk/configurations/service_config_versions?service_name=HDFS&service_config_version=3",
@@ -386,7 +390,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "hadoop-env",
"tag" : "version1414314983497",
@@ -412,7 +416,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "hadoop-policy",
"tag" : "version1",
@@ -435,7 +439,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "hdfs-log4j",
"tag" : "version1",
@@ -448,7 +452,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "hdfs-site",
"tag" : "version1",
@@ -511,7 +515,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "core-site",
"tag" : "version1414410959005",
@@ -548,7 +552,8 @@
"service_config_version_note" : null,
"service_name" : "HDFS",
"user" : "admin",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6",
+ "is_cluster_compatible": true
},
{
"href" : "http://192.168.56.101:8080/api/v1/clusters/tdk/configurations/service_config_versions?service_name=ZOOKEEPER&service_config_version=1",
@@ -557,7 +562,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "zookeeper-env",
"tag" : "version1",
@@ -578,7 +583,7 @@
{
"Config" : {
"cluster_name" : "tdk",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6"
},
"type" : "zookeeper-log4j",
"tag" : "version1",
@@ -598,7 +603,8 @@
"service_config_version_note" : "Initial configurations for ZooKeeper",
"service_name" : "ZOOKEEPER",
"user" : "admin",
- "stack_id": "HDP-2.0.6"
+ "stack_id" : "HDP-2.0.6",
+ "is_cluster_compatible": true
}
]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/mappers/service_config_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_config_version_mapper.js b/ambari-web/app/mappers/service_config_version_mapper.js
index fbec4dc..2935cfa 100644
--- a/ambari-web/app/mappers/service_config_version_mapper.js
+++ b/ambari-web/app/mappers/service_config_version_mapper.js
@@ -32,7 +32,8 @@ App.serviceConfigVersionsMapper = App.QuickDataMapper.create({
notes: 'service_config_version_note',
is_current: 'is_current',
index: 'index',
- stack_version: 'stack_id'
+ stack_version: 'stack_id',
+ is_compatible: 'is_cluster_compatible'
},
map: function (json) {
var result = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/models/configs/service_config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/service_config_version.js b/ambari-web/app/models/configs/service_config_version.js
index 7c864dd..fcaa45c 100644
--- a/ambari-web/app/models/configs/service_config_version.js
+++ b/ambari-web/app/models/configs/service_config_version.js
@@ -38,6 +38,10 @@ App.ServiceConfigVersion = DS.Model.extend({
isCurrent: DS.attr('boolean'),
isDisplayed: DS.attr('boolean'),
stackVersion: DS.attr('string'),
+ isCompatible: DS.attr('boolean'),
+ canBeMadeCurrent: function () {
+ return this.get('isCompatible') && !this.get('isCurrent');
+ }.property('isCurrent', 'isCompatible'),
isDefault: function() {
return this.get('groupName') === 'default';
}.property('groupName'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/styles/config_history_flow.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/config_history_flow.less b/ambari-web/app/styles/config_history_flow.less
index ad34696..f62e995 100644
--- a/ambari-web/app/styles/config_history_flow.less
+++ b/ambari-web/app/styles/config_history_flow.less
@@ -120,11 +120,8 @@
white-space: nowrap;
}
}
- .version-operations-buttons {
- text-align: center;
- .btn {
- font-size: 13px;
- }
+ .version-operations-buttons .btn {
+ font-size: 13px;
}
}
.version-box:hover{
@@ -286,11 +283,8 @@
white-space: pre-wrap;
}
}
- .version-operations-buttons {
- text-align: center;
- .btn {
- font-size: 13px;
- }
+ .version-operations-buttons .btn {
+ font-size: 13px;
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index 866ee11..d6fae10 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -48,7 +48,7 @@
<strong>{{view.compareServiceVersion.createdDate}}</strong>
</div>
<div class="pull-right operations-button">
- <button class="btn btn-success" {{action doAction view.serviceVersionsReferences.compare view.actionTypes.REVERT target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.compareServiceVersion.isCurrent:hidden"}}>{{view.compareServiceVersion.makeCurrentButtonText}}</button>
+ <button class="btn btn-success" {{action doAction view.serviceVersionsReferences.compare view.actionTypes.REVERT target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.compareServiceVersion.canBeMadeCurrent::hidden"}}>{{view.compareServiceVersion.makeCurrentButtonText}}</button>
</div>
</div>
</div>
@@ -80,8 +80,8 @@
<div class="version-operations-buttons">
<button {{bindAttr disabled="serviceVersion.disabledActionAttr.view" class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.view"}} {{action doAction serviceVersion view.actionTypes.SWITCH target="view"}}><i class="icon-search"></i> {{t common.view}}</button>
{{#isAccessible MANAGER}}
- <button {{bindAttr disabled="serviceVersion.disabledActionAttr.compare" class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.compare"}} {{action doAction serviceVersion view.actionTypes.COMPARE target="view"}}><i class="icon-copy"></i> {{t common.compare}}</button>
- <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert" class=":btn serviceVersion.isCurrent:not-allowed-cursor" title="serviceVersion.disabledActionMessages.revert"}} {{action doAction serviceVersion view.actionTypes.REVERT target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
+ <button {{bindAttr disabled="serviceVersion.disabledActionAttr.compare" class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.compare"}} {{action doAction serviceVersion view.actionTypes.COMPARE target="view"}}><i class="icon-copy"></i> {{t common.compare}}</button>
+ <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert" class=":btn serviceVersion.isCurrent:not-allowed-cursor serviceVersion.isCompatible::hidden" title="serviceVersion.disabledActionMessages.revert"}} {{action doAction serviceVersion view.actionTypes.REVERT target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
{{/isAccessible}}
</div>
</ul>
@@ -114,7 +114,7 @@
<button class="btn" {{action doCancel target="controller"}} {{bindAttr disabled="view.isDiscardDisabled"}}>{{t common.discard}}</button>
<button class="btn btn-success" {{action save target="view"}} {{bindAttr disabled="view.isSaveDisabled"}}>{{t common.save}}</button>
</div>
- <button class="btn btn-success" {{action doAction view.serviceVersionsReferences.displayed view.actionTypes.REVERT target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.displayedServiceVersion.isCurrent:hidden"}}>{{view.displayedServiceVersion.makeCurrentButtonText}}</button>
+ <button class="btn btn-success" {{action doAction view.serviceVersionsReferences.displayed view.actionTypes.REVERT target="view"}} {{bindAttr disabled="view.versionActionsDisabled" class="view.displayedServiceVersion.canBeMadeCurrent::hidden"}}>{{view.displayedServiceVersion.makeCurrentButtonText}}</button>
</div>
{{/isAccessible}}
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/app/templates/common/configs/service_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_version_box.hbs b/ambari-web/app/templates/common/configs/service_version_box.hbs
index 132a8ab..72127ef 100644
--- a/ambari-web/app/templates/common/configs/service_version_box.hbs
+++ b/ambari-web/app/templates/common/configs/service_version_box.hbs
@@ -47,7 +47,7 @@
<button {{bindAttr disabled="serviceVersion.disabledActionAttr.view" class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.view"}} {{action doAction serviceVersion view.actionTypes.SWITCH target="view.parentView"}}><i class="icon-search"></i> {{t common.view}}</button>
{{#isAccessible MANAGER}}
<button {{bindAttr disabled="serviceVersion.disabledActionAttr.compare" class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.compare"}} {{action doAction serviceVersion view.actionTypes.COMPARE target="view.parentView"}}><i class="icon-copy"></i> {{t common.compare}}</button>
- <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert" class=":btn serviceVersion.isCurrent:not-allowed-cursor" title="serviceVersion.disabledActionMessages.revert"}} {{action doAction serviceVersion view.actionTypes.REVERT target="view.parentView"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
+ <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert" class=":btn serviceVersion.isCurrent:not-allowed-cursor serviceVersion.isCompatible::hidden" title="serviceVersion.disabledActionMessages.revert"}} {{action doAction serviceVersion view.actionTypes.REVERT target="view.parentView"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
{{/isAccessible}}
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/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 21dc116..18beeb1 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2302,7 +2302,7 @@ var urls = {
}
},
'service.serviceConfigVersions.get': {
- real: '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&fields=service_config_version,user,hosts,group_id,group_name,is_current,createtime,service_name,service_config_version_note,stack_id&minimal_response=true',
+ real: '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&fields=service_config_version,user,hosts,group_id,group_name,is_current,createtime,service_name,service_config_version_note,stack_id,is_cluster_compatible&minimal_response=true',
mock: '/data/configurations/service_versions.json'
},
'service.serviceConfigVersions.get.current': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab5f3f7/ambari-web/test/models/configs/service_config_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/service_config_version_test.js b/ambari-web/test/models/configs/service_config_version_test.js
index fbddcb8..e721890 100644
--- a/ambari-web/test/models/configs/service_config_version_test.js
+++ b/ambari-web/test/models/configs/service_config_version_test.js
@@ -51,4 +51,39 @@ describe('App.ServiceConfigVersion', function () {
});
+ describe('#canBeMadeCurrent', function () {
+
+ var cases = [
+ {
+ isCompatible: true,
+ isCurrent: true,
+ canBeMadeCurrent: false,
+ title: 'current version'
+ },
+ {
+ isCompatible: true,
+ isCurrent: false,
+ canBeMadeCurrent: true,
+ title: 'compatible version'
+ },
+ {
+ isCompatible: false,
+ isCurrent: false,
+ canBeMadeCurrent: false,
+ title: 'not compatible version'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ model.setProperties({
+ isCompatible: item.isCompatible,
+ isCurrent: item.isCurrent
+ });
+ expect(model.get('canBeMadeCurrent')).to.equal(item.canBeMadeCurrent);
+ });
+ });
+
+ });
+
});