You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/11/28 21:20:38 UTC
[19/24] ambari git commit: AMBARI-22495. Installer - Select Version
page should show HDP-GPL repo if necessary (vsubramanian)
AMBARI-22495. Installer - Select Version page should show HDP-GPL repo if necessary (vsubramanian)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/85418298
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85418298
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85418298
Branch: refs/heads/branch-2.6
Commit: 8541829876ae3edcfbe96587270ecedad86f36e8
Parents: 059fadf
Author: Vivek Ratnavel Subramanian <vi...@gmail.com>
Authored: Wed Nov 22 17:55:46 2017 -0800
Committer: Vivek Ratnavel Subramanian <vi...@gmail.com>
Committed: Wed Nov 22 17:55:46 2017 -0800
----------------------------------------------------------------------
ambari-web/app/controllers/installer.js | 53 +++++++++++---------
.../app/controllers/wizard/step8_controller.js | 12 +++--
.../app/mappers/repository_version_mapper.js | 3 +-
ambari-web/app/mappers/stack_mapper.js | 3 +-
ambari-web/app/models/repository.js | 17 +++++++
.../app/models/stack_version/repository.js | 3 +-
ambari-web/app/templates/wizard/step1.hbs | 2 +
ambari-web/test/controllers/installer_test.js | 14 ++++--
8 files changed, 69 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index a45ac57..afce91a 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -807,6 +807,7 @@ App.InstallerController = App.WizardController.extend(App.UserPref, {
"repo_id": repository.get('repoId'),
"repo_name": repository.get('repoName'),
"components": repository.get('components'),
+ "tags": repository.get('tags'),
"distribution": repository.get('distribution')
}
});
@@ -827,7 +828,7 @@ App.InstallerController = App.WizardController.extend(App.UserPref, {
var dfd = $.Deferred();
if (selectedStack && selectedStack.get('operatingSystems')) {
this.set('validationCnt', selectedStack.get('operatingSystems').filterProperty('isSelected').filterProperty('isEmpty', false).map(function (os) {
- return os.get('repositories.length');
+ return os.get('repositories').filterProperty('showRepo', true).length;
}).reduce(Em.sum, 0));
var verifyBaseUrl = !wizardStep1Controller.get('skipValidationChecked') && !wizardStep1Controller.get('selectedStack.useRedhatSatellite');
if (!verifyBaseUrl) {
@@ -836,32 +837,34 @@ App.InstallerController = App.WizardController.extend(App.UserPref, {
selectedStack.get('operatingSystems').forEach(function (os) {
if (os.get('isSelected') && !os.get('isEmpty')) {
os.get('repositories').forEach(function (repo) {
- repo.setProperties({
- errorTitle: '',
- errorContent: '',
- validation: App.Repository.validation.INPROGRESS
- });
- this.set('content.isCheckInProgress', true);
- App.ajax.send({
- name: 'wizard.advanced_repositories.valid_url',
- sender: this,
- data: {
- stackName: stackName,
- stackVersion: stackVersion,
- repoId: repo.get('repoId'),
- osType: os.get('osType'),
- osId: os.get('id'),
- dfd: dfd,
+ if (repo.get('showRepo')) {
+ repo.setProperties({
+ errorTitle: '',
+ errorContent: '',
+ validation: App.Repository.validation.INPROGRESS
+ });
+ this.set('content.isCheckInProgress', true);
+ App.ajax.send({
+ name: 'wizard.advanced_repositories.valid_url',
+ sender: this,
data: {
- 'Repositories': {
- 'base_url': repo.get('baseUrl'),
- "verify_base_url": verifyBaseUrl
+ stackName: stackName,
+ stackVersion: stackVersion,
+ repoId: repo.get('repoId'),
+ osType: os.get('osType'),
+ osId: os.get('id'),
+ dfd: dfd,
+ data: {
+ 'Repositories': {
+ 'base_url': repo.get('baseUrl'),
+ "verify_base_url": verifyBaseUrl
+ }
}
- }
- },
- success: 'checkRepoURLSuccessCallback',
- error: 'checkRepoURLErrorCallback'
- });
+ },
+ success: 'checkRepoURLSuccessCallback',
+ error: 'checkRepoURLErrorCallback'
+ });
+ }
}, this);
} else if (os.get('isSelected') && os.get('isEmpty')) {
os.set('isSelected', false);
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 4bedde0..be86b21 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -307,11 +307,13 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz
selectedStack.get('operatingSystems').forEach(function (os) {
if (os.get('isSelected')) {
os.get('repositories').forEach(function(repo) {
- allRepos.push(Em.Object.create({
- base_url: repo.get('baseUrl'),
- os_type: repo.get('osType'),
- repo_id: repo.get('repoId')
- }));
+ if (repo.get('showRepo')) {
+ allRepos.push(Em.Object.create({
+ base_url: repo.get('baseUrl'),
+ os_type: repo.get('osType'),
+ repo_id: repo.get('repoId')
+ }));
+ }
}, this);
}
}, this);
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js b/ambari-web/app/mappers/repository_version_mapper.js
index 90086f2..1cd0c12 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -73,7 +73,8 @@ App.repoVersionMapper = App.QuickDataMapper.create({
repo_id : 'Repositories.repo_id',
repo_name : 'Repositories.repo_name',
stack_name : 'Repositories.stack_name',
- stack_version : 'Repositories.stack_version'
+ stack_version : 'Repositories.stack_version',
+ tags: 'Repositories.tags'
},
map: function (json, loadAll, isCurrentStackOnly) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/mappers/stack_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_mapper.js b/ambari-web/app/mappers/stack_mapper.js
index 822d35b..64a8e8c 100644
--- a/ambari-web/app/mappers/stack_mapper.js
+++ b/ambari-web/app/mappers/stack_mapper.js
@@ -86,7 +86,8 @@ App.stackMapper = App.QuickDataMapper.create({
stack_version: 'stack_version',
operating_system_id: 'os_id',
components: 'components',
- distribution: 'distribution'
+ distribution: 'distribution',
+ tags: 'tags'
},
map: function(json) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/models/repository.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/repository.js b/ambari-web/app/models/repository.js
index 91f0083..42393c2 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -34,6 +34,7 @@ App.Repository = DS.Model.extend({
operatingSystem: DS.belongsTo('App.OperatingSystem'),
components: DS.attr('string'),
distribution: DS.attr('string'),
+ tags: DS.attr('array'),
validation: DS.attr('string', {defaultValue: ''}),
errorContent: DS.attr('string', {defaultValue: ''}),
@@ -60,6 +61,22 @@ App.Repository = DS.Model.extend({
return this.get('repoName').contains('UTILS');
}.property('repoName'),
+ /**
+ * @type {boolean}
+ */
+ isGPL: function () {
+ return this.get('tags').contains('GPL');
+ }.property('tags'),
+
+ /**
+ * Determines whether a repo needs to be displayed in the UI or not
+ * @type {boolean}
+ */
+ showRepo: function () {
+ const isGPLAccepted = App.router.get('clusterController.ambariProperties')['gpl.license.accepted'] === 'true';
+ return isGPLAccepted || !this.get('isGPL');
+ }.property('isGPL'),
+
undo: Em.computed.notEqualProperties('baseUrl', 'baseUrlInit'),
notEmpty: Em.computed.notEqual('baseUrl', ''),
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/models/stack_version/repository.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/repository.js b/ambari-web/app/models/stack_version/repository.js
index 8bd4323..6c93416 100644
--- a/ambari-web/app/models/stack_version/repository.js
+++ b/ambari-web/app/models/stack_version/repository.js
@@ -29,7 +29,8 @@ App.Repository = DS.Model.extend({
repoName : DS.attr('string'),
stackName : DS.attr('string'),
stackVersion : DS.attr('string'),
- operatingSystem: DS.belongsTo('App.OS')
+ operatingSystem: DS.belongsTo('App.OS'),
+ tags: DS.attr('array')
});
App.Repository.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs
index 485bd5d..2cf5646 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -148,6 +148,7 @@
</div>
<div class="span9 repo-name-url">
{{#each repository in operatingSystem.repositories}}
+ {{#if repository.showRepo}}
<div {{bindAttr class=":clearfix :repo-name-url-inner repository.repoName"}}>
<div class="span3">
<label class="repo-name-label control-label">{{repository.repoId}}</label>
@@ -176,6 +177,7 @@
{{/if}}
</div>
</div>
+ {{/if}}
{{/each}}
</div>
<div {{bindAttr class=":span1 :remove-icon controller.selectedStack.useRedhatSatellite:disabled"}} {{action "removeOS" operatingSystem target="controller"}}>
http://git-wip-us.apache.org/repos/asf/ambari/blob/85418298/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 3e1c622..9a17486 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -92,7 +92,8 @@ describe('App.InstallerController', function () {
isEmpty: false,
errorTitle: '1',
errorContent: '1',
- validation: ''
+ validation: '',
+ showRepo: true
})
])
})
@@ -131,7 +132,8 @@ describe('App.InstallerController', function () {
"isEmpty": false,
"errorTitle": "",
"errorContent": "",
- "validation": "icon-repeat"
+ "validation": "icon-repeat",
+ "showRepo": true
}
]
}
@@ -172,7 +174,8 @@ describe('App.InstallerController', function () {
isEmpty: false,
errorTitle: '1',
errorContent: '1',
- validation: ''
+ validation: '',
+ showRepo: true
})
])
})
@@ -189,7 +192,7 @@ describe('App.InstallerController', function () {
}
}
};
- it ('Should check stacks for sucess', function() {
+ it ('Should check stacks for success', function() {
installerController.set('content.stacks', stacks);
installerController.checkRepoURLSuccessCallback(null,null,data);
@@ -220,7 +223,8 @@ describe('App.InstallerController', function () {
"isEmpty": false,
"errorTitle": "1",
"errorContent": "1",
- "validation": "icon-ok"
+ "validation": "icon-ok",
+ "showRepo": true
}
]
}