This is an automated email from the ASF dual-hosted git repository.
atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new cf2d6e1 AMBARI-22952 UI Install is unable to work with 'Redhat
Satellite/Spacewalk' as local repository
cf2d6e1 is described below
commit cf2d6e18e7f947334556f4531f07bd6b8759fd40
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 | 4 +-
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, 73 insertions(+), 32 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 2a2151d..c3353f7 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 0f06f7c..61d5257 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
@@ -187,7 +187,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
@@ -240,4 +240,4 @@
<button class="btn btn-default pull-right"
ng-click="cancel()">{{'common.controls.cancel' | translate}}</button>
</div>
</form>
-</form>
\ No newline at end of file
+</form>
diff --git a/ambari-web/app/models/repository.js
b/ambari-web/app/models/repository.js
index 58314cf..9b3e56c 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -53,7 +53,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 e20eb94..8f1583a 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -144,7 +144,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 a12c0c7..27e71bc 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -80,14 +80,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'),
@@ -175,12 +175,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]'),
@@ -198,16 +195,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({
@@ -244,6 +253,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 12ce412..91b0a71 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', 'INVALID');
@@ -66,21 +66,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() {
@@ -93,7 +99,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() {
@@ -103,10 +109,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].