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/20 16:54:10 UTC
ambari git commit: AMBARI-10600. Services actions menu is loaded
partially after opening (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 6ffa2b725 -> b031c745d
AMBARI-10600. Services actions menu is loaded partially after opening (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b031c745
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b031c745
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b031c745
Branch: refs/heads/trunk
Commit: b031c745d3a966e152b53fc1bf5c80b6a37d0692
Parents: 6ffa2b7
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Apr 20 17:52:08 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Apr 20 17:54:06 2015 +0300
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 6 +
ambari-web/app/templates/main/service/item.hbs | 45 +--
.../test/controllers/wizard/step7_test.js | 371 +++++++++++++++++++
3 files changed, 401 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b031c745/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 938d539..761b930 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -1021,6 +1021,12 @@ h1 {
height: 36px;
background: url("/img/spinner.gif");
margin: 0 auto;
+
+ &.service-button-spinner {
+ width: 30px;
+ height: 30px;
+ background-size: cover;
+ }
}
.services-host-menu {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b031c745/ambari-web/app/templates/main/service/item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/item.hbs b/ambari-web/app/templates/main/service/item.hbs
index f61bc1a..d7bff8c 100644
--- a/ambari-web/app/templates/main/service/item.hbs
+++ b/ambari-web/app/templates/main/service/item.hbs
@@ -80,27 +80,30 @@
</a>
</li>
{{/unless}}
-
- <!-- Other service actions -->
- {{#each option in view.maintenance}}
- <li {{bindAttr class="option.disabled option.isHidden:hidden option.hasSubmenu:dropdown-submenu option.hasSubmenu:submenu-left"}}>
- <a {{action "doAction" option target="controller" href=true}} {{bindAttr data-title="option.tooltip"}} rel="HealthTooltip">
- <i {{bindAttr class="option.cssClass"}}></i>
- {{option.label}}
- </a>
- {{#if option.hasSubmenu}}
- <div class="dropdown-menu-wrap">
- <ul class="dropdown-menu">
- {{#each item in option.submenuOptions}}
- <li>
- <a {{action "doAction" item target="controller" href=true}}>{{item.context.label}}</a>
- </li>
- {{/each}}
- </ul>
- </div>
- {{/if}}
- </li>
- {{/each}}
+ {{#if view.maintenance.length}}
+ <!-- Other service actions -->
+ {{#each option in view.maintenance}}
+ <li {{bindAttr class="option.disabled option.isHidden:hidden option.hasSubmenu:dropdown-submenu option.hasSubmenu:submenu-left"}}>
+ <a {{action "doAction" option target="controller" href=true}} {{bindAttr data-title="option.tooltip"}} rel="HealthTooltip">
+ <i {{bindAttr class="option.cssClass"}}></i>
+ {{option.label}}
+ </a>
+ {{#if option.hasSubmenu}}
+ <div class="dropdown-menu-wrap">
+ <ul class="dropdown-menu">
+ {{#each item in option.submenuOptions}}
+ <li>
+ <a {{action "doAction" item target="controller" href=true}}>{{item.context.label}}</a>
+ </li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/if}}
+ </li>
+ {{/each}}
+ {{else}}
+ <div class="spinner service-button-spinner"></div>
+ {{/if}}
</ul>
</div>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b031c745/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 64dc91e..4705d10 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -256,6 +256,277 @@ describe('App.InstallerStep7Controller', function () {
});
});
+ describe('#_createSiteToTagMap', function () {
+ it('should return filtered map', function () {
+ var desired_configs = {
+ site1: {
+ tag: "tag1"
+ },
+ site2: {
+ tag: "tag2"
+ },
+ site3: {
+ tag: "tag3"
+ }
+ };
+ var sites = {
+ site1: true,
+ site3: true
+ };
+ var siteToTagMap = installerStep7Controller._createSiteToTagMap(desired_configs,sites)
+ expect(siteToTagMap).to.eql({
+ site1: "tag1",
+ site3: "tag3"
+ });
+ });
+ });
+
+ describe('#checkDatabaseConnectionTest', function () {
+ it('should return promise in process', function () {
+ installerStep7Controller.set('content', {
+ services: Em.A([
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 'OOZIE', ignored: []}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 'HIVE', ignored: []}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3', ignored: []}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4', ignored: []}),
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5', ignored: []}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6', ignored: []}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7', ignored: []}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8', ignored: []})
+ ])
+ });
+ var obj = Em.Object.create({name:'oozie_database',value:"aa"});
+ installerStep7Controller.set('stepConfigs',Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([obj]) })]));
+ var deffer = installerStep7Controller.checkDatabaseConnectionTest();
+ expect(deffer.isResolved()).to.equal(false);
+ deffer.resolve(true);
+ deffer.done(function(data) {
+ expect(data).to.equal(true);
+ });
+ });
+ });
+
+ describe('#submit', function () {
+ it('should return undefined if submit disabled', function () {
+ installerStep7Controller.set('isSubmitDisabled',true);
+ expect(installerStep7Controller.submit()).to.be.undefined;
+ });
+ it('sumbit button should be unclicked if no configs', function () {
+ installerStep7Controller.set('isSubmitDisabled',false);
+ installerStep7Controller.submit();
+ expect(installerStep7Controller.get('submitButtonClicked')).to.be.false;
+ });
+ });
+
+ describe('#activateSpecialConfigs', function () {
+ var expected = [{
+ "smokeuser": {
+ "isEditable": true
+ },
+ "group": {
+ "isEditable": true
+ },
+ "services": [
+ {
+ "serviceName": "s1",
+ "isSelected": true,
+ "isInstalled": false
+ },
+ {
+ "serviceName": "s2",
+ "isSelected": false,
+ "isInstalled": false
+ },
+ {
+ "serviceName": "s3",
+ "isSelected": true,
+ "isInstalled": true
+ },
+ {
+ "serviceName": "s4",
+ "isSelected": false,
+ "isInstalled": false
+ },
+ {
+ "serviceName": "s5",
+ "isSelected": true,
+ "isInstalled": false
+ },
+ {
+ "serviceName": "s6",
+ "isSelected": false,
+ "isInstalled": false
+ },
+ {
+ "serviceName": "s7",
+ "isSelected": true,
+ "isInstalled": true
+ },
+ {
+ "serviceName": "s8",
+ "isSelected": false,
+ "isInstalled": false
+ }
+ ]
+ },[
+ {
+ "serviceName": "MISC",
+ "configs": [
+ {
+ "name": "smokeuser",
+ "value": {
+ "isEditable": true
+ },
+ "isEditable": false
+ },
+ {
+ "name": "user_group",
+ "value": {
+ "isEditable": true
+ },
+ "isEditable": false
+ },
+ {
+ "name": "kdc_type"
+ }
+ ]
+ },
+ {
+ "serviceName": "KERBEROS",
+ "configs": [
+ {
+ "name": "smokeuser",
+ "value": {
+ "isEditable": true
+ },
+ "isEditable": false
+ },
+ {
+ "name": "user_group",
+ "value": {
+ "isEditable": true
+ },
+ "isEditable": false
+ },
+ {
+ "name": "kdc_type"
+ }
+ ]
+ }
+ ]];
+ var allSelectedServiceNames = ['SLIDER', 'YARN'];
+ var configs = Em.A([Em.Object.create({
+ name: 'smokeuser',
+ value: ''
+ }),Em.Object.create({
+ name: 'user_group',
+ value: ''
+ }),Em.Object.create({
+ name: 'kdc_type',
+ value: ''
+ })]);
+ var stepConfigs = Em.A([Em.Object.create({serviceName: 'MISC', configs: configs}),
+ Em.Object.create({serviceName: 'KERBEROS', configs: configs})]);
+ var content = Em.Object.create({
+ smokeuser: Em.Object.create({isEditable: true}),
+ group: Em.Object.create({isEditable: true}),
+ services: Em.A([
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's1'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's2'}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's3'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's4'}),
+ Em.Object.create({isSelected: true, isInstalled: false, serviceName: 's5'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's6'}),
+ Em.Object.create({isSelected: true, isInstalled: true, serviceName: 's7'}),
+ Em.Object.create({isSelected: false, isInstalled: false, serviceName: 's8'})
+ ])
+ });
+ it('should return configs with true value', function () {
+ installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'addServiceController'}));
+ installerStep7Controller.set('addMiscTabToPage',true);
+ installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames});
+ installerStep7Controller.set('stepConfigs', stepConfigs);
+ installerStep7Controller.set('content', content);
+ installerStep7Controller.activateSpecialConfigs();
+ expect(JSON.parse(JSON.stringify(installerStep7Controller.get('content')))).to.be.eql(expected[0]);
+ });
+ it('should return stepsConfigs with true value', function () {
+ installerStep7Controller.set('wizardController', Em.Object.create(App.LocalStorage, {name: 'kerberosWizardController'}));
+ installerStep7Controller.set('addMiscTabToPage',true);
+ installerStep7Controller.reopen({allSelectedServiceNames: allSelectedServiceNames});
+ installerStep7Controller.set('stepConfigs', stepConfigs);
+ installerStep7Controller.set('content', content);
+ installerStep7Controller.activateSpecialConfigs();
+ expect(JSON.parse(JSON.stringify(installerStep7Controller.get('stepConfigs')))).to.be.eql(expected[1]);
+ });
+ });
+
+ describe('#getConfigTagsSuccess', function () {
+ beforeEach(function(){
+ sinon.stub(App.StackService, 'find', function () {
+ return [
+ Em.Object.create({
+ serviceName: 's0',
+ isInstalled: true,
+ configTypes: {
+ site3: true,
+ site1: true
+ }
+ }),
+ Em.Object.create({
+ serviceName: 's1',
+ isInstalled: true,
+ configTypes: {
+ site1: true,
+ site2: true
+ }
+ })
+ ];
+ });
+ });
+ afterEach(function(){
+ App.StackService.find.restore();
+ });
+
+ it('should return serviceConfigTags', function () {
+ var desired_configs = {
+ site1: {
+ tag: "tag1"
+ },
+ site2: {
+ tag: "tag2"
+ },
+ site3: {
+ tag: "tag3"
+ }
+ };
+ var data = {
+ Clusters: {
+ desired_configs: desired_configs
+ }
+ };
+ var siteToTagMap = installerStep7Controller.getConfigTagsSuccess(data)
+ expect(installerStep7Controller.get('serviceConfigTags')).to.eql([
+ {
+ "siteName": "site1",
+ "tagName": "tag1",
+ "newTagName": null
+ },
+ {
+ "siteName": "site2",
+ "tagName": "tag2",
+ "newTagName": null
+ },
+ {
+ "siteName": "site3",
+ "tagName": "tag3",
+ "newTagName": null
+ }
+ ]);
+ expect(installerStep7Controller.get('isAppliedConfigLoaded')).to.equal(true);
+ });
+ });
+
describe('#clearStep', function () {
it('should clear stepConfigs', function () {
installerStep7Controller.set('stepConfigs', [
@@ -335,6 +606,12 @@ describe('App.InstallerStep7Controller', function () {
});
});
+ describe('#checkMySQLHost', function () {
+ it('should send query', function () {
+ expect(installerStep7Controller.checkMySQLHost().readyState).to.equal(1);
+ });
+ });
+
describe('#selectConfigGroup', function () {
beforeEach(function () {
installerStep7Controller.reopen({content: {services: []}});
@@ -1029,6 +1306,7 @@ describe('App.InstallerStep7Controller', function () {
);
installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
+ installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
sinon.stub(App.config, 'renderConfigs', function () {
return serviceConfigs;
});
@@ -1404,6 +1682,43 @@ describe('App.InstallerStep7Controller', function () {
});
+ describe('#setServiceDatabaseConfigs', function () {
+
+ var controller = App.WizardStep7Controller.create({
+ installedServiceNames: ['OOZIE', 'HIVE']
+ });
+ var configs = [
+ {
+ name: 'hive_database',
+ value: 'MySQL',
+ serviceName: 'HIVE',
+ filename: 'hbase-site.xml'
+ },
+ {
+ name: 'oozie_database',
+ value: 'MySQL',
+ serviceName: 'OOZIE',
+ filename: 'ams-hbase-site.xml'
+ }
+ ];
+
+ it('should handle properties with the same name', function () {
+ var services = Em.A([
+ Em.Object.create({
+ isInstalled: true,
+ serviceName: 'SQOOP'
+ }),
+ Em.Object.create({
+ isInstalled: true,
+ serviceName: 'HDFS'
+ })
+ ]);
+ controller.setServiceDatabaseConfigs(configs);
+ var properties = configs.filterProperty('name', 'hive_database');
+ expect(properties).to.have.length(1);
+ });
+ });
+
describe('#getAmbariDatabaseSuccess', function () {
var controller = App.WizardStep7Controller.create({
@@ -1526,6 +1841,62 @@ describe('App.InstallerStep7Controller', function () {
});
+ describe('#loadServiceTagsSuccess', function () {
+ it('should create ClusterSiteToTagMap', function () {
+ var params = Em.Object.create({
+ serviceName: "OOZIE",
+ serviceConfigsDef: Em.Object.create({
+ configTypes: Em.Object.create({
+ site3: true,
+ site2: true,
+ site1: true
+ })
+ })
+ });
+ var wizardController = Em.Object.create({
+ allHosts: [
+ {hostName: 'h1'},
+ {hostName: 'h2'},
+ {hostName: 'h3'}
+ ]
+ });
+ installerStep7Controller.set('wizardController', wizardController);
+ installerStep7Controller.set('stepConfigs', Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([]) })]));
+ var desired_configs = {
+ site1: {
+ tag: "tag1"
+ },
+ site2: {
+ tag: "tag2"
+ },
+ site3: {
+ tag: "tag3"
+ }
+ };
+ var data = {
+ config_groups: Em.A([Em.Object.create({
+ ConfigGroup: Em.Object.create({
+ tag: 'OOZIE',
+ hosts: Em.A([Em.Object.create({host_name: 'h1'})]),
+ id: 1,
+ group_name: "",
+ description: "",
+ desired_configs: Em.A([Em.Object.create({
+ type: '1',
+ tag: 'h1'
+ })])
+ })
+ })]),
+ Clusters: {
+ desired_configs: desired_configs
+ }
+ };
+ installerStep7Controller.loadServiceTagsSuccess(data, {}, params);
+ var result = installerStep7Controller.get("loadedClusterSiteToTagMap");
+ expect(JSON.parse(JSON.stringify(result))).to.eql(JSON.parse(JSON.stringify({"site1":"tag1","site2":"tag2","site3":"tag3"})));
+ })
+ });
+
describe('#issuesFilterLinkText', function () {
issuesFilterCases.forEach(function (item) {