瀏覽代碼

AMBARI-16928. Unable navigate to "Service Accounts" and "Kerberos" tab during upgrade (alexantonenko)

Alex Antonenko 9 年之前
父節點
當前提交
2d1b09e712

+ 4 - 1
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);
+      }
     }
 
   }),

+ 1 - 0
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;

+ 1 - 1
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>

+ 1 - 1
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>

+ 9 - 4
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', 'parentView.categories.@each.disabled')
   }),
 
   willDestroyElement: function () {

+ 9 - 5
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', 'parentView.dropdownCategories.@each.disabled'),
       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);
         }
       }