Przeglądaj źródła

AMBARI-6944. Remove HA category from 'Admin' tab. (Denys Buzhor via akovalenko)

Aleksandr Kovalenko 10 lat temu
rodzic
commit
85d181dd04

+ 2 - 2
ambari-web/app/controllers/main/admin/highAvailability_controller.js

@@ -56,7 +56,7 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
         return false;
       }
     }
-    App.router.transitionTo('main.admin.enableHighAvailability');
+    App.router.transitionTo('main.services.enableHighAvailability');
     return true;
   },
 
@@ -82,7 +82,7 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
       this.showErrorPopup(message);
       return false;
     }
-    App.router.transitionTo('main.admin.enableRMHighAvailability');
+    App.router.transitionTo('main.services.enableRMHighAvailability');
     return true;
   },
 

+ 5 - 2
ambari-web/app/router.js

@@ -306,10 +306,13 @@ App.Router = Em.Router.extend({
         route = 'main.reassign';
       } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('highAvailabilityWizardController.name')) {
         // if wizardControllerName == "highAvailabilityWizardController", then it means someone closed the browser or the browser was crashed when we were last in NameNode High Availability wizard
-        route = 'main.admin.enableHighAvailability';
+        route = 'main.services.enableHighAvailability';
+      } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('rMHighAvailabilityWizardController.name')) {
+        // if wizardControllerName == "highAvailabilityWizardController", then it means someone closed the browser or the browser was crashed when we were last in NameNode High Availability wizard
+        route = 'main.services.enableRMHighAvailability';
       } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName === App.router.get('rollbackHighAvailabilityWizardController.name')) {
         // if wizardControllerName == "highAvailabilityRollbackController", then it means someone closed the browser or the browser was crashed when we were last in NameNode High Availability Rollback wizard
-        route = 'main.admin.rollbackHighAvailability';
+        route = 'main.services.rollbackHighAvailability';
       }
       callback(route);
     });

+ 2 - 2
ambari-web/app/routes/high_availability_routes.js

@@ -72,7 +72,7 @@ module.exports = App.WizardRoute.extend({
               clusterName: controller.get('content.cluster.name'),
               clusterState: 'DEFAULT',
               localdb: App.db.data
-            },{alwaysCallback: function() {self.hide();App.router.transitionTo('main.index');location.reload();}});
+            },{alwaysCallback: function() {self.hide();App.router.transitionTo('main.services.index');location.reload();}});
           }
         },
         didInsertElement: function () {
@@ -306,7 +306,7 @@ module.exports = App.WizardRoute.extend({
         clusterName: controller.get('content.cluster.name'),
         clusterState: 'DEFAULT',
         localdb: App.db.data
-      },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.index');location.reload();}});
+      },{alwaysCallback: function() {controller.get('popup').hide();router.transitionTo('main.services.index');location.reload();}});
     }
   }),
 

+ 7 - 23
ambari-web/app/routes/main.js

@@ -366,28 +366,6 @@ module.exports = Em.Route.extend({
       }
     }),
 
-    adminHighAvailability: Em.Route.extend({
-      route: '/highAvailability',
-      enter: function (router) {
-        Em.run.next(function () {
-          router.transitionTo('adminHighAvailability.index');
-        });
-      },
-      index: Ember.Route.extend({
-        route: '/',
-        connectOutlets: function (router, context) {
-          router.set('mainAdminController.category', "highAvailability");
-          router.get('mainAdminController').connectOutlet('mainAdminHighAvailability');
-        }
-      })
-    }),
-
-    enableHighAvailability: require('routes/high_availability_routes'),
-
-    rollbackHighAvailability: require('routes/rollbackHA_routes'),
-
-    enableRMHighAvailability: require('routes/rm_high_availability_routes'),
-
     adminSecurity: Em.Route.extend({
       route: '/security',
       enter: function (router) {
@@ -660,7 +638,13 @@ module.exports = Em.Route.extend({
     }),
     showService: Em.Router.transitionTo('service'),
     addService: Em.Router.transitionTo('serviceAdd'),
-    reassign: Em.Router.transitionTo('reassign')
+    reassign: Em.Router.transitionTo('reassign'),
+
+    enableHighAvailability: require('routes/high_availability_routes'),
+
+    enableRMHighAvailability: require('routes/rm_high_availability_routes'),
+
+    rollbackHighAvailability: require('routes/rollbackHA_routes')
   }),
 
   reassign: require('routes/reassign_master_routes'),

+ 9 - 5
ambari-web/app/routes/rm_high_availability_routes.js

@@ -49,15 +49,17 @@ module.exports = App.WizardRoute.extend({
                 localdb: App.db.data
               }, {alwaysCallback: function () {
                 self.hide();
-                router.transitionTo('main.index');
-                location.reload();
+                router.route('/main/services/YARN/summary');
+                Em.run.next(function() {
+                  location.reload();
+                });
               }});
             }, Em.I18n.t('admin.rm_highAvailability.closePopup'));
           } else {
             this.hide();
             rMHighAvailabilityWizardController.setCurrentStep('1');
             router.get('updateController').set('isWorking', true);
-            router.transitionTo('main.index')
+            router.transitionTo('main.services.index');
           }
         },
         didInsertElement: function () {
@@ -175,8 +177,10 @@ module.exports = App.WizardRoute.extend({
         localdb: App.db.data
       }, {alwaysCallback: function () {
         controller.get('popup').hide();
-        router.transitionTo('main.index');
-        location.reload();
+        router.route('/main/services/YARN/summary');
+        Em.run.next(function() {
+          location.reload();
+        });
       }});
     }
   }),

+ 1 - 1
ambari-web/app/routes/rollbackHA_routes.js

@@ -47,7 +47,7 @@ module.exports = App.WizardRoute.extend({
           this.hide();
           App.router.get('rollbackHighAvailabilityWizardController').setCurrentStep('1');
           App.router.get('updateController').set('isWorking', true);
-          App.router.transitionTo('main.admin.adminHighAvailability');
+          App.router.transitionTo('main.services');
         },
         didInsertElement: function () {
           this.fitHeight();

+ 0 - 51
ambari-web/app/templates/main/admin/highAvailability.hbs

@@ -1,51 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-<div>
-  {{#if App.isHaEnabled}}
-    {{#if App.supports.autoRollbackHA}}
-      <p class="text-success">
-        {{t admin.highAvailability.enabled}}
-        <a class="btn btn-padding btn-success" {{action disableHighAvailability target="controller"}}>{{t admin.highAvailability.button.disable}}</a>
-      </p>
-    {{else}}
-       <p class="text-success">
-        {{t admin.highAvailability.enabled}}
-       </p>
-    {{/if}}
-  {{else}}
-    <p class="muted">
-      {{t admin.highAvailability.disabled}}
-    </p>
-    <a class="btn btn-padding btn-success ha-btn" {{action enableHighAvailability target="controller"}}>{{t admin.highAvailability.button.enable}}</a>
-  {{/if}}
-  {{#if view.supportRMHA}}
-    <div class="rm-ha">
-    {{#if App.isRMHaEnabled}}
-        <p class="text-success">
-          {{t admin.rm_highAvailability.enabled}}
-        </p>
-    {{else}}
-        <p class="muted">
-          {{t admin.rm_highAvailability.disabled}}
-        </p>
-        <a class="btn btn-padding btn-success ha-btn" {{action enableRMHighAvailability target="controller"}}>{{t admin.rm_highAvailability.button.enable}}</a>
-    {{/if}}
-  </div>
-  {{/if}}
-</div>

+ 0 - 1
ambari-web/app/views.js

@@ -65,7 +65,6 @@ require('views/main/host/metrics/network');
 require('views/main/host/metrics/processes');
 require('views/main/host/addHost/step4_view');
 require('views/main/admin');
-require('views/main/admin/highAvailability_view');
 require('views/main/admin/highAvailability/nameNode/wizard_view');
 require('views/main/admin/highAvailability/progress_view');
 require('views/main/admin/highAvailability/nameNode/rollback_view');

+ 0 - 7
ambari-web/app/views/main/admin.js

@@ -40,13 +40,6 @@ App.MainAdminView = Em.View.extend({
         label: Em.I18n.t('common.security')
       });
     }
-    if (App.get('isHadoop2Stack') && App.supports.highAvailability) {
-      items.push({
-        name: 'highAvailability',
-        url: 'adminHighAvailability',
-        label: Em.I18n.t('admin.highAvailability')
-      });
-    }
     return items;
   }.property(''),
 

+ 0 - 27
ambari-web/app/views/main/admin/highAvailability_view.js

@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.MainAdminHighAvailabilityView = Em.View.extend({
-  templateName: require('templates/main/admin/highAvailability'),
-
-  supportRMHA: function () {
-    return App.get('isHadoop21Stack') && App.get('supports.resourceManagerHighAvailability');
-  }
-});

+ 0 - 7
ambari-web/app/views/main/menu.js

@@ -154,13 +154,6 @@ App.MainMenuView = Em.CollectionView.extend({
             label: Em.I18n.t('common.security')
           });
         }
-        if (App.get('isHadoop2Stack') && App.supports.highAvailability) {
-          categories.push({
-            name: 'highAvailability',
-            url: 'adminHighAvailability',
-            label: Em.I18n.t('admin.highAvailability')
-          });
-        }
       }
       return categories;
     }.property('')

+ 1 - 1
ambari-web/test/controllers/main/admin/highAvailability_controller_test.js

@@ -158,7 +158,7 @@ describe('App.MainAdminHighAvailabilityController', function () {
         return 3;
       });
       expect(controller.enableHighAvailability()).to.be.true;
-      expect(App.router.transitionTo.calledWith('main.admin.enableHighAvailability')).to.be.true;
+      expect(App.router.transitionTo.calledWith('main.services.enableHighAvailability')).to.be.true;
       expect(controller.showErrorPopup.calledOnce).to.be.false;
       App.router.get.restore();
       controller.get.restore();

+ 6 - 6
ambari-web/test/controllers/main/service/reassign/step2_controller_test.js

@@ -239,7 +239,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
     });
   });
 
-  describe('#getIsSubmitDisabled', function () {
+  describe('#updateIsSubmitDisabled', function () {
     var hostComponents = [];
     var isSubmitDisabled = false;
 
@@ -256,7 +256,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
       controller._super.restore();
     });
     it('No host-components, reassigned equal 0', function () {
-      expect(controller.getIsSubmitDisabled()).to.be.true;
+      expect(controller.updateIsSubmitDisabled()).to.be.true;
       expect(controller.get('submitDisabled')).to.be.true;
     });
     it('Reassign component match existed components, reassigned equal 0', function () {
@@ -269,7 +269,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
         selectedHost: 'host1'
       }]);
 
-      expect(controller.getIsSubmitDisabled()).to.be.true;
+      expect(controller.updateIsSubmitDisabled()).to.be.true;
       expect(controller.get('submitDisabled')).to.be.true;
     });
     it('Reassign component do not match existed components, reassigned equal 1', function () {
@@ -280,7 +280,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
       })];
       controller.set('servicesMasters', []);
 
-      expect(controller.getIsSubmitDisabled()).to.be.false;
+      expect(controller.updateIsSubmitDisabled()).to.be.false;
       expect(controller.get('submitDisabled')).to.be.false;
     });
     it('Reassign component do not match existed components, reassigned equal 2', function () {
@@ -297,14 +297,14 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
       ];
       controller.set('servicesMasters', []);
 
-      expect(controller.getIsSubmitDisabled()).to.be.true;
+      expect(controller.updateIsSubmitDisabled()).to.be.true;
       expect(controller.get('submitDisabled')).to.be.true;
     });
 
     it('submitDisabled is already true', function () {
       isSubmitDisabled = true;
 
-      expect(controller.getIsSubmitDisabled()).to.be.true;
+      expect(controller.updateIsSubmitDisabled()).to.be.true;
       expect(controller.get('submitDisabled')).to.be.true;
     });
   });