AMBARI-21618 Admin View - Register Version should correctly display PATCH version. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/eb9cce7e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/eb9cce7e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/eb9cce7e Branch: refs/heads/feature-branch-AMBARI-21307 Commit: eb9cce7e01f3ed3ea910f32bec0a241e56c82c20 Parents: f59305e Author: Andrii Tkach <atk...@apache.org> Authored: Fri Aug 25 18:44:03 2017 +0300 Committer: Andrii Tkach <atk...@apache.org> Committed: Fri Aug 25 18:44:03 2017 +0300 ---------------------------------------------------------------------- .../stackVersions/StackVersionsCreateCtrl.js | 8 +++----- .../controllers/stackVersions/StackVersionsEditCtrl.js | 8 +++----- .../resources/ui/admin-web/app/scripts/i18n.config.js | 2 +- .../ui/admin-web/app/scripts/services/Stack.js | 13 +++++++++++++ .../ui/admin-web/app/views/stackVersions/list.html | 5 ++++- .../app/views/stackVersions/stackVersionPage.html | 7 +++++-- 6 files changed, 29 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/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 9d17075..b26ce28 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 @@ -451,8 +451,9 @@ angular.module('ambariAdminConsole') $scope.setVersionSelected = function (version) { var response = version; + var stackVersion = response.updateObj.RepositoryVersions || response.updateObj.VersionDefinition; $scope.id = response.id; - $scope.isPatch = response.type == 'PATCH'; + $scope.isPatch = stackVersion.type === 'PATCH'; $scope.stackNameVersion = response.stackNameVersion || $t('common.NA'); $scope.displayName = response.displayName || $t('common.NA'); $scope.actualVersion = response.repositoryVersion || response.actualVersion || $t('common.NA'); @@ -463,10 +464,7 @@ angular.module('ambariAdminConsole') stack_version: response.stackVersion, display_name: response.displayName || $t('common.NA') }; - $scope.services = response.services.filter(function (service) { - var skipServices = ['MAPREDUCE2', 'GANGLIA', 'KERBEROS']; - return skipServices.indexOf(service.name) === -1; - }) || []; + $scope.activeStackVersion.services = Stack.filterAvailableServices(response); $scope.repoVersionFullName = response.repoVersionFullName; $scope.osList = response.osList; http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/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 a84a97c..9c870aa 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 @@ -36,9 +36,10 @@ angular.module('ambariAdminConsole') $scope.loadStackVersionInfo = function () { return Stack.getRepo($routeParams.versionId, $routeParams.stackName).then(function (response) { + var stackVersion = response.updateObj.RepositoryVersions || response.updateObj.VersionDefinition; $scope.activeStackVersion = response; $scope.id = response.id; - $scope.isPatch = response.type == 'PATCH'; + $scope.isPatch = stackVersion.type === 'PATCH'; $scope.stackNameVersion = response.stackNameVersion || $t('common.NA'); $scope.displayName = response.displayName || $t('common.NA'); $scope.version = response.version || $t('common.NA'); @@ -50,10 +51,7 @@ angular.module('ambariAdminConsole') stack_version: response.stackVersion, display_name: response.displayName }; - $scope.services = response.services.filter(function (service) { - var skipServices = ['MAPREDUCE2', 'GANGLIA', 'KERBEROS']; - return skipServices.indexOf(service.name) === -1; - }) || []; + $scope.activeStackVersion.services = Stack.filterAvailableServices(response); response.updateObj.operating_systems.forEach(function(os) { $scope.defaulfOSRepos[os.OperatingSystems.os_type] = {}; os.repositories.forEach(function(repo) { http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/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 dd930fa..239b149 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 @@ -343,7 +343,7 @@ angular.module('ambariAdminConsole') 'users.alerts.usersEffectivePrivilege': '{{user_name}}\'s effective privilege through its Group(s) is higher than your selected privilege.', 'versions.current': 'Current', - 'versions.addVersion': 'Add Version', + 'versions.addVersion': 'Add Version or Hotfix', 'versions.defaultVersion': '(Default Version Definition)', 'versions.inUse': 'In Use', 'versions.installed': 'Installed', http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/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 a203b5c..dc1e2f1 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 @@ -205,6 +205,7 @@ angular.module('ambariAdminConsole') }); }); repos = repos.map(function (stack) { + stack.RepositoryVersions.isPatch = stack.RepositoryVersions.type === 'PATCH'; return stack.RepositoryVersions; }); // prepare response data with client side pagination @@ -438,6 +439,18 @@ angular.module('ambariAdminConsole') return 0 } return lId1 > lId2 ? 1 : -1; + }, + + filterAvailableServices: function (response) { + var stackVersion = response.updateObj.RepositoryVersions || response.updateObj.VersionDefinition; + var patchOrService = stackVersion.type === 'PATCH' || stackVersion.type === 'SERVICE'; + var availableServices = (patchOrService ? stackVersion.services : response.services).map(function (s) { + return s.name; + }); + return response.services.filter(function (service) { + var skipServices = ['MAPREDUCE2', 'GANGLIA', 'KERBEROS']; + return skipServices.indexOf(service.name) === -1 && availableServices.indexOf(service.name) !== -1; + }) || []; } }; http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html index 488933d..ccde1f3 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html @@ -67,7 +67,10 @@ <span>{{repo.stack_name}}-{{repo.stack_version}}</span> </td> <td class="col-medium"> - <a href="#/stackVersions/{{repo.stack_name}}/{{repo.repository_version}}/edit">{{repo.display_name}}</a> + <a href="#/stackVersions/{{repo.stack_name}}/{{repo.repository_version}}/edit"> + {{repo.display_name}} + <span ng-if="repo.isPatch" class="badge btn-warning">{{'versions.patch' | translate}}</span> + </a> </td> <td class="col-medium"> <span>{{repo.repository_version}}</span> http://git-wip-us.apache.org/repos/asf/ambari/blob/eb9cce7e/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 5122173..cb81d5c 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 @@ -19,8 +19,11 @@ <div class="clearfix"> <ol class="breadcrumb pull-left"> <li><a href="#/stackVersions">{{'common.versions' | translate}}</a></li> - <li class="active" ng-if="editController">{{displayName}} <span - class="sub-text">({{repoVersionFullName}})</span></li> + <li class="active" ng-if="editController"> + {{displayName}} + <span class="sub-text">({{repoVersionFullName}})</span> + <span ng-if="isPatch" class="badge btn-warning">{{'versions.patch' | translate}}</span> + </li> <li class="active" ng-if="createController">{{'versions.register.title' | translate}}</li> </ol>