Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 2fc363070 -> 1cfc09cfe


AMBARI-16972 Strange behavior of Add Version functionality (zhewang)


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

Branch: refs/heads/branch-2.4
Commit: 1cfc09cfe289f87fea785069a0c84c9e4bb0d285
Parents: 2fc3630
Author: Zhe (Joe) Wang <[email protected]>
Authored: Wed Jun 1 13:01:51 2016 -0700
Committer: Zhe (Joe) Wang <[email protected]>
Committed: Wed Jun 1 13:03:06 2016 -0700

----------------------------------------------------------------------
 .../ui/admin-web/app/scripts/services/AddVersionModal.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1cfc09cf/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/AddVersionModal.js
----------------------------------------------------------------------
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/AddVersionModal.js
 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/AddVersionModal.js
index 0af7004..1bef0e6 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/AddVersionModal.js
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/AddVersionModal.js
@@ -140,10 +140,17 @@ angular.module('ambariAdminConsole')
                   parentScope.setStackIdActive(stack);
                 }
               });
+              parentScope.allVersions.push(response);
               angular.forEach(parentScope.allVersions, function(version) {
-                version.visible = (version.stackNameVersion === 
response.stackNameVersion);
+                var isPublicVersionsExist = false;
+                // If public VDF exists for a stack then default base stack 
version should be hidden
+                if (version.stackDefault) {
+                  isPublicVersionsExist = 
parentScope.allVersions.find(function(_version){
+                    return (version.stackNameVersion === 
_version.stackNameVersion && !_version.stackDefault);
+                  });
+                }
+                version.visible = (version.stackNameVersion === 
response.stackNameVersion) && !isPublicVersionsExist;
               });
-              parentScope.allVersions.push(response);
               parentScope.activeStackVersion = response;
               parentScope.selectedPublicRepoVersion = response;
               parentScope.setVersionSelected(response);

Reply via email to