ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject [3/4] ambari git commit: AMBARI-14834. Register Version: make the 'Repositories' category editable and addable.(XIWANG)
Date Thu, 04 Feb 2016 21:56:53 GMT
AMBARI-14834. Register Version: make the 'Repositories' category editable and addable.(XIWANG)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: efc3a07da28857221e21592a6b62210b41dffdbb
Parents: 0b47564
Author: Xi Wang <xiwang@apache.org>
Authored: Wed Feb 3 16:07:04 2016 -0800
Committer: Xi Wang <xiwang@apache.org>
Committed: Wed Feb 3 16:07:04 2016 -0800

----------------------------------------------------------------------
 .../app/assets/data/version/version.json        |  83 ++----
 .../stackVersions/StackVersionsCreateCtrl.js    | 281 +++++++++----------
 .../ui/admin-web/app/scripts/i18n.config.js     |   2 +-
 .../ui/admin-web/app/scripts/services/Stack.js  | 110 ++------
 .../resources/ui/admin-web/app/styles/main.css  |   8 +
 .../views/stackVersions/stackVersionPage.html   |  40 ++-
 6 files changed, 218 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
index d6530e2..95c063a 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
@@ -1,26 +1,26 @@
 {
-  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions?fields=repository_versions/operatingSystems/repositories/*&repository_versions/RepositoryVersions/repository_version=2.2.0.1-901",
+  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions?fields=repository_versions/operatingSystems/repositories/*&repository_versions/RepositoryVersions/repository_version=2.3.6.0-3509",
   "items" : [
     {
-      "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2",
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3",
       "Versions" : {
         "stack_name" : "HDP",
-        "stack_version" : "2.2"
+        "stack_version" : "2.3"
       },
       "repository_versions" : [
         {
-          "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15",
+          "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15",
           "RepositoryVersions" : {
             "id" : 15,
-            "repository_version" : "2.2.0.1-901",
+            "repository_version" : "2.3.6.0-3509",
             "stack_name" : "HDP",
-            "stack_version" : "2.2",
+            "stack_version" : "2.3",
+            "type": "PATCH",
             "release": {
-              "type": "PATCH",
-              "stack_id": "HDP-2.2",
-              "version": "2.2.0.1",
-              "build": "901",
-              "compatible_with": "2.2.0.1-[1-9]",
+              "stack_id": "HDP-2.3",
+              "version": "2.3.6.0",
+              "build": "3509",
+              "compatible_with": "2.3.6.0-[1-9]",
               "release_notes": "http://someurl"
             },
             "services": [
@@ -57,83 +57,42 @@
           },
           "operating_systems" : [
             {
-              "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5",
-              "OperatingSystems" : {
-                "os_type" : "redhat5",
-                "repository_version_id" : 15,
-                "stack_name" : "HDP",
-                "stack_version" : "2.2"
-              },
-              "repositories" : [
-                {
-                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-2.2.0.1-901",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat5",
-                    "repo_id" : "HDP-2.2.0.1-901",
-                    "repo_name" : "HDP",
-                    "repository_version_id" : 15,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                },
-                {
-                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-UTILS-2.2.0.1-901",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat5",
-                    "repo_id" : "HDP-UTILS-2.2.0.1-901",
-                    "repo_name" : "HDP-UTILS",
-                    "repository_version_id" : 15,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                }
-              ]
-            },
-            {
-              "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6",
+              "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6",
               "OperatingSystems" : {
                 "os_type" : "redhat6",
                 "repository_version_id" : 15,
                 "stack_name" : "HDP",
-                "stack_version" : "2.2"
+                "stack_version" : "2.3"
               },
               "repositories" : [
                 {
-                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.2.0.1-901",
+                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.3.6.0-3509",
                   "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
+                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3509",
                     "default_base_url" : "",
                     "latest_base_url" : "",
                     "mirrors_list" : "",
                     "os_type" : "redhat6",
-                    "repo_id" : "HDP-2.2.0.1-901",
+                    "repo_id" : "HDP-2.3.6.0-3509",
                     "repo_name" : "HDP",
                     "repository_version_id" : 15,
                     "stack_name" : "HDP",
-                    "stack_version" : "2.2"
+                    "stack_version" : "2.3"
                   }
                 },
                 {
-                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.2.0.1-901",
+                  "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.3.6.0-3509",
                   "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
+                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6",
                     "default_base_url" : "",
                     "latest_base_url" : "",
                     "mirrors_list" : "",
                     "os_type" : "redhat6",
-                    "repo_id" : "HDP-UTILS-2.2.0.1-901",
+                    "repo_id" : "HDP-UTILS-2.3.6.0-3509",
                     "repo_name" : "HDP-UTILS",
                     "repository_version_id" : 15,
                     "stack_name" : "HDP",
-                    "stack_version" : "2.2"
+                    "stack_version" : "2.3"
                   }
                 }
               ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/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 81ad7f7..37f9c34 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
@@ -23,147 +23,26 @@ angular.module('ambariAdminConsole')
   $scope.createController = true;
   $scope.osList = [];
   $scope.skipValidation = false;
-  $scope.selectedOS = 0;
   $scope.repoSubversion = "";
 
   $scope.clusterName = $routeParams.clusterName;
   $scope.subversionPattern = /^\d+\.\d+(-\d+)?$/;
   $scope.upgradeStack = {
-    selected: null,
-    options: []
-  };
-  $scope.fetchStackVersionFilterList = function () {
-    return Stack.allStackVersions()
-    .then(function (allStackVersions) {
-      var versions = [];
-      angular.forEach(allStackVersions, function (version) {
-        if (version.upgrade_packs.length > 0 && version.active) {
-          versions.push(version);
-        }
-      });
-      $scope.upgradeStack.options = versions;
-      $scope.upgradeStack.selected = versions[versions.length - 1];
-      $scope.afterStackVersionChange();
-    })
-    .catch(function (data) {
-      Alert.error($t('versions.alerts.filterListError'), data.message);
-    });
-  };
-  $scope.fetchStackVersionFilterList();
-
-  $scope.save = function () {
-    return Stack.validateBaseUrls($scope.skipValidation, $scope.osList, $scope.upgradeStack.selected).then(function
(invalidUrls) {
-      if (invalidUrls.length === 0) {
-        Stack.addRepo($scope.upgradeStack.selected, $scope.repoSubversion, $scope.osList)
-          .success(function () {
-            var versionName = $scope.upgradeStack.selected.stack_version + '.' + $scope.repoSubversion;
-            var stackName = $scope.upgradeStack.selected.stack_name;
-            Alert.success($t('versions.alerts.versionCreated'), {stackName: stackName, versionName:
versionName});
-            $location.path('/stackVersions');
-          })
-          .error(function (data) {
-              Alert.error($t('versions.alerts.versionCreationError'), data.message);
-          });
-      } else {
-        Stack.highlightInvalidUrls(invalidUrls);
-      }
-    });
+    stack_name: '',
+    stack_version: '',
+    display_name: ''
   };
 
-  $scope.afterStackVersionChange = function () {
-    Stack.getSupportedOSList($scope.upgradeStack.selected.stack_name, $scope.upgradeStack.selected.stack_version)
-    .then(function (data) {
-      var operatingSystems = data.operating_systems;
-        $scope.osList = operatingSystems.map(function (os) {
-          os.selected = false;
-          os.repositories.forEach(function(repo) {
-            repo.Repositories.base_url = '';
-          });
-          return os;
-        });
-    })
-    .catch(function (data) {
-      Alert.error($t('versions.alerts.osListError'), data.message);
-    });
-  };
-
-  $scope.updateCurrentVersionInput = function () {
-    $scope.currentVersionInput = $scope.upgradeStack.selected.displayName + '.' + angular.element('[name="version"]')[0].value;
-  };
-
-  /**
-   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
-   * move this method to it
-   */
-  $scope.clearErrors = function() {
-    if ($scope.osList) {
-      $scope.osList.forEach(function(os) {
-        if (os.repositories) {
-          os.repositories.forEach(function(repo) {
-            repo.hasError = false;
-          })
-        }
-      });
-    }
-  };
-  /**
-   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
-   * move this method to it
-   */
-  $scope.clearError = function() {
-    this.repository.hasError = false;
-  };
-  /**
-   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
-   * move this method to it
-   */
-  $scope.toggleOSSelect = function () {
-    this.os.repositories.forEach(function(repo) {
-      repo.hasError = false;
-    });
-    this.os.selected ? $scope.selectedOS++ : $scope.selectedOS--;
-  };
-  /**
-   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
-   * move this method to it
-   */
-  $scope.hasValidationErrors = function() {
-    var hasErrors = false;
-    if ($scope.osList) {
-      $scope.osList.forEach(function(os) {
-        if (os.repositories) {
-          os.repositories.forEach(function(repo) {
-            if (repo.hasError) {
-              hasErrors = true;
-            }
-          })
-        }
-      });
-    }
-    return hasErrors;
-  };
-  /**
-   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
-   * move this method to it
-   */
-  $scope.cancel = function () {
-    $scope.editVersionDisabled = true;
-    $location.path('/stackVersions');
-  };
-
-  // two options to upload version definition file
   $scope.option1 = {
     index: 1,
     displayName: 'Upload Version Definition File',
     url: 'files://',
-    //selected: true,
     hasError: false
   };
   $scope.option2 = {
     index: 2,
     displayName: 'Version Definition File URL',
     url: 'https://',
-    //selected: false,
     hasError: false
   };
   $scope.selectedOption = 1;
@@ -172,8 +51,6 @@ angular.module('ambariAdminConsole')
    * User can select ONLY one option to upload version definition file
    */
   $scope.toggleOptionSelect = function () {
-    //$scope.option1.selected = $scope.selectedOption == $scope.option1.index;
-    //$scope.option2.selected = $scope.selectedOption == $scope.option2.index;
     $scope.option1.hasError = false;
     $scope.option2.hasError = false;
   };
@@ -219,6 +96,11 @@ angular.module('ambariAdminConsole')
       $scope.displayName = response.displayName || 'n/a';
       $scope.version = response.version || 'n/a';
       $scope.actualVersion = response.actualVersion || 'n/a';
+      $scope.upgradeStack = {
+        stack_name: response.stackName,
+        stack_version: response.stackVersion,
+        display_name: response.displayName
+      };
       $scope.services = response.services || [];
       //save default values of repos to check if they were changed
       $scope.defaulfOSRepos = {};
@@ -229,26 +111,141 @@ angular.module('ambariAdminConsole')
         };
       });
       $scope.repoVersionFullName = response.repoVersionFullName;
+      $scope.selectedOS = [];
       angular.forEach(response.osList, function (os) {
         os.selected = true;
+        $scope.selectedOS.push(os.OperatingSystems.os_type);
       });
-      $scope.selectedOS = response.osList.length;
       $scope.osList = response.osList;
-      // 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];
-//      if (!$scope.repoStatus) {
-//        $scope.fetchClusters()
-//          .then(function () {
-//            return $scope.fetchRepoClusterStatus();
-//          })
-//          .then(function () {
-//            $scope.deleteEnabled = $scope.isDeletable();
-//          });
-//      } else {
-//        $scope.deleteEnabled = $scope.isDeletable();
-//      }
-      //$scope.addMissingOSList();
+      // load supported os type base on stack version
+      $scope.afterStackVersionRead();
     });
   };
+
+  /**
+   * Load supported OS list
+   */
+  $scope.afterStackVersionRead = function () {
+    Stack.getSupportedOSList($scope.upgradeStack.stack_name, $scope.upgradeStack.stack_version)
+      .then(function (data) {
+        var operatingSystems = data.operating_systems;
+        operatingSystems.map(function (os) {
+          // os not in the list, mark as un-selected, add this to the osList
+          if ($scope.selectedOS.indexOf(os.OperatingSystems.os_type) < 0) {
+            os.selected = false;
+            os.repositories.forEach(function(repo) {
+              repo.Repositories.base_url = '';
+            });
+            $scope.osList.push(os);
+          }
+        });
+      })
+      .catch(function (data) {
+        Alert.error($t('versions.alerts.osListError'), data.message);
+      });
+  };
+
+  /**
+   * On click handler for removing OS
+   */
+  $scope.removeOS = function() {
+    this.os.selected = false;
+    if (this.os.repositories) {
+      this.os.repositories.forEach(function(repo) {
+        repo.hasError = false;
+      });
+    }
+  };
+  /**
+   * On click handler for adding new OS
+   */
+  $scope.addOS = function() {
+    this.os.selected = true;
+    if (this.os.repositories) {
+      this.os.repositories.forEach(function(repo) {
+        repo.hasError = false;
+      });
+    }
+  };
+
+  $scope.isSaveButtonDisabled = function() {
+    var enabled = false;
+    $scope.osList.forEach(function(os) {
+      if (os.selected) {
+        enabled = true
+      }
+    });
+    return !enabled;
+  }
+
+  $scope.save = function () {
+    return Stack.validateBaseUrls($scope.skipValidation, $scope.osList, $scope.upgradeStack).then(function
(invalidUrls) {
+      if (invalidUrls.length === 0) {
+        Stack.addRepo($scope.upgradeStack, $scope.actualVersion, $scope.osList)
+          .success(function () {
+            var versionName = $scope.actualVersion + '';
+            var stackName = $scope.upgradeStack.stack_name;
+            Alert.success($t('versions.alerts.versionCreated'), {stackName: stackName, versionName:
versionName});
+            $location.path('/stackVersions');
+          })
+          .error(function (data) {
+              Alert.error($t('versions.alerts.versionCreationError'), data.message);
+          });
+      } else {
+        Stack.highlightInvalidUrls(invalidUrls);
+      }
+    });
+  };
+  /**
+   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
+   * move this method to it
+   */
+  $scope.cancel = function () {
+    $scope.editVersionDisabled = true;
+    $location.path('/stackVersions');
+  };
+
+  /**
+   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
+   * move this method to it
+   */
+  $scope.clearErrors = function() {
+    if ($scope.osList) {
+      $scope.osList.forEach(function(os) {
+        if (os.repositories) {
+          os.repositories.forEach(function(repo) {
+            repo.hasError = false;
+          })
+        }
+      });
+    }
+  };
+
+  /**
+   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
+   * move this method to it
+   */
+  $scope.clearError = function() {
+    this.repository.hasError = false;
+  };
+
+  /**
+   * TODO create parent controller for StackVersionsEditCtrl and StackVersionsCreateCtrl
and
+   * move this method to it
+   */
+  $scope.hasValidationErrors = function() {
+    var hasErrors = false;
+    if ($scope.osList) {
+      $scope.osList.forEach(function(os) {
+        if (os.repositories) {
+          os.repositories.forEach(function(repo) {
+            if (repo.hasError) {
+              hasErrors = true;
+            }
+          })
+        }
+      });
+    }
+    return hasErrors;
+  };
 }]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index ed42b45..9f6add0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -323,7 +323,7 @@ angular.module('ambariAdminConsole')
       },
 
       'alerts': {
-        'baseURLs': 'Provide Base URLs for the Operating Systems you are configuring. Uncheck
all other Operating Systems.',
+        'baseURLs': 'Provide Base URLs for the Operating Systems you are configuring.',
         'validationFailed': 'Some of the repositories failed validation. Make changes to
the base url or skip validation if you are sure that urls are correct',
         'skipValidationWarning': '<b>Warning:</b> This is for advanced users
only. Use this option if you want to skip validation for Repository Base URLs.',
         'filterListError': 'Fetch stack version filter list error',

http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/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 aa81b5d..a12b430 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
@@ -116,11 +116,11 @@ angular.module('ambariAdminConsole')
       return deferred.promise;
     },
 
-    addRepo: function (stack, repoSubversion, osList) {
+    addRepo: function (stack, actualVersion, osList) {
       var url = '/stacks/' + stack.stack_name + '/versions/' + stack.stack_version + '/repository_versions/';
       var payload = {};
       var payloadWrap = { RepositoryVersions : payload };
-      payload.repository_version = stack.stack_version + '.' + repoSubversion;
+      payload.repository_version = actualVersion;
       payload.display_name = stack.stack_name + '-' + payload.repository_version;
       payloadWrap.operating_systems = [];
       osList.forEach(function (osItem) {
@@ -182,25 +182,25 @@ angular.module('ambariAdminConsole')
         .success(function (data) {
           //data = data.items[0];
           data = {
-            "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2",
+            "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3",
             "Versions" : {
               "stack_name" : "HDP",
-              "stack_version" : "2.2"
+              "stack_version" : "2.3"
             },
             "repository_versions" : [
               {
-                "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15",
+                "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15",
                 "RepositoryVersions" : {
                   "id" : 15,
-                  "repository_version" : "2.2.0.1-901",
+                  "repository_version" : "2.3.6.0-3509",
                   "stack_name" : "HDP",
-                  "stack_version" : "2.2",
+                  "stack_version" : "2.3",
+                  "type": "PATCH",
                   "release": {
-                    "type": "PATCH",
-                    "stack_id": "HDP-2.2",
-                    "version": "2.2.0.1",
-                    "build": "901",
-                    "compatible_with": "2.2.0.1-[1-9]",
+                    "stack_id": "HDP-2.3",
+                    "version": "2.3.6.0",
+                    "build": "3509",
+                    "compatible_with": "2.3.6.0-[1-9]",
                     "release_notes": "http://someurl"
                   },
                   "services": [
@@ -232,112 +232,47 @@ angular.module('ambariAdminConsole')
                           "version": "3.4.5"
                         }
                       ]
-                    },
-                    {
-                      "name": "YARN",
-                      "versions": [
-                        {
-                          "version": "2.7.1"
-                        }
-                      ]
-                    },
-                    {
-                      "name": "SPARK",
-                      "versions": [
-                        {
-                          "version": "1.4.1"
-                        }
-                      ]
-                    },
-                    {
-                      "name": "SPARK",
-                      "versions": [
-                        {
-                          "version": "1.5.2"
-                        }
-                      ]
                     }
                   ]
                 },
                 "operating_systems" : [
                   {
-                    "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5",
-                    "OperatingSystems" : {
-                      "os_type" : "redhat5",
-                      "repository_version_id" : 15,
-                      "stack_name" : "HDP",
-                      "stack_version" : "2.2"
-                    },
-                    "repositories" : [
-                      {
-                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-2.2.0.1-901",
-                        "Repositories" : {
-                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                          "default_base_url" : "",
-                          "latest_base_url" : "",
-                          "mirrors_list" : "",
-                          "os_type" : "redhat5",
-                          "repo_id" : "HDP-2.2.0.1-901",
-                          "repo_name" : "HDP",
-                          "repository_version_id" : 15,
-                          "stack_name" : "HDP",
-                          "stack_version" : "2.2"
-                        }
-                      },
-                      {
-                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-UTILS-2.2.0.1-901",
-                        "Repositories" : {
-                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                          "default_base_url" : "",
-                          "latest_base_url" : "",
-                          "mirrors_list" : "",
-                          "os_type" : "redhat5",
-                          "repo_id" : "HDP-UTILS-2.2.0.1-901",
-                          "repo_name" : "HDP-UTILS",
-                          "repository_version_id" : 15,
-                          "stack_name" : "HDP",
-                          "stack_version" : "2.2"
-                        }
-                      }
-                    ]
-                  },
-                  {
-                    "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6",
+                    "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6",
                     "OperatingSystems" : {
                       "os_type" : "redhat6",
                       "repository_version_id" : 15,
                       "stack_name" : "HDP",
-                      "stack_version" : "2.2"
+                      "stack_version" : "2.3"
                     },
                     "repositories" : [
                       {
-                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.2.0.1-901",
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.3.6.0-3509",
                         "Repositories" : {
-                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
+                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3509",
                           "default_base_url" : "",
                           "latest_base_url" : "",
                           "mirrors_list" : "",
                           "os_type" : "redhat6",
-                          "repo_id" : "HDP-2.2.0.1-901",
+                          "repo_id" : "HDP-2.3.6.0-3509",
                           "repo_name" : "HDP",
                           "repository_version_id" : 15,
                           "stack_name" : "HDP",
-                          "stack_version" : "2.2"
+                          "stack_version" : "2.3"
                         }
                       },
                       {
-                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.2.0.1-901",
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.3.6.0-3509",
                         "Repositories" : {
-                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
+                          "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6",
                           "default_base_url" : "",
                           "latest_base_url" : "",
                           "mirrors_list" : "",
                           "os_type" : "redhat6",
-                          "repo_id" : "HDP-UTILS-2.2.0.1-901",
+                          "repo_id" : "HDP-UTILS-2.3.6.0-3509",
                           "repo_name" : "HDP-UTILS",
                           "repository_version_id" : 15,
                           "stack_name" : "HDP",
-                          "stack_version" : "2.2"
+                          "stack_version" : "2.3"
                         }
                       }
                     ]
@@ -346,6 +281,7 @@ angular.module('ambariAdminConsole')
               }
             ]
           };
+
           var response = {
             id : data.repository_versions[0].RepositoryVersions.id,
             stackVersion : data.Versions.stack_version,

http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index 8385e48..83d4ffa 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1402,6 +1402,14 @@ thead.view-permission-header > tr > th {
   color: #ff4500;
 }
 
+.register-version-form .remove-icon {
+  color: red;
+  margin: 20px 0px;
+  padding: 0px;
+  text-align: center;
+  cursor: pointer;
+}
+
 .register-version-form .version-info {
   padding-top: 7px;
   margin-top: 0;

http://git-wip-us.apache.org/repos/asf/ambari/blob/efc3a07d/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 488f077..61d2d8d 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
@@ -69,7 +69,7 @@
       <div class="clearfix">
         <label class="control-label col-sm-3">{{'versions.details.stackName' | translate}}</label>
         <div class="version-info col-sm-7">{{stackNameVersion}}</div>
-        <div class="col-sm-2 patch-icon" ng-if="isPatch"><span class="glyphicon
glyphicon-tree-deciduous">Patch</span></div>
+        <div class="col-sm-2 patch-icon" ng-if="isPatch"><span class="glyphicon
glyphicon-tree-deciduous"></span>Patch</div>
       </div>
       <div class="clearfix">
         <label class="control-label col-sm-3">{{'versions.details.displayName' | translate}}</label>
@@ -109,22 +109,34 @@
         <div class="name-label-adjust col-sm-2"><h5><label>{{'common.name'
| translate}}</label></h5></div>
         <div class="col-sm-7"><h5><label >{{'versions.baseURL' | translate}}</label></h5></div>
       </div>
-      <div class="clearfix border-bottom bottom-margin" ng-repeat="os in osList">
-        <div class="col-sm-2 os-checkbox">
-          <div class="checkbox">
-            <label>
-              <input type="checkbox" ng-model="os.selected" ng-change="toggleOSSelect()">
{{os.OperatingSystems.os_type}}
-            </label>
-          </div>
-        </div>
-        <div class="col-sm-10">
-          <div class="form-group {{repository.Repositories.repo_name}}" ng-class="{'has-error':
repository.hasError }" ng-repeat="repository in os.repositories">
-            <div class="col-sm-3"><label class="control-label">{{repository.Repositories.repo_name}}</label></div>
-            <div class="col-sm-9"><input type="text" class="form-control" ng-model="repository.Repositories.base_url"
+      <div class="alert alert-info hide-soft" ng-class="{'visible' : !osList || !osList.length}"
role="alert">{{'versions.contents.empty' | translate}}</div>
+      <div class="" ng-repeat="os in osList">
+        <div ng-if="os.selected==true">
+          <div class="clearfix border-bottom bottom-margin">
+            <!-- show selected os in list table-->
+            <div class="col-sm-2">
+              <div class="">
+                <label>{{os.OperatingSystems.os_type}}</label>
+              </div>
+            </div>
+            <div class="col-sm-9">
+              <div class="form-group {{repository.Repositories.repo_name}}" ng-class="{'has-error':
repository.hasError }" ng-repeat="repository in os.repositories">
+                <div class="col-sm-3"><label class="control-label">{{repository.Repositories.repo_name}}</label></div>
+                <div class="col-sm-9"><input type="text" class="form-control" ng-model="repository.Repositories.base_url"
                                          ng-change="clearError()" ng-disabled="!os.selected"></div>
+              </div>
+            </div>
+            <div class="col-sm-1 remove-icon" ng-click="removeOS()"><span class="glyphicon
glyphicon-minus"></span>Remove</div>
           </div>
         </div>
       </div>
+        <div class="btn-group pull-right" dropdown>
+          <button class="btn dropdown-toggle">
+            <span class="glyphicon glyphicon-plus"></span> Add OS &nbsp;<span
class="caret"></span></button>
+          <ul class="dropdown-menu">
+            <li ng-repeat="os in osList"><a ng-if="os.selected==false" ng-click="addOS()">{{os.OperatingSystems.os_type}}</a></li>
+          </ul>
+        </div>
       <div class="clearfix">
         <div class="col-sm-12" id="skip-validation">
           <div class="checkbox">
@@ -139,7 +151,7 @@
   </div>
   <div class="col-sm-12">
     <button class="btn btn-primary pull-right left-margin" ng-click="save()"
-            ng-disabled="(createController && repoRegForm.version.$invalid) || selectedOS
=== 0">{{'common.controls.save' | translate}}</button>
+            ng-disabled="isSaveButtonDisabled()">{{'common.controls.save' | translate}}</button>
     <button class="btn btn-default pull-right" ng-click="cancel()">{{'common.controls.cancel'
| translate}}</button>
   </div>
 </form>


Mime
View raw message