Repository: ambari Updated Branches: refs/heads/branch-2.4 7fe8476af -> 2d1b09e71
AMBARI-16928. Unable navigate to "Service Accounts" and "Kerberos" tab during upgrade (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d1b09e7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d1b09e7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d1b09e7 Branch: refs/heads/branch-2.4 Commit: 2d1b09e712a53c4291d638d9e39909e6dfe51611 Parents: 7fe8476 Author: Alex Antonenko <[email protected]> Authored: Fri May 27 17:19:01 2016 +0300 Committer: Alex Antonenko <[email protected]> Committed: Fri May 27 19:06:02 2016 +0300 ---------------------------------------------------------------------- ambari-web/app/routes/main.js | 5 ++++- ambari-web/app/styles/application.less | 1 + ambari-web/app/templates/main/admin.hbs | 2 +- ambari-web/app/templates/main/menu.hbs | 2 +- ambari-web/app/views/main/admin.js | 13 +++++++++---- ambari-web/app/views/main/menu.js | 14 +++++++++----- 6 files changed, 25 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index fba3410..b172a0a 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -573,7 +573,10 @@ module.exports = Em.Route.extend(App.RouterRedirections, { //events goToAdmin: function (router, event) { - router.transitionTo(event.context); + var isDisabled = !!event.context.disabled; + if(!isDisabled){ + router.transitionTo(event.context.url); + } } }), http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 030ae4a..32c88fd 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -330,6 +330,7 @@ footer { } .top-nav-dropdown-menu > li.disabled > a { color: #a9a9a9; + cursor: default; } .top-nav-dropdown-menu > li.disabled > a:hover { color: #a9a9a9; http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/templates/main/admin.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin.hbs b/ambari-web/app/templates/main/admin.hbs index 454bf1e..3e456e9 100644 --- a/ambari-web/app/templates/main/admin.hbs +++ b/ambari-web/app/templates/main/admin.hbs @@ -21,7 +21,7 @@ <ul class="nav nav-list"> {{#each category in view.categories}} {{#view view.NavItemView itemBinding="category.name" elementIdBinding="category.name"}} - <a href="#" {{action "goToAdmin" category.url}} >{{category.label}}</a> + <a href="#" {{action "goToAdmin" category}} >{{category.label}}</a> {{/view}} {{/each}} </ul> http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/templates/main/menu.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/menu.hbs b/ambari-web/app/templates/main/menu.hbs index 141290e..0b943ec 100644 --- a/ambari-web/app/templates/main/menu.hbs +++ b/ambari-web/app/templates/main/menu.hbs @@ -18,6 +18,6 @@ <ul class="nav nav-tabs"> {{#each view.items}} - <li {{bindAttr class="active"}} ><a {{action navigate routing }} href="#">{{unbound label}}</a></li> + <li {{bindAttr class="active"}} ><a {{action navigate routing }} href="#">{{unbound label}}</a></li> {{/each}} </ul> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/views/main/admin.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js index 2b111b6..ebe97cf 100644 --- a/ambari-web/app/views/main/admin.js +++ b/ambari-web/app/views/main/admin.js @@ -34,14 +34,16 @@ App.MainAdminView = Em.View.extend({ items.push({ name: 'adminServiceAccounts', url: 'adminServiceAccounts', - label: Em.I18n.t('common.serviceAccounts') + label: Em.I18n.t('common.serviceAccounts'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') }); } if (!App.get('isHadoopWindowsStack') && App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || (App.get('upgradeInProgress') || App.get('upgradeHolding')) ) { items.push({ name: 'kerberos', url: 'adminKerberos.index', - label: Em.I18n.t('common.kerberos') + label: Em.I18n.t('common.kerberos'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') }); } if (App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) { @@ -58,8 +60,11 @@ App.MainAdminView = Em.View.extend({ NavItemView: Ember.View.extend({ tagName: 'li', - classNameBindings: 'isActive:active'.w(), - isActive: Em.computed.equalProperties('item', 'parentView.selected') + classNameBindings: 'isActive:active isDisabled:disabled'.w(), + isActive: Em.computed.equalProperties('item', 'parentView.selected'), + isDisabled: function () { + return !!this.get('parentView.categories').findProperty('name', this.get('item'))['disabled']; + }.property('item', '[email protected]') }), willDestroyElement: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1b09e7/ambari-web/app/views/main/menu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js index 8f6b14e..c6feafe 100644 --- a/ambari-web/app/views/main/menu.js +++ b/ambari-web/app/views/main/menu.js @@ -116,14 +116,16 @@ App.MainMenuView = Em.CollectionView.extend({ categories.push({ name: 'adminServiceAccounts', url: 'serviceAccounts', - label: Em.I18n.t('common.serviceAccounts') + label: Em.I18n.t('common.serviceAccounts'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') }); } if (!App.get('isHadoopWindowsStack') && App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) { categories.push({ name: 'kerberos', url: 'kerberos/', - label: Em.I18n.t('common.kerberos') + label: Em.I18n.t('common.kerberos'), + disabled: App.get('upgradeInProgress') || App.get('upgradeHolding') }); } if (App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) { @@ -141,14 +143,16 @@ App.MainMenuView = Em.CollectionView.extend({ AdminDropdownItemView: Ember.View.extend({ tagName: 'li', - classNameBindings: 'isActive:active'.w(), + classNameBindings: 'isActive:active isDisabled:disabled'.w(), isActive: Em.computed.equalProperties('item', 'parentView.selectedAdminItem'), - + isDisabled: function () { + return !!this.get('parentView.dropdownCategories').findProperty('name', this.get('item'))['disabled']; + }.property('item', '[email protected]'), goToCategory: function (event) { var itemName = this.get('parentView').get('content').routing; // route to correct category of current menu item // skip routing to already selected category - if (itemName === 'admin' && !this.get('isActive')) { + if (itemName === 'admin' && !this.get('isActive') && !this.get('isDisabled')) { App.router.route('main/admin/' + event.context); } }
