Przeglądaj źródła

AMBARI-12960. UX: after click Override for property was opened another tab (Settings instead Advanced) (alexantonenko)

Alex Antonenko 10 lat temu
rodzic
commit
9b23a9b49e

+ 5 - 0
ambari-web/app/controllers/main/service/info/configs.js

@@ -39,6 +39,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
 
   selectedConfigGroup: null,
 
+  selectedServiceNameTrigger: null,
+
   requestsInProgress: [],
 
   groupsStore: App.ServiceConfigGroup.find(),
@@ -554,6 +556,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
     }, this);
 
     var selectedService = this.get('stepConfigs').findProperty('serviceName', this.get('content.serviceName'));
+    if (this.get('selectedService.serviceName') != selectedService.get('serviceName')) {
+      this.propertyDidChange('selectedServiceNameTrigger');
+    }
     this.set('selectedService', selectedService);
     this.checkOverrideProperty(selectedService);
     //this.checkDatabaseProperties(selectedService);

+ 3 - 0
ambari-web/app/controllers/wizard/step7_controller.js

@@ -45,6 +45,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
 
   addMiscTabToPage: true,
 
+  selectedServiceNameTrigger: null,
+
   /**
    * Is Submit-click processing now
    * @type {bool}
@@ -1396,6 +1398,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       {
         var service = errorServices[0];
         this.set('selectedService', service);
+        this.propertyDidChange('selectedServiceNameTrigger');
         $('a[href="#' + service.serviceName + '"]').tab('show');
       }
     }

+ 1 - 0
ambari-web/app/views/common/configs/service_config_tab_view.js

@@ -24,6 +24,7 @@ App.ServiceConfigTab = Em.View.extend({
 
   selectService: function (event) {
     this.set('controller.selectedService', event.context);
+    this.get('controller').propertyDidChange('selectedServiceNameTrigger');
   },
 
   didInsertElement: function () {

+ 1 - 1
ambari-web/app/views/common/configs/service_config_view.js

@@ -184,7 +184,7 @@ App.ServiceConfigView = Em.View.extend({
     this.processTabs(tabs);
     this.pickActiveTab(tabs);
     return tabs;
-  }.property('controller.selectedService.serviceName'),
+  }.property('controller.selectedServiceNameTrigger'),
 
   /**
    * Pick the first non hidden tab and make it active when there is no active tab

+ 31 - 0
ambari-web/test/controllers/wizard/step7_test.js

@@ -1843,6 +1843,12 @@ describe('App.InstallerStep7Controller', function () {
   });
 
   describe('#toggleIssuesFilter', function () {
+    beforeEach(function () {
+      sinon.stub(installerStep7Controller, 'propertyDidChange', Em.K);
+    });
+    afterEach(function () {
+      installerStep7Controller.propertyDidChange.restore();
+    });
     it('should toggle issues filter', function () {
       var issuesFilter = installerStep7Controller.get('filterColumns').findProperty('attributeName', 'hasIssues');
       issuesFilter.set('selected', false);
@@ -1851,6 +1857,31 @@ describe('App.InstallerStep7Controller', function () {
       installerStep7Controller.toggleIssuesFilter();
       expect(issuesFilter.get('selected')).to.be.false;
     });
+    it('selected service should be changed', function () {
+      installerStep7Controller.setProperties({
+        selectedService: {
+          errorCount: 0,
+          configGroups: []
+        },
+        stepConfigs: [
+          {
+            errorCount: 1,
+            configGroups: []
+          },
+          {
+            errorCount: 2,
+            configGroups: []
+          }
+        ]
+      });
+      installerStep7Controller.toggleIssuesFilter();
+      expect(installerStep7Controller.get('selectedService')).to.eql({
+        errorCount: 1,
+        configGroups: []
+      });
+      expect(installerStep7Controller.propertyDidChange.calledOnce).to.be.true;
+      expect(installerStep7Controller.propertyDidChange.calledWith('selectedServiceNameTrigger')).to.be.true;
+    });
   });
 
   describe('#addKerberosDescriptorConfigs', function() {