Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 4b428571f -> 2a731ac96


AMBARI-22570. Repository Fields missing when register version is clicked 
(vsubramanian)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2a731ac9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2a731ac9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2a731ac9

Branch: refs/heads/branch-2.6
Commit: 2a731ac968d3ce19fdd19b94b8340c6cc8f866ef
Parents: 4b42857
Author: Vivek Ratnavel Subramanian <[email protected]>
Authored: Thu Nov 30 16:31:16 2017 -0800
Committer: Vivek Ratnavel Subramanian <[email protected]>
Committed: Thu Nov 30 16:31:16 2017 -0800

----------------------------------------------------------------------
 .../stackVersions/StackVersionsCreateCtrl.js    | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a731ac9/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
----------------------------------------------------------------------
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 c5f1a8c..fed9790 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
@@ -40,6 +40,16 @@ angular.module('ambariAdminConsole')
     display_name: ''
   };
 
+  $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.publicOption = {
     index: 1,
     hasError: false
@@ -176,6 +186,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 () {
@@ -350,7 +369,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', {
@@ -477,6 +500,9 @@ angular.module('ambariAdminConsole')
 
     // load supported os type base on stack version
     $scope.afterStackVersionRead();
+
+    // Load GPL license accepted value
+    $scope.fetchGPLLicenseAccepted();
   };
 
   $scope.selectRepoInList = function() {

Reply via email to