AMBARI-20671 Host checks: incorrect message for single host warnings. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6ee881bc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6ee881bc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6ee881bc Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 6ee881bcf22016fa0213a11a13fc3b93356caabf Parents: 36629d5 Author: ababiichuk <[email protected]> Authored: Tue Apr 4 19:22:31 2017 +0300 Committer: ababiichuk <[email protected]> Committed: Tue Apr 4 19:22:31 2017 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step3_controller.js | 3 +- .../main/host/details/actions/check_host.js | 86 +++++--------------- .../wizard/step3/step3_host_warnings_popup.hbs | 6 +- .../test/controllers/wizard/step3_test.js | 34 -------- 4 files changed, 24 insertions(+), 105 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/controllers/wizard/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js index 7a07253..c282451 100644 --- a/ambari-web/app/controllers/wizard/step3_controller.js +++ b/ambari-web/app/controllers/wizard/step3_controller.js @@ -787,8 +787,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check hosts: hostsJDKContext, hostsLong: hostsJDKContext, hostsNames: hostsJDKNames, - category: 'jdk', - onSingleHost: false + category: 'jdk' }); } this.set('jdkCategoryWarnings', jdkWarnings); http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/mixins/main/host/details/actions/check_host.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js index fbee24c..c0ebf02 100644 --- a/ambari-web/app/mixins/main/host/details/actions/check_host.js +++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js @@ -53,7 +53,6 @@ App.CheckHostMixin = Em.Mixin.create({ * hosts: string[], * hostsLong: string[], * hostsNames: string[], - * onSingleHost: boolean * }} checkWarning */ @@ -309,8 +308,7 @@ App.CheckHostMixin = Em.Mixin.create({ hosts: hostsContext, hostsLong: hostsContext, hostsNames: hostsRepoNames, - category: 'repositories', - onSingleHost: false + category: 'repositories' }); } if (hostsDiskContext.length > 0) { // disk space warning exist @@ -319,8 +317,7 @@ App.CheckHostMixin = Em.Mixin.create({ hosts: hostsDiskContext, hostsLong: hostsDiskContext, hostsNames: hostsDiskNames, - category: 'disk', - onSingleHost: false + category: 'disk' }); } if (thpContext.length > 0) { // THP warning existed @@ -329,8 +326,7 @@ App.CheckHostMixin = Em.Mixin.create({ hosts: thpContext, hostsLong: thpContext, hostsNames: thpHostsNames, - category: 'thp', - onSingleHost: false + category: 'thp' }); } @@ -373,8 +369,7 @@ App.CheckHostMixin = Em.Mixin.create({ name: name, hosts: [contextMessage], hostsLong: [contextMessageLong], - hostsNames: [targetHostName], - onSingleHost: true + hostsNames: [targetHostName] }; this.get("hostCheckWarnings").push(hostInfo); } else { @@ -382,7 +377,6 @@ App.CheckHostMixin = Em.Mixin.create({ hostInfo.hosts.push(contextMessage); hostInfo.hostsLong.push(contextMessageLong); hostInfo.hostsNames.push(targetHostName); - hostInfo.onSingleHost = false; } } } @@ -549,14 +543,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warningCategories.fileFoldersWarnings[path.name] = warning = { name: path.name, hosts: [hostName], hostsLong: [hostName], - category: 'fileFolders', - onSingleHost: true + category: 'fileFolders' }; } host.warnings.push(warning); @@ -572,15 +564,13 @@ App.CheckHostMixin = Em.Mixin.create({ warning.hosts.push(hostName); warning.hostsLong.push(hostName); warning.version = _package.version; - warning.onSingleHost = false; } else { warningCategories.packagesWarnings[_package.name] = warning = { name: _package.name, version: _package.version, hosts: [hostName], hostsLong: [hostName], - category: 'packages', - onSingleHost: true + category: 'packages' }; } host.warnings.push(warning); @@ -606,7 +596,6 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warningCategories.processesWarnings[process.pid] = warning = { name: (process.command.substr(0, 35) + '...'), @@ -618,8 +607,7 @@ App.CheckHostMixin = Em.Mixin.create({ command: '<table><tr><td style="word-break: break-all;">' + ((process.command.length < 500) ? process.command : process.command.substr(0, 230) + '...' + '<p style="text-align: center">................</p>' + - '...' + process.command.substr(-230)) + '</td></tr></table>', - onSingleHost: true + '...' + process.command.substr(-230)) + '</td></tr></table>' }; } host.warnings.push(warning); @@ -634,14 +622,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warningCategories.servicesWarnings[service.name] = warning = { name: service.name, hosts: [hostName], hostsLong: [hostName], - category: 'services', - onSingleHost: true + category: 'services' }; } host.warnings.push(warning); @@ -656,14 +642,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warningCategories.usersWarnings[user.name] = warning = { name: user.name, hosts: [hostName], hostsLong: [hostName], - category: 'users', - onSingleHost: true + category: 'users' }; } host.warnings.push(warning); @@ -677,14 +661,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warning = { name: umask, hosts: [hostName], hostsLong: [hostName], - category: 'misc', - onSingleHost: true + category: 'misc' }; warnings.push(warning); } @@ -698,14 +680,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warning = { name: name, hosts: [hostName], hostsLong: [hostName], - category: 'firewall', - onSingleHost: true + category: 'firewall' }; warnings.push(warning); } @@ -718,15 +698,13 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warningCategories.alternativeWarnings[alternative.name] = warning = { name: alternative.name, target: alternative.target, hosts: [hostName], hostsLong: [hostName], - category: 'alternatives', - onSingleHost: true + category: 'alternatives' }; } host.warnings.push(warning); @@ -739,14 +717,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(hostName); warning.hostsLong.push(hostName); - warning.onSingleHost = false; } else { warning = { name: name, hosts: [hostName], hostsLong: [hostName], - category: 'reverseLookup', - onSingleHost: true + category: 'reverseLookup' }; warnings.push(warning); } @@ -810,14 +786,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warningCategories.fileFoldersWarnings[path.name] = warning = { name: path.name, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'fileFolders', - onSingleHost: true + category: 'fileFolders' }; } host.warnings.push(warning); @@ -833,15 +807,13 @@ App.CheckHostMixin = Em.Mixin.create({ warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); warning.version = _package.version; - warning.onSingleHost = false; } else { warningCategories.packagesWarnings[_package.name] = warning = { name: _package.name, version: _package.version, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'packages', - onSingleHost: true + category: 'packages' }; } host.warnings.push(warning); @@ -858,7 +830,6 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warningCategories.processesWarnings[process.pid] = warning = { name: (process.command.substr(0, 35) + '...'), @@ -870,8 +841,7 @@ App.CheckHostMixin = Em.Mixin.create({ command: '<table><tr><td style="word-break: break-all;">' + ((process.command.length < 500) ? process.command : process.command.substr(0, 230) + '...' + '<p style="text-align: center">................</p>' + - '...' + process.command.substr(-230)) + '</td></tr></table>', - onSingleHost: true + '...' + process.command.substr(-230)) + '</td></tr></table>' }; } host.warnings.push(warning); @@ -888,14 +858,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warningCategories.servicesWarnings[service.name] = warning = { name: service.name, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'services', - onSingleHost: true + category: 'services' }; } host.warnings.push(warning); @@ -911,14 +879,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warningCategories.usersWarnings[user.name] = warning = { name: user.name, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'users', - onSingleHost: true + category: 'users' }; } host.warnings.push(warning); @@ -932,14 +898,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warning = { name: umask, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'misc', - onSingleHost: true + category: 'misc' }; warnings.push(warning); } @@ -953,14 +917,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warning = { name: name, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'firewall', - onSingleHost: true + category: 'firewall' }; warnings.push(warning); } @@ -973,15 +935,13 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warningCategories.alternativeWarnings[alternative.name] = warning = { name: alternative.name, target: alternative.target, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'alternatives', - onSingleHost: true + category: 'alternatives' }; } host.warnings.push(warning); @@ -994,14 +954,12 @@ App.CheckHostMixin = Em.Mixin.create({ if (warning) { warning.hosts.push(_host.Hosts.host_name); warning.hostsLong.push(_host.Hosts.host_name); - warning.onSingleHost = false; } else { warning = { name: name, hosts: [_host.Hosts.host_name], hostsLong: [_host.Hosts.host_name], - category: 'reverseLookup', - onSingleHost: true + category: 'reverseLookup' }; warnings.push(warning); } http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs index e8c5201..07ff31b 100644 --- a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs +++ b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs @@ -90,11 +90,7 @@ <td>{{category.action}} <a href="javascript:void(null);" rel='HostsListTooltip' {{bindAttr data-original-title="warning.hostsList"}} {{action showHostsPopup warning.hostsLong}} {{QAAttr "host-with-warning-link"}}> {{warning.hosts.length}} - {{#if warning.onSingleHost}} - {{t installer.step3.hostWarningsPopup.host}} - {{else}} - {{t installer.step3.hostWarningsPopup.hosts}} - {{/if}} + {{pluralize warning.hosts.length singular="t:installer.step3.hostWarningsPopup.host" plular="t:installer.step3.hostWarningsPopup.hosts"}} </a> </td> </tr> http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/test/controllers/wizard/step3_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js index fa90065..b8bc794 100644 --- a/ambari-web/test/controllers/wizard/step3_test.js +++ b/ambari-web/test/controllers/wizard/step3_test.js @@ -1292,7 +1292,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'fileFolders' } ], @@ -1314,7 +1313,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'fileFolders' } ], @@ -1359,7 +1357,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'services' } ], @@ -1384,7 +1381,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'services' } ], @@ -1422,7 +1418,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'users' } ], @@ -1446,7 +1441,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'users' } ], @@ -1484,7 +1478,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'alternatives' } ], @@ -1508,7 +1501,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'alternatives' } ], @@ -1556,7 +1548,6 @@ describe('App.WizardStep3Controller', function () { { pid: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'processes' } ], @@ -1580,7 +1571,6 @@ describe('App.WizardStep3Controller', function () { { pid: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'processes' } ], @@ -1634,7 +1624,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -1667,7 +1656,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -1683,7 +1671,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1', 'c2']); expect(warnings[0].hostsLong).to.eql(['c1', 'c2']); - expect(warnings[0].onSingleHost).to.equal(false); }); @@ -1710,7 +1697,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -1726,7 +1712,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1', 'c2']); expect(warnings[0].hostsLong).to.eql(['c1', 'c2']); - expect(warnings[0].onSingleHost).to.equal(false); }); }); @@ -1784,7 +1769,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'fileFolders' } ], @@ -1806,7 +1790,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'fileFolders' } ], @@ -1850,7 +1833,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'services' } ], @@ -1872,7 +1854,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'services' } ], @@ -1906,7 +1887,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'users' } ], @@ -1928,7 +1908,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'users' } ], @@ -1962,7 +1941,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'alternatives' } ], @@ -1984,7 +1962,6 @@ describe('App.WizardStep3Controller', function () { { name: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'alternatives' } ], @@ -2028,7 +2005,6 @@ describe('App.WizardStep3Controller', function () { { pid: 'n1', hosts: ['c1'], - onSingleHost: true, category: 'processes' } ], @@ -2050,7 +2026,6 @@ describe('App.WizardStep3Controller', function () { { pid: 'n1', hosts: ['c1', 'c2'], - onSingleHost: false, category: 'processes' } ], @@ -2099,7 +2074,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -2132,7 +2106,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -2148,7 +2121,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1', 'c2']); expect(warnings[0].hostsLong).to.eql(['c1', 'c2']); - expect(warnings[0].onSingleHost).to.equal(false); }); @@ -2175,7 +2147,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1']); expect(warnings[0].hostsLong).to.eql(['c1']); - expect(warnings[0].onSingleHost).to.equal(true); }); @@ -2191,7 +2162,6 @@ describe('App.WizardStep3Controller', function () { expect(warnings.length).to.equal(1); expect(warnings[0].hosts).to.eql(['c1', 'c2']); expect(warnings[0].hostsLong).to.eql(['c1', 'c2']); - expect(warnings[0].onSingleHost).to.equal(false); }); @@ -3097,10 +3067,6 @@ describe('App.WizardStep3Controller', function () { expect(this.warnings.hostsNames.toArray()).to.be.eql(['h1', 'h4', 'h7']); }); - it('warning appears on many hosts', function () { - expect(this.warnings.onSingleHost).to.be.false; - }); - it('validation context for hosts is valid', function () { var hosts = this.warnings.hosts; var expected = [
