This is an automated email from the ASF dual-hosted git repository.
atkach pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.6 by this push:
new f1e7b53 AMBARI-22952 UI Install is unable to work with 'Redhat
Satellite/Spacewalk' as local repository
f1e7b53 is described below
commit f1e7b53998e39e5c13ce997d06a8bf36ca429ab3
Author: Andrii Tkach <[email protected]>
AuthorDate: Fri Feb 9 17:13:46 2018 +0200
AMBARI-22952 UI Install is unable to work with 'Redhat Satellite/Spacewalk'
as local repository
---
.../stackVersions/StackVersionsCreateCtrl.js | 9 +----
.../app/views/stackVersions/stackVersionPage.html | 2 +-
ambari-web/app/models/repository.js | 2 +-
ambari-web/app/templates/wizard/step1.hbs | 2 +-
ambari-web/app/views/wizard/step1_view.js | 41 ++++++++++++++-----
ambari-web/test/views/wizard/step1_view_test.js | 47 +++++++++++++++++-----
6 files changed, 72 insertions(+), 31 deletions(-)
diff --git
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
index fed9790..a198d54 100644
---
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
+++
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
@@ -292,8 +292,7 @@ angular.module('ambariAdminConsole')
enabled = true
}
});
- var isRedhatSatelliteSelected = $scope.useRedhatSatellite;
- return !(isRedhatSatelliteSelected || (enabled &&
$scope.validBaseUrlsExist()));
+ return !(enabled && $scope.validBaseUrlsExist());
};
$scope.defaulfOSRepos = {};
@@ -309,12 +308,6 @@ angular.module('ambariAdminConsole')
}
});
- if ( $scope.useRedhatSatellite ){
- angular.forEach( $scope.osList, function (os) {
- os.repositories = [];
- } )
- }
-
var skip = $scope.skipValidation || $scope.useRedhatSatellite;
return Stack.validateBaseUrls(skip, $scope.osList,
$scope.upgradeStack).then(function (invalidUrls) {
if (invalidUrls.length === 0) {
diff --git
a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
index 447d755..734ab33 100644
---
a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
+++
b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
@@ -188,7 +188,7 @@
<input type="text" class="form-control"
placeholder="{{(repository.Repositories.repo_name.indexOf('UTILS') < 0
)?('versions.repository.placeholder' | translate) : ''}}"
ng-model="repository.Repositories.base_url"
- ng-change="onRepoUrlChange(repository)"
ng-disabled="useRedhatSatellite">
+ ng-change="onRepoUrlChange(repository)"
ng-disabled="useRedhatSatellite &&
os.OperatingSystems.os_type.indexOf('redhat') === -1">
</div>
<i class="fa fa-undo orange-icon cursor-pointer"
ng-if="selectedOption.index == 1 &&
repository.Repositories.base_url != repository.Repositories.initial_base_url
diff --git a/ambari-web/app/models/repository.js
b/ambari-web/app/models/repository.js
index 42393c2..79c8636 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -47,7 +47,7 @@ App.Repository = DS.Model.extend({
}.property('baseUrl'),
isEmpty: function() {
- return this.get('baseUrl') == '';
+ return this.get('showRepo') && this.get('baseUrl') === '';
}.property('baseUrl'),
invalidError: function() {
diff --git a/ambari-web/app/templates/wizard/step1.hbs
b/ambari-web/app/templates/wizard/step1.hbs
index 2cf5646..cb345ae 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -159,7 +159,7 @@
{{/if}}
</div>
<div {{bindAttr class=":span8 :repo-url
repository.invalidFormatError:textfield-error
repository.invalidError:textfield-error"}}>
- {{view Ember.TextField
placeholderBinding="repository.placeholder" valueBinding="repository.baseUrl"
disabledBinding="controller.selectedStack.useRedhatSatellite"}}
+ {{view view.repositoryTextField
repositoryBinding="repository"}}
{{#if controller.selectedStack.usePublicRepo}}
{{#if repository.undo}}
<i class="icon-undo" data-toggle="tooltip"
diff --git a/ambari-web/app/views/wizard/step1_view.js
b/ambari-web/app/views/wizard/step1_view.js
index ccbc844..3e78810 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -69,14 +69,14 @@ App.WizardStep1View = Em.View.extend({
*
* @type {bool}
*/
- isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked',
'isNoOsFilled', 'controller.content.isCheckInProgress',
'App.router.btnClickInProgress', '!controller.isLoadingComplete'),
+ isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked',
'isAnyOsEmpty', 'controller.content.isCheckInProgress',
'App.router.btnClickInProgress', '!controller.isLoadingComplete'),
/**
* Show warning message flag
*
* @type {bool}
*/
- warningExist: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked',
'isNoOsFilled'),
+ warningExist: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked',
'isAnyOsEmpty'),
skipVerifyBaseUrl:
Em.computed.or('controller.selectedStack.skipValidationChecked',
'controller.selectedStack.useRedhatSatellite'),
@@ -170,12 +170,9 @@ App.WizardStep1View = Em.View.extend({
* @type {bool}
*/
invalidFormatUrlExist: function () {
- if (this.get('controller.selectedStack.useRedhatSatellite')) {
- return false;
- }
var allRepositories = this.get('allRepositories');
- if (!allRepositories) {
- return false;
+ if (this.get('controller.selectedStack.useRedhatSatellite')) {
+ allRepositories = allRepositories.filter(this.isRedhat);
}
return allRepositories.someProperty('invalidFormatError', true);
}.property('controller.selectedStack.useRedhatSatellite',
'[email protected]'),
@@ -193,16 +190,28 @@ App.WizardStep1View = Em.View.extend({
isNoOsChecked:
Em.computed.everyBy('controller.selectedStack.operatingSystems', 'isSelected',
false),
/**
- * If all OSes are empty
+ *
+ * @param {App.Repository} item
+ * @returns {boolean}
+ */
+ isRedhat: function(item) {
+ return Boolean(item.get('osType') &&
item.get('osType').contains('redhat'));
+ },
+
+ /**
+ * If any OS is empty
* @type {bool}
*/
- isNoOsFilled: function () {
+ isAnyOsEmpty: function () {
var operatingSystems =
this.get('controller.selectedStack.operatingSystems');
- if (this.get('controller.selectedStack.useRedhatSatellite') ||
Em.isNone(operatingSystems)) {
+ if (Em.isNone(operatingSystems)) {
return false;
}
var selectedOS = operatingSystems.filterProperty('isSelected', true);
- return selectedOS.everyProperty('isNotFilled', true);
+ if (this.get('controller.selectedStack.useRedhatSatellite')) {
+ selectedOS = selectedOS.filter(this.isRedhat);
+ }
+ return selectedOS.someProperty('isNotFilled', true);
}.property('[email protected]',
'[email protected]',
'controller.selectedStack.useRedhatSatellite'),
popoverView: Em.View.extend({
@@ -236,6 +245,16 @@ App.WizardStep1View = Em.View.extend({
}
}),
+ repositoryTextField: Ember.TextField.extend({
+ repository: null,
+ placeholderBinding: "repository.placeholder",
+ valueBinding: "repository.baseUrl",
+ disabled: function() {
+ var isRedhat = this.get('parentView').isRedhat(this.get('repository'));
+ return this.get('controller.selectedStack.useRedhatSatellite') &&
!isRedhat;
+ }.property('controller.selectedStack.useRedhatSatellite')
+ }),
+
/**
* Handler when editing any repo BaseUrl
*
diff --git a/ambari-web/test/views/wizard/step1_view_test.js
b/ambari-web/test/views/wizard/step1_view_test.js
index 66db304..f353a2f 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -35,7 +35,7 @@ describe('App.WizardStep1View', function () {
App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked',
'controller.selectedStack.operatingSystems', 'isSelected', false);
- App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled',
['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled',
'controller.content.isCheckInProgress', 'App.router.btnClickInProgress',
'!controller.isLoadingComplete']);
+ App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled',
['invalidFormatUrlExist', 'isNoOsChecked', 'isAnyOsEmpty',
'controller.content.isCheckInProgress', 'App.router.btnClickInProgress',
'!controller.isLoadingComplete']);
App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist',
'allRepositories', 'validation', App.Repository.validation.INVALID);
@@ -58,21 +58,27 @@ describe('App.WizardStep1View', function () {
});
});
- describe('#isNoOsFilled', function() {
+ describe('#isAnyOsEmpty', function() {
- it('should be false when useRedhatSatellite is true', function() {
+ it('should be true when useRedhatSatellite is true and redhat os is
empty', function() {
view.set('controller.selectedStack', Em.Object.create({
- useRedhatSatellite: true
+ useRedhatSatellite: true,
+ operatingSystems: [
+ Em.Object.create({
+ isSelected: true,
+ isNotFilled: true,
+ osType: 'redhat'
+ })
+ ]
}));
- expect(view.get('isNoOsFilled')).to.be.false;
+ expect(view.get('isAnyOsEmpty')).to.be.true;
});
it('should be false when operatingSystems is null', function() {
view.set('controller.selectedStack', Em.Object.create({
- useRedhatSatellite: false,
operatingSystems: null
}));
- expect(view.get('isNoOsFilled')).to.be.false;
+ expect(view.get('isAnyOsEmpty')).to.be.false;
});
it('should be false when operatingSystem is filled', function() {
@@ -85,7 +91,7 @@ describe('App.WizardStep1View', function () {
})
]
}));
- expect(view.get('isNoOsFilled')).to.be.false;
+ expect(view.get('isAnyOsEmpty')).to.be.false;
});
it('should be true when operatingSystem is not filled', function() {
@@ -95,10 +101,33 @@ describe('App.WizardStep1View', function () {
Em.Object.create({
isSelected: true,
isNotFilled: true
+ }),
+ Em.Object.create({
+ isSelected: true,
+ isNotFilled: false
})
]
}));
- expect(view.get('isNoOsFilled')).to.be.true;
+ expect(view.get('isAnyOsEmpty')).to.be.true;
+ });
+ });
+
+ describe('#isRedhat', function() {
+
+ it('should be false when osType not specified', function() {
+ expect(view.isRedhat(Em.Object.create())).to.be.false;
+ });
+
+ it('should be false when osType not redhat', function() {
+ expect(view.isRedhat(Em.Object.create({osType: 'debian7'}))).to.be.false;
+ });
+
+ it('should be true when osType is redhat7', function() {
+ expect(view.isRedhat(Em.Object.create({osType: 'redhat7'}))).to.be.true;
+ });
+
+ it('should be true when osType is redhat-ppc7', function() {
+ expect(view.isRedhat(Em.Object.create({osType:
'redhat-ppc7'}))).to.be.true;
});
});
});
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
[email protected].