ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [49/50] [abbrv] ambari git commit: AMBARI-15147. Patch Upgrade: integrate API to POST new repo version when registering new version.(xiwang)
Date Wed, 24 Feb 2016 15:08:36 GMT
AMBARI-15147. Patch Upgrade: integrate API to  POST new repo version when registering new version.(xiwang)


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

Branch: refs/heads/trunk
Commit: a5b673dd18b5849792aace38f8e377f57f45b610
Parents: e5d580f
Author: Xi Wang <xiwang@apache.org>
Authored: Thu Feb 18 11:27:10 2016 -0800
Committer: Xi Wang <xiwang@apache.org>
Committed: Tue Feb 23 16:05:23 2016 -0800

----------------------------------------------------------------------
 .../stackVersions/StackVersionsCreateCtrl.js    | 175 +++++++++++++------
 .../ui/admin-web/app/scripts/i18n.config.js     |   1 +
 .../ui/admin-web/app/scripts/services/Stack.js  | 167 +++---------------
 .../views/stackVersions/stackVersionPage.html   |   8 +-
 .../app/mappers/repository_version_mapper.js    | 152 ++++++++++------
 ambari-web/app/styles/stack_versions.less       |  10 +-
 .../admin/stack_upgrade/upgrade_version_box.hbs |  10 +-
 .../stack_upgrade/upgrade_version_box_view.js   |   3 +
 .../upgrade_version_column_view.js              |   3 +
 9 files changed, 275 insertions(+), 254 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/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 190670a..cf0ca2a 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
@@ -36,7 +36,7 @@ angular.module('ambariAdminConsole')
   $scope.option1 = {
     index: 1,
     displayName: 'Upload Version Definition File',
-    url: 'files://',
+    file: null,
     hasError: false
   };
   $scope.option2 = {
@@ -45,7 +45,9 @@ angular.module('ambariAdminConsole')
     url: 'https://',
     hasError: false
   };
-  $scope.selectedOption = 1;
+  $scope.selectedOption = {
+    index: 1
+  };
 
   /**
    * User can select ONLY one option to upload version definition file
@@ -59,64 +61,78 @@ angular.module('ambariAdminConsole')
     $scope.option2.hasError = false;
   };
   $scope.readInfoButtonDisabled = function () {
-    return $scope.option1.selected ? !$scope.option1.url : !$scope.option2.url;
+    return $scope.option1.index == $scope.selectedOption.index ? !$scope.option1.file : !$scope.option2.url;
   };
 
-  $scope.onFileSelect = function(){
-    return {
-      link: function($scope,el){
-        el.bind("change", function(e){
-          $scope.file = (e.srcElement || e.target).files[0];
-          $scope.getFile();
-        })
-      }
+  $scope.onFileSelect = function(e){
+    if (e.files && e.files.length == 1) {
+      var file = e.files[0];
+      var reader = new FileReader();
+      reader.onload = (function () {
+        return function (e) {
+          $scope.option1.file = e.target.result;
+        };
+      })(file);
+      reader.readAsText(file);
     }
   };
 
-//  $scope.uploadFile = function(){
-//    var file = $scope.myFile;
-//    console.log('file is ' );
-//    console.dir(file);
-//    var uploadUrl = "/fileUpload";
-//    fileUpload.uploadFileToUrl(file, uploadUrl);
-//  };
-
   /**
    * Load selected file to current page content
    */
   $scope.readVersionInfo = function(){
-    if ($scope.option2.selected) {
+    var data = {};
+    var isXMLdata = false;
+    if ($scope.option2.index == $scope.selectedOption.index) {
       var url = $scope.option2.url;
-    }
-    /// POST url first then get the version definition info
-    return Stack.getLatestRepo('HDP').then(function (response) {
-      $scope.id = response.id;
-      $scope.isPatch = response.type == 'PATCH';
-      $scope.stackNameVersion = response.stackNameVersion || 'n/a';
-      $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
+      data = {
+        "VersionDefinition": {
+          "version_url": url
+        }
       };
-      $scope.services = response.services || [];
-      //save default values of repos to check if they were changed
-      $scope.defaulfOSRepos = {};
-      response.updateObj.operating_systems.forEach(function(os) {
-        $scope.defaulfOSRepos[os.OperatingSystems.os_type] = {
-          defaultBaseUrl: os.repositories[0].Repositories.base_url,
-          defaultUtilsUrl: os.repositories[1].Repositories.base_url
-        };
-      });
-      $scope.repoVersionFullName = response.repoVersionFullName;
-      angular.forEach(response.osList, function (os) {
-        os.selected = true;
-      });
-      $scope.osList = response.osList;
-      // load supported os type base on stack version
-      $scope.afterStackVersionRead();
+    } else if ($scope.option1.index == $scope.selectedOption.index) {
+      isXMLdata = true;
+      // load from file browser
+      data = $scope.option1.file;
+    }
+
+    return Stack.postVersionDefinitionFile(isXMLdata, data).then(function (versionInfo) {
+      if (versionInfo.id && versionInfo.stackName && versionInfo.stackVersion)
{
+        Stack.getRepo(versionInfo.id, versionInfo.stackName, versionInfo.stackVersion)
+          .then(function (response) {
+            $scope.id = response.id;
+            $scope.isPatch = response.type == 'PATCH';
+            $scope.stackNameVersion = response.stackNameVersion || 'n/a';
+            $scope.displayName = response.displayName || 'n/a';
+            $scope.version = response.version || 'n/a';
+            $scope.actualVersion = response.actualVersion || 'n/a';
+            $scope.updateObj = response.updateObj;
+            $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 = {};
+            response.updateObj.operating_systems.forEach(function(os) {
+              $scope.defaulfOSRepos[os.OperatingSystems.os_type] = {
+                defaultBaseUrl: os.repositories[0].Repositories.base_url,
+                defaultUtilsUrl: os.repositories[1].Repositories.base_url
+              };
+            });
+            $scope.repoVersionFullName = response.repoVersionFullName;
+            angular.forEach(response.osList, function (os) {
+              os.selected = true;
+            });
+            $scope.osList = response.osList;
+            // load supported os type base on stack version
+            $scope.afterStackVersionRead();
+        });
+      }
+    })
+    .catch(function (data) {
+      Alert.error($t('versions.alerts.readVersionInfoError'), data.message);
     });
   };
 
@@ -180,18 +196,41 @@ angular.module('ambariAdminConsole')
     return !enabled;
   }
 
+  $scope.defaulfOSRepos = {};
+
   $scope.save = function () {
+    $scope.editVersionDisabled = true;
+    delete $scope.updateObj.href;
+    $scope.updateObj.operating_systems = [];
+    var updateRepoUrl = false;
+    angular.forEach($scope.osList, function (os) {
+      var savedUrls = $scope.defaulfOSRepos[os.OperatingSystems.os_type];
+      if (os.selected) {
+        var currentRepos = os.repositories;
+        if (!savedUrls || currentRepos[0].Repositories.base_url != savedUrls.defaultBaseUrl
+          || currentRepos[1].Repositories.base_url != savedUrls.defaultUtilsUrl) {
+          updateRepoUrl = true;
+        }
+        $scope.updateObj.operating_systems.push(os);
+      } else if (savedUrls) {
+        updateRepoUrl = true;
+      }
+    });
+    $scope.updateRepoVersions();
+  };
+
+  $scope.updateRepoVersions = 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.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);
+        Stack.updateRepo($scope.upgradeStack.stack_name, $scope.upgradeStack.stack_version,
$scope.id, $scope.updateObj).then(function () {
+          Alert.success($t('versions.alerts.versionEdited', {
+            stackName: $scope.upgradeStack.stack_name,
+            versionName: $scope.actualVersion,
+            displayName: $scope.repoVersionFullName
+          }));
+          $location.path('/stackVersions');
+        }).catch(function (data) {
+            Alert.error($t('versions.alerts.versionUpdateError'), data.message);
           });
       } else {
         Stack.highlightInvalidUrls(invalidUrls);
@@ -199,6 +238,26 @@ angular.module('ambariAdminConsole')
     });
   };
 
+//
+//  $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.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);
+//      }
+//    });
+//  };
+
   $scope.cancel = function () {
     $scope.editVersionDisabled = true;
     $location.path('/stackVersions');

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/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 0dc10c1..ce0ff41 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
@@ -342,6 +342,7 @@ angular.module('ambariAdminConsole')
         'versionCreated': 'Created version <a href="#/stackVersions/{{stackName}}/{{versionName}}/edit">{{stackName}}-{{versionName}}</a>',
         'versionCreationError': 'Version creation error',
         'osListError': 'getSupportedOSList error',
+        'readVersionInfoError': 'Version Definition read error',
         'versionEdited': 'Edited version <a href="#/stackVersions/{{stackName}}/{{versionName}}/edit">{{displayName}}</a>',
         'versionUpdateError': 'Version update error',
         'versionDeleteError': 'Version delete error'

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/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 ae67c7e..4ba0fc1 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
@@ -145,11 +145,21 @@ angular.module('ambariAdminConsole')
       return $http.post(Settings.baseUrl + url, payloadWrap);
     },
 
-    getRepo: function (repoVersion, stack_name) {
-      var url = Settings.baseUrl + '/stacks/' + stack_name + '/versions?' +
-      'fields=repository_versions/operating_systems/repositories/*' +
-      ',repository_versions/RepositoryVersions/display_name' +
-      '&repository_versions/RepositoryVersions/repository_version=' + repoVersion;
+    getRepo: function (repoVersion, stack_name, stack_version) {
+      if (stack_version) {
+        // get repo by stack version(2.3) and id (112)
+        var url = Settings.baseUrl + '/stacks/' + stack_name + '/versions?' +
+          'fields=repository_versions/operating_systems/repositories/*' +
+          ',repository_versions/RepositoryVersions/*' +
+          '&repository_versions/RepositoryVersions/id=' + repoVersion +
+          '&Versions/stack_version=' + stack_version;
+      } else {
+        // get repo by repoVersion (2.3.6.0-2345)
+        var url = Settings.baseUrl + '/stacks/' + stack_name + '/versions?' +
+          'fields=repository_versions/operating_systems/repositories/*' +
+          ',repository_versions/RepositoryVersions/*' +
+          '&repository_versions/RepositoryVersions/repository_version=' + repoVersion;
+      }
       var deferred = $q.defer();
       $http.get(url, {mock: 'version/version.json'})
       .success(function (data) {
@@ -186,140 +196,21 @@ angular.module('ambariAdminConsole')
       return deferred.promise;
     },
 
-    getLatestRepo: function (stack_name) {
-      var url = Settings.baseUrl + '/stacks/' + stack_name + '/versions?' +
-        'fields=repository_versions/operating_systems/repositories/*' +
-        ',repository_versions/RepositoryVersions/*';  // tbd
-      var deferred = $q.defer();
-      $http.get(url, {mock: 'version/version.json'})
-        .success(function (data) {
-          //data = data.items[0];
-          data = {
-            "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3",
-            "Versions" : {
-              "stack_name" : "HDP",
-              "stack_version" : "2.3"
-            },
-            "repository_versions" : [
-              {
-                "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/15",
-                "RepositoryVersions" : {
-                  "id" : 15,
-                  "repository_version" : "2.3.6.0-3509",
-                  "stack_name" : "HDP",
-                  "stack_version" : "2.3",
-                  "type": "PATCH",
-                  "release": {
-                    "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": [
-                    {
-                      "name": "HDFS",
-                      "display_name": "HDFS",
-                      "versions": [
-                        {
-                          "version": "2.1.1",
-                          "version_id": "10",
-                          "components": [ "NAMENODE"]
-                        }
-                      ]
-                    },
-                    {
-                      "name": "HIVE",
-                      "display_name": "Hive",
-                      "versions": [
-                        {
-                          "version": "1.2.1"
-                        }
-                      ]
-                    },
-                    {
-                      "name": "ZOOKEEPER",
-                      "display_name": "ZooKeeper",
-                      "versions": [
-                        {
-                          "version": "3.4.5"
-                        }
-                      ]
-                    }
-                  ]
-                },
-                "operating_systems" : [
-                  {
-                    "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.3"
-                    },
-                    "repositories" : [
-                      {
-                        "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/centos6/2.x/BUILDS/2.3.6.0-3509",
-                          "default_base_url" : "",
-                          "latest_base_url" : "",
-                          "mirrors_list" : "",
-                          "os_type" : "redhat6",
-                          "repo_id" : "HDP-2.3.6.0-3509",
-                          "repo_name" : "HDP",
-                          "repository_version_id" : 15,
-                          "stack_name" : "HDP",
-                          "stack_version" : "2.3"
-                        }
-                      },
-                      {
-                        "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-UTILS-1.1.0.20/repos/centos6",
-                          "default_base_url" : "",
-                          "latest_base_url" : "",
-                          "mirrors_list" : "",
-                          "os_type" : "redhat6",
-                          "repo_id" : "HDP-UTILS-2.3.6.0-3509",
-                          "repo_name" : "HDP-UTILS",
-                          "repository_version_id" : 15,
-                          "stack_name" : "HDP",
-                          "stack_version" : "2.3"
-                        }
-                      }
-                    ]
-                  }
-                ]
-              }
-            ]
-          };
+    postVersionDefinitionFile: function (isXMLdata, data) {
+      var deferred = $q.defer(),
+        url = Settings.baseUrl + '/version_definitions',
+        configs = isXMLdata? { headers: {'Content-Type': 'text/xml'}} : null;
 
-          var response = {
-            id : data.repository_versions[0].RepositoryVersions.id,
-            stackVersion : data.Versions.stack_version,
-            stackName: data.Versions.stack_name,
-            type: data.repository_versions[0].RepositoryVersions.type,
-            stackNameVersion: data.Versions.stack_name + '-' + data.Versions.stack_version,
/// HDP-2.3
-            actualVersion: data.repository_versions[0].RepositoryVersions.repository_version,
/// 2.3.4.0-3846
-            version: data.repository_versions[0].RepositoryVersions.release ? data.repository_versions[0].RepositoryVersions.release.version:
null, /// 2.3.4.0
-            releaseNotes: data.repository_versions[0].RepositoryVersions.release ? data.repository_versions[0].RepositoryVersions.release.release_notes:
null,
-            displayName: data.repository_versions[0].RepositoryVersions.release ? data.Versions.stack_name
+ '-' + data.repository_versions[0].RepositoryVersions.release.version :
-              data.Versions.stack_name + '-' + data.repository_versions[0].RepositoryVersions.repository_version.split('-')[0],
//HDP-2.3.4.0
-            repoVersionFullName : data.Versions.stack_name + '-' + data.repository_versions[0].RepositoryVersions.repository_version,
-            osList: data.repository_versions[0].operating_systems,
-            updateObj: data.repository_versions[0]
-          };
-          var services = [];
-          angular.forEach(data.repository_versions[0].RepositoryVersions.services, function
(service) {
-            services.push({
-              name: service.display_name,
-              version: service.versions[0].version,
-              components: service.versions[0].components
-            });
-          });
-          response.services = services;
-          deferred.resolve(response);
+      $http.post(url, data, configs)
+        .success(function (response) {
+          if (response.resources.length && response.resources[0].VersionDefinition)
{
+            deferred.resolve(
+              {
+                stackName: response.resources[0].VersionDefinition.stack_name,
+                id: response.resources[0].VersionDefinition.id,
+                stackVersion: response.resources[0].VersionDefinition.stack_version
+              });
+          }
         })
         .error(function (data) {
           deferred.reject(data);

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/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 112ded8..b8d51b5 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
@@ -36,22 +36,22 @@
   <div class="clearfix register-version-options">
     <div class="col-sm-5 option-radio-button">
       <label class="option-label">
-        <input type="radio" ng-model="selectedOption" value="{{option1.index}}" ng-change="toggleOptionSelect()">
{{'versions.uploadFile' | translate}}
+        <input type="radio" ng-model="selectedOption.index" value="1" ng-change="toggleOptionSelect()">
{{'versions.uploadFile' | translate}}
       </label>
     </div>
     <div class="col-sm-7">
-      <input type="file" class="choose-file-input" ng-file-select="onFileSelect($files)"/>
+      <input type="file" class="choose-file-input" onchange="angular.element(this).scope().onFileSelect(this)"/>
     </div>
   </div>
   <div class="clearfix register-version-options border-bottom bottom-margin">
     <div class="col-sm-5 option-radio-button">
       <label class="option-label">
-        <input type="radio" ng-model="selectedOption" value="{{option2.index}}" ng-change="toggleOptionSelect()">
{{'versions.enterURL' | translate}}
+        <input type="radio" ng-model="selectedOption.index" value="2" ng-change="toggleOptionSelect()">
{{'versions.enterURL' | translate}}
       </label>
     </div>
     <div class="col-sm-7">
       <div class="form-group {{option2.name}}" ng-class="{'has-error': option2.url.hasError
}">
-        <div class=""><input type="text" class="form-control" ng-model="option2.url"
ng-change="clearOptionsError()" ng-disabled="!(selectedOption==2)"></div>
+        <div class=""><input type="text" class="form-control" ng-model="option2.url"
ng-change="clearOptionsError()" ng-disabled="!(selectedOption.index==2)"></div>
       </div>
     </div>
     <div class="col-sm-12 read-info-button">

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js b/ambari-web/app/mappers/repository_version_mapper.js
index c937678..be85cd2 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -97,7 +97,6 @@ App.repoVersionMapper = App.QuickDataMapper.create({
     if (json && json.items) {
       json.items.forEach(function (item) {
         ////////////// to test//////////////
-        item[repoVersionsKey].type = "PATCH";
         item[repoVersionsKey].release = {
           "stack_id": "HDP-2.2",
           "version": "2.2.4.1",
@@ -105,55 +104,108 @@ App.repoVersionMapper = App.QuickDataMapper.create({
           "compatible_with": "", /* regex */
           "release_notes": "http://someurl"
         };
-        item[repoVersionsKey].services = [
-          {
-            "name": "HDFS",
-            "display_name": "HDFS",
-            "versions": [
-              {
-                "version": "2.1.1",
-                "version_id": "10",
-                "components": [ "NAMENODE"]
-              }
-            ]
-          },
-          {
-            "name": "YARN",
-            "display_name": "YARN",
-            "versions": [
-              {
-                "version": "2.7.1.2.3"
-              }
-            ]
-          },
-          {
-            "name": "ZOOKEEPER",
-            "display_name": "ZooKeeper",
-            "versions": [
-              {
-                "version": "3.4.6.2.3"
-              }
-            ]
-          },
-          {
-            "name": "wrong",
-            "display_name": "MapReduce2",
-            "versions": [
-              {
-                "version": "2.7.1.2.3"
-              }
-            ]
-          },
-          {
-            "name": "AMBARI_METRICS",
-            "display_name": "Ambari Metrics",
-            "versions": [
-              {
-                "version": "0.1.0"
-              }
-            ]
-          }
-        ];
+        if (item[repoVersionsKey].id  % 2 ) {
+          item[repoVersionsKey].type = "PATCH";
+          item[repoVersionsKey].services = [
+            {
+              "name": "HDFS",
+              "display_name": "HDFS",
+              "versions": [
+                {
+                  "version": "2.1.1",
+                  "version_id": "10",
+                  "components": [ "NAMENODE"]
+                }
+              ]
+            },
+            {
+              "name": "YARN",
+              "display_name": "YARN",
+              "versions": [
+                {
+                  "version": "2.7.1.2.3"
+                }
+              ]
+            },
+            {
+              "name": "ZOOKEEPER",
+              "display_name": "ZooKeeper",
+              "versions": [
+                {
+                  "version": "3.4.6.2.3"
+                }
+              ]
+            },
+            {
+              "name": "wrong",
+              "display_name": "MapReduce2",
+              "versions": [
+                {
+                  "version": "2.7.1.2.3"
+                }
+              ]
+            },
+            {
+              "name": "AMBARI_METRICS",
+              "display_name": "Ambari Metrics",
+              "versions": [
+                {
+                  "version": "0.1.0"
+                }
+              ]
+            }
+          ];
+        } else {
+          item[repoVersionsKey].services = [
+            {
+              "name": "HDFS",
+              "display_name": "HDFS",
+              "versions": [
+                {
+                  "version": "2.1.1",
+                  "version_id": "10",
+                  "components": [ "NAMENODE"]
+                }
+              ]
+            },
+            {
+              "name": "wrong",
+              "display_name": "YARN",
+              "versions": [
+                {
+                  "version": "2.7.1.2.3"
+                }
+              ]
+            },
+            {
+              "name": "wrong",
+              "display_name": "ZooKeeper",
+              "versions": [
+                {
+                  "version": "3.4.6.2.3"
+                }
+              ]
+            },
+            {
+              "name": "MAPREDUCE2",
+              "display_name": "MapReduce2",
+              "versions": [
+                {
+                  "version": "2.7.1.2.3"
+                }
+              ]
+            },
+            {
+              "name": "AMBARI_METRICS",
+              "display_name": "Ambari Metrics",
+              "versions": [
+                {
+                  "version": "0.1.0"
+                }
+              ]
+            }
+          ];
+        }
         //////////////////////////////
 
         if (loadAll || (item[repoVersionsKey] && !App.StackVersion.find().someProperty('repositoryVersion.id',
item[repoVersionsKey].id))) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/ambari-web/app/styles/stack_versions.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/stack_versions.less b/ambari-web/app/styles/stack_versions.less
index 5490592..25f474e 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -172,7 +172,7 @@
     position: relative;
     background: none repeat scroll 0 0 #fff;
     border: 1px solid #d2d9dd;
-    height: 168px;
+    height: 190px;
     margin: 15px 15px 0 0;
     padding: 5px 0;
     a.not-active:hover {
@@ -245,6 +245,14 @@
       margin: 0 0px -18px 1px;
       padding: 1px;
     }
+    .patch-icon {
+      text-align: center;
+      color: #ff4500;
+      height: 20px;
+      font-size: 14px;
+      margin: 18px 0px -18px 1px;
+      padding: 1px;
+    }
     .hosts-section {
       margin-top: 16px;
       width: 100%;

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
index 84d7835..dcc6944 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_box.hbs
@@ -27,9 +27,13 @@
   </a>
 </p>
 <p class="repository-name">({{view.content.repositoryVersion}})</p>
-{{#if view.isPatch}}
-  <p class="patch-icon"></p>
-{{/if}}
+
+<p class="patch-icon">
+  {{#if view.isPatch}}
+    <i class="icon-umbrella"></i>&nbsp;{{t common.patch}}
+  {{/if}}
+</p>
+
 
 <div {{bindAttr class="view.stateElement.isInstalling:installing :align-center :state"}}>
   {{#if view.stateElement.isButton}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 1ea0c66..e0c0ae2 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -397,6 +397,9 @@ App.UpgradeVersionBoxView = Em.View.extend({
         secondary: Em.I18n.t('common.close'),
         onPrimary: function () {
           this.hide();
+          if ($('.version-box-popup .modal')) {
+            $('.version-box-popup .modal .modal-footer .btn-success').click();
+          }
           self.filterHostsByStack(displayName, status.id);
         }
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b673dd/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
index d7e26e2..346c10c 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
@@ -86,6 +86,9 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
     }
   },
 
+  /**
+   * on click handler for "show details" link
+   */
   openVersionBoxPopup: function (event) {
     var content = this.get('content');
     var parentView = this.get('parentView');


Mime
View raw message