You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/05/16 10:52:40 UTC

[2/2] ambari git commit: AMBARI-16678. JS error on resize ASW and assign master popup (alexantonenko)

AMBARI-16678. JS error on resize ASW and assign master popup (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d8f3f2e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d8f3f2e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d8f3f2e

Branch: refs/heads/branch-2.4
Commit: 2d8f3f2ed5261ca1e2d0c08552adf9cb6d45e048
Parents: a255537
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon May 16 12:53:05 2016 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon May 16 13:52:34 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/styles/application.less     |  2 +-
 ambari-web/app/views/common/modal_popup.js | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2d8f3f2e/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 6d9ed46..5c9e69e 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -5040,7 +5040,7 @@ i.icon-asterisks {
   //when screen is wide, the modal width is fixed
   .full-width-modal {
     .modal{
-      width: 1155px;
+      width: 1180px;
       margin: -350px 0 0 -583px;
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2d8f3f2e/ambari-web/app/views/common/modal_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js
index 5e3544a..252604e 100644
--- a/ambari-web/app/views/common/modal_popup.js
+++ b/ambari-web/app/views/common/modal_popup.js
@@ -71,22 +71,21 @@ App.ModalPopup = Ember.View.extend({
     this.fitZIndex();
     var firstInputElement = this.$('#modal').find(':input').not(':disabled, .no-autofocus').first();
     this.focusElement(firstInputElement);
-    this.resizeHandler();
-    $(window).on('resize', this.resizeHandler.bind(this));
+    this.subscribeResize();
   },
 
-  resizeHandler: function() {
-    if (this.autoHeight && !$.mocho) {
-      var block = this.$().find('#modal > .modal-body').first();
-      if(block.offset()) {
-        block.css('max-height', $(window).height() - block.offset().top - this.marginBottom + $(window).scrollTop()); // fix popup height
-      }
+  subscribeResize: function() {
+    if (this.get('autoHeight') && !$.mocho) {
+      this.fitHeight();
+      $(window).on('resize', this.fitHeight.bind(this));
     }
   },
 
   willDestroyElement: function() {
     this.$().find('#modal').off('enter-key-pressed').off('escape-key-pressed');
-    $(window).off('resize', this.resizeHandler);
+    if (this.get('autoHeight') && !$.mocho) {
+      $(window).off('resize', this.fitHeight);
+    }
   },
 
   escapeKeyPressed: function (event) {
@@ -132,6 +131,7 @@ App.ModalPopup = Ember.View.extend({
   },
 
   fitHeight: function () {
+    if (this.get('state') === 'destroyed') return;
     var popup = this.$().find('#modal');
     var block = this.$().find('#modal > .modal-body');
     var wh = $(window).height();