You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/11/27 20:24:41 UTC
[31/49] ambari git commit: AMBARI-22496. Admin View - Manage Versions
page should show HDP-GPL repo if necessary (vsubramanian)
AMBARI-22496. Admin View - Manage Versions 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/9fc7223d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9fc7223d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9fc7223d
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 9fc7223df9a50fe69f4d8884939718b3f3bcf31b
Parents: 1d4cbc8
Author: Vivek Ratnavel Subramanian <vi...@gmail.com>
Authored: Wed Nov 22 17:01:15 2017 -0800
Committer: Vivek Ratnavel Subramanian <vi...@gmail.com>
Committed: Wed Nov 22 17:01:15 2017 -0800
----------------------------------------------------------------------
.../stackVersions/StackVersionsEditCtrl.js | 27 ++++++++++++++++++-
.../ui/admin-web/app/scripts/services/Stack.js | 14 ++++++++++
.../views/stackVersions/stackVersionPage.html | 28 +++++++++++---------
3 files changed, 55 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7223d/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 09e3c28..542772e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@ -33,6 +33,15 @@ angular.module('ambariAdminConsole')
display_name: ''
};
$scope.defaulfOSRepos = {}; // a copy of initial loaded repo info for "changed" check later
+ $scope.isGPLAccepted = false;
+
+ $scope.isGPLRepo = function (repository) {
+ return repository.Repositories.tags.indexOf('GPL') >= 0;
+ };
+
+ $scope.showRepo = function (repository) {
+ return $scope.isGPLAccepted || !$scope.isGPLRepo(repository);
+ };
$scope.loadStackVersionInfo = function () {
return Stack.getRepo($routeParams.versionId, $routeParams.stackName).then(function (response) {
@@ -67,6 +76,9 @@ angular.module('ambariAdminConsole')
// load supported os type base on stack version
$scope.afterStackVersionRead();
+ // Load GPL license accepted value
+ $scope.fetchGPLLicenseAccepted();
+
// if user reach here from UI click, repo status should be cached
// otherwise re-fetch repo status from cluster end point.
$scope.repoStatus = Cluster.repoStatusCache[$scope.id];
@@ -85,6 +97,15 @@ angular.module('ambariAdminConsole')
};
/**
+ * Load GPL License Accepted value
+ */
+ $scope.fetchGPLLicenseAccepted = function () {
+ Stack.getGPLLicenseAccepted().then(function (data) {
+ $scope.isGPLAccepted = data === 'true';
+ })
+ };
+
+ /**
* Load supported OS list
*/
$scope.afterStackVersionRead = function () {
@@ -170,7 +191,11 @@ angular.module('ambariAdminConsole')
$scope.updateRepoVersions = function () {
var skip = $scope.skipValidation || $scope.useRedhatSatellite;
- return Stack.validateBaseUrls(skip, $scope.osList, $scope.upgradeStack).then(function (invalidUrls) {
+ // Filter out repositories that are not shown in the UI
+ var osList = Object.assign([], $scope.osList).map(function(os) {
+ return Object.assign({}, os, {repositories: os.repositories.filter(function(repo) { return $scope.showRepo(repo); })});
+ });
+ return Stack.validateBaseUrls(skip, osList, $scope.upgradeStack).then(function (invalidUrls) {
if (invalidUrls.length === 0) {
Stack.updateRepo($scope.upgradeStack.stack_name, $scope.upgradeStack.stack_version, $scope.id, $scope.updateObj).then(function () {
Alert.success($t('versions.alerts.versionEdited', {
http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7223d/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
index 8003dd1..90f4f48 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
@@ -87,6 +87,20 @@ angular.module('ambariAdminConsole')
return deferred.promise;
},
+ getGPLLicenseAccepted: function() {
+ var deferred = $q.defer();
+
+ $http.get(Settings.baseUrl + '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/gpl.license.accepted&minimal_response=true', {mock: 'true'})
+ .then(function(data) {
+ deferred.resolve(data.data.RootServiceComponents.properties['gpl.license.accepted']);
+ })
+ .catch(function(data) {
+ deferred.reject(data);
+ });
+
+ return deferred.promise;
+ },
+
allPublicStackVersions: function() {
var self = this;
var url = '/version_definitions?fields=VersionDefinition/stack_default,VersionDefinition/type,' +
http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7223d/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
----------------------------------------------------------------------
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 ea30824..da1ab3f 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
@@ -181,20 +181,22 @@
<div class="col-sm-9">
<div class="form-group repo-name-url {{repository.Repositories.repo_name}}"
ng-class="{'has-error': repository.hasError }" ng-repeat="repository in os.repositories">
- <span class="repo-name-label control-label col-sm-3">{{repository.Repositories.repo_id}}</span>
- <div class="col-sm-7 repo-url">
- <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">
+ <div ng-if="showRepo(repository)">
+ <span class="repo-name-label control-label col-sm-3">{{repository.Repositories.repo_id}}</span>
+ <div class="col-sm-7 repo-url">
+ <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">
+ </div>
+ <i class="fa fa-undo orange-icon cursor-pointer"
+ ng-if="selectedOption.index == 1 && repository.Repositories.base_url != repository.Repositories.initial_base_url
+ || selectedOption.index == 2 && repository.Repositories.base_url != ''
+ || editController && repository.Repositories.base_url != repository.Repositories.initial_base_url"
+ ng-click="undoChange(repository)"
+ tooltip-html-unsafe="{{'common.undo' | translate}}"
+ aria-hidden="true"></i>
</div>
- <i class="fa fa-undo orange-icon cursor-pointer"
- ng-if="selectedOption.index == 1 && repository.Repositories.base_url != repository.Repositories.initial_base_url
- || selectedOption.index == 2 && repository.Repositories.base_url != ''
- || editController && repository.Repositories.base_url != repository.Repositories.initial_base_url"
- ng-click="undoChange(repository)"
- tooltip-html-unsafe="{{'common.undo' | translate}}"
- aria-hidden="true"></i>
</div>
</div>
<div class="col-sm-1 remove-icon" ng-click="removeOS()" ng-class="{'disabled' : useRedhatSatellite}"><i