Prechádzať zdrojové kódy

AMBARI-10024. UI issue on Customize Services page under SLES. (onechiporenko)

Oleg Nechiporenko 10 rokov pred
rodič
commit
928545392a

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

@@ -1212,6 +1212,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
   },
   },
 
 
   showDatabaseConnectionWarningPopup: function (serviceNames, deferred) {
   showDatabaseConnectionWarningPopup: function (serviceNames, deferred) {
+    var self = this;
     return App.ModalPopup.show({
     return App.ModalPopup.show({
       header: Em.I18n.t('installer.step7.popup.database.connection.header'),
       header: Em.I18n.t('installer.step7.popup.database.connection.header'),
       body: Em.I18n.t('installer.step7.popup.database.connection.body').format(serviceNames.join(', ')),
       body: Em.I18n.t('installer.step7.popup.database.connection.body').format(serviceNames.join(', ')),
@@ -1222,6 +1223,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
         this._super();
         this._super();
       },
       },
       onSecondary: function () {
       onSecondary: function () {
+        self.set('submitButtonClicked', false);
         deferred.reject();
         deferred.reject();
         this._super();
         this._super();
       }
       }

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

@@ -1413,4 +1413,51 @@ describe('App.InstallerStep7Controller', function () {
 
 
   });
   });
 
 
+  describe('#showDatabaseConnectionWarningPopup', function () {
+
+    var cases = [
+        {
+          method: 'onSecondary',
+          submitButtonClicked: false,
+          isRejected: true,
+          title: 'Cancel button clicked'
+        },
+        {
+          method: 'onPrimary',
+          submitButtonClicked: true,
+          isResolved: true,
+          title: 'Proceed Anyway button clicked'
+        }
+      ],
+      dfd,
+      testObject,
+      serviceNames = ['HIVE', 'OOZIE'],
+      bodyMessage = 'HIVE, OOZIE';
+
+    beforeEach(function () {
+      installerStep7Controller.set('submitButtonClicked', true);
+      dfd = $.Deferred(function (d) {
+        d.done(function () {
+          testObject.isResolved = true;
+        });
+        d.fail(function () {
+          testObject.isRejected = true;
+        })
+      });
+      testObject = {};
+    });
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        var popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
+        expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
+        popup[item.method]();
+        expect(testObject.isResolved).to.equal(item.isResolved);
+        expect(testObject.isRejected).to.equal(item.isRejected);
+        expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
+      });
+    });
+
+  });
+
 });
 });