Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-22457 ba957a869 -> 059fadf46
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/059fadf4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/059fadf4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/059fadf4 Branch: refs/heads/branch-feature-AMBARI-22457 Commit: 059fadf460f2fc59ecb60403141c8b36a4c89668 Parents: ba957a8 Author: Vivek Ratnavel Subramanian <vivekratnave...@gmail.com> Authored: Wed Nov 22 16:59:13 2017 -0800 Committer: Vivek Ratnavel Subramanian <vivekratnave...@gmail.com> Committed: Wed Nov 22 16:59:13 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/059fadf4/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..b7fa741 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/059fadf4/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 d5f4401..46f4f42 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 url = '/version_definitions?fields=VersionDefinition/stack_default,VersionDefinition/type,' + 'operating_systems/repositories/Repositories/*,VersionDefinition/stack_services,' + http://git-wip-us.apache.org/repos/asf/ambari/blob/059fadf4/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 aeaaa71..447d755 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 @@ -182,20 +182,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