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/b07dc779 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b07dc779 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b07dc779 Branch: refs/heads/branch-2.6 Commit: b07dc7796f6a6bc60719a900576cfe7055e77145 Parents: 2f873b0 Author: Andrii Tkach <atk...@cybervisiontech.com> Authored: Tue Aug 1 14:31:45 2017 +0300 Committer: Andrii Tkach <atk...@cybervisiontech.com> Committed: Tue Aug 1 14:31:45 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 | 9 ++++++--- ambari-web/app/styles/stack_versions.less | 2 +- 7 files changed, 31 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b07dc779/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 eed5372..7ee1429 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/b07dc779/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/b07dc779/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 f7f2d0c..e66499e 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 @@ -378,7 +378,7 @@ angular.module('ambariAdminConsole') 'versions': { 'current': 'Current', - 'addVersion': 'Add Version', + 'addVersion': 'Add Version or Hotfix', 'defaultVersion': '(Default Version Definition)', 'inUse': 'In Use', 'installed': 'Installed', http://git-wip-us.apache.org/repos/asf/ambari/blob/b07dc779/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 84d7b33..5068a19 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 @@ -174,6 +174,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 @@ -402,6 +403,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/b07dc779/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 5ac78ca..832faf1 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/b07dc779/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 b31e2c5..e4630168 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> @@ -236,4 +239,4 @@ <button class="btn btn-default pull-right" ng-click="cancel()">{{'common.controls.cancel' | translate}}</button> </div> </form> -</form> \ No newline at end of file +</form> http://git-wip-us.apache.org/repos/asf/ambari/blob/b07dc779/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 7cf09c8..4174dc0 100644 --- a/ambari-web/app/styles/stack_versions.less +++ b/ambari-web/app/styles/stack_versions.less @@ -157,7 +157,7 @@ } .left-menu-table { padding: 10px 0; - margin-top: 124px; + margin-top: 141px; td.service-display-name { border-top: 2px solid #e4e4e4; border-bottom: 2px solid #e4e4e4;